private void addAcceptHeaders(final HttpRequestPacket requestPacket) { final MimeHeaders headers = requestPacket.getHeaders(); if (config.isCompressionEnforced() && !headers.contains(Header.AcceptEncoding)) { headers.addValue(Header.AcceptEncoding).setString("gzip"); } if (!headers.contains(Header.Accept)) { headers.addValue(Header.Accept).setString("*/*"); } }
private void addServiceHeaders(final HttpRequestPacket requestPacket) { final MimeHeaders headers = requestPacket.getHeaders(); if (!headers.contains(Header.UserAgent)) { headers.addValue(Header.UserAgent).setString(config.getUserAgent()); } setKeepAliveForHeader(Header.Connection, requestPacket); }
/** * Set the HTTP request method. * @param method the HTTP request method. Format is "GET|POST...". */ public void setMethod(final String method) { this.methodC.setString(method); parsedMethod = null; }
/** * Set the <code>query</code> portion of the request URI. * * @param query the query String */ public void setQueryString(String query) { queryC.setString(query); }
/** * Sets the status reason phrase for this response. * * @param message the status reason phrase for this response. */ public void setReasonPhrase(final String message) { reasonPhraseC.setString(message); }
/** * Set the HTTP request method. * @param method the HTTP request method. Format is "GET|POST...". */ public void setMethod(final String method) { this.methodC.setString(method); parsedMethod = null; }
/** * Set the <code>query</code> portion of the request URI. * * @param query the query String */ public void setQueryString(String query) { queryC.setString(query); }
/** * Set the name of the server (virtual host) to process this request. * * @param name The server name */ @SuppressWarnings("unused") public void setServerName(String name) { request.serverName().setString(name); }
@Override public void onDecoded(final CharSequence name, final CharSequence value) { if (capture != null) { capture.put(name.toString(), value.toString()); } // TODO trailer validation headers.addValue(name.toString()).setString(value.toString()); }
/** * {@inheritDoc} */ @Override public void addHeader(final String name, final String value) { if (name == null || value == null) { return; } trailers.addValue(name).setString(value); }
/** * @return a {@link DataChunk} representing the Internet Protocol (IP) * address of the interface on which the request was received. */ public DataChunk localAddr() { if (localAddressC.isNull()) { InetAddress inetAddr = ((InetSocketAddress) connection .getLocalAddress()).getAddress(); localAddressC.setString(inetAddr.getHostAddress()); } return localAddressC; }
/** * @return the {@link DataChunk} representing the Internet Protocol (IP) * address of the client or last proxy that sent the request. */ public DataChunk remoteAddr() { if (remoteAddressC.isNull()) { remoteAddressC .setString(((InetSocketAddress) connection.getPeerAddress()) .getAddress().getHostAddress()); } return remoteAddressC; }
/** * @return the {@link DataChunk} representing the Internet Protocol (IP) * address of the client or last proxy that sent the request. */ public DataChunk remoteAddr() { if (remoteAddressC.isNull()) { remoteAddressC .setString(((InetSocketAddress) connection.getPeerAddress()) .getAddress().getHostAddress()); } return remoteAddressC; }
/** * @return the {@link DataChunk} representing the Internet Protocol (IP) * address of the client or last proxy that sent the request. */ public DataChunk remoteAddr() { if (remoteAddressC.isNull()) { remoteAddressC .setString(((InetSocketAddress) connection.getPeerAddress()) .getAddress().getHostAddress()); } return remoteAddressC; }
/** * @return a {@link DataChunk} representing the Internet Protocol (IP) * address of the interface on which the request was received. */ public DataChunk localAddr() { if (localAddressC.isNull()) { InetAddress inetAddr = ((InetSocketAddress) connection .getLocalAddress()).getAddress(); localAddressC.setString(inetAddr.getHostAddress()); } return localAddressC; }
/** * {@inheritDoc} */ @Override public void setHeader(final String name, final String value) { if (name == null || value == null || name.isEmpty()) { return; } if (handleSetSpecialHeaders(name, value)) return; headers.setValue(name).setString(value); }
private static void prepareRequest(final HttpRequestPacket request) { String contentType = request.getContentType(); if (contentType != null) { request.getHeaders().setValue(Header.ContentType).setString(contentType); } }
private static void processNormalHeader(final HttpHeader httpHeader, final String name, final String value) { if (name.equals(Header.Host.getLowerCase())) { return; } final MimeHeaders mimeHeaders = httpHeader.getHeaders(); final DataChunk valueChunk = mimeHeaders.addValue(name); validateHeaderCharacters(name, value); valueChunk.setString(value); finalizeKnownHeader(httpHeader, name, value); }
protected void prepareOutgoingRequest(final HttpRequestPacket request) { String contentType = request.getContentType(); if (contentType != null) { request.getHeaders().setValue(Header.ContentType).setString(contentType); } if (request.getContentLength() != -1) { // FixedLengthTransferEncoding will set proper Content-Length header FIXED_LENGTH_ENCODING.prepareSerialize(null, request, null); } }
public void updateUserPrincipal(Request grizzlyRequest) { final GlassfishSession gfSession = doGetSession(false); if (gfSession != null) { grizzlyRequest.setUserPrincipal(gfSession.getPrincipal()); grizzlyRequest.getRequest().authType().setString(gfSession.getAuthType()); } }