public boolean isChunkingNecessary() { // if there is no content length specified, is chunking necessary? // well, yes usually. but if you are a wrapped response at the httpxe layer and a legacy client, then no. // why? because the content is length-encoded already. ResourceAddress address = getLocalAddress().getTransport(); return address != null && ( ! "httpxe/1.1".equals(address.getOption(ResourceAddress.NEXT_PROTOCOL)) && ! conditionallyWrappedResponsesRequired(this)); }
public static void setServerHeader(DefaultHttpSession httpSession, HttpResponseMessage httpResponse) { if (httpSession != null) { ResourceAddress address = httpSession.getLocalAddress(); boolean serverHeaderEnabled = address.getOption(HttpResourceAddress.SERVER_HEADER_ENABLED); if (serverHeaderEnabled && !httpResponse.hasHeader("Server")) { httpResponse.setHeader("Server", "Kaazing Gateway"); } } } }
public static void setDateHeader(IoSession session, HttpResponseMessage response) { DefaultHttpSession httpSession = HttpAcceptor.SESSION_KEY.get(session); if(httpSession != null) { ResourceAddress address = httpSession.getLocalAddress(); boolean dateHeaderEnabled = address.getOption(HttpResourceAddress.DATE_HEADER_ENABLED); if(dateHeaderEnabled && !response.hasHeader("Date")) { response.setHeader(HttpHeaders.HEADER_DATE, formatDateHeader(System.currentTimeMillis())); } } }
httpResponse.setVersion(session.getVersion()); httpResponse.setHeaders(session.getWriteHeaders()); httpResponse.setInjectableHeaders(session.getLocalAddress().getOption(INJECTABLE_HEADERS)); httpResponse.setCookies(session.getWriteCookies()); httpResponse.setBlockPadding(session.getParameter(".kbp") != null);