Top Description Inners Fields Constructors Methods
io.undertow.server

public Class Connectors

extends Object
Class Inheritance
Imports
io.undertow.UndertowLogger, .UndertowMessages, .UndertowOptions, io.undertow.server.handlers.Cookie, io.undertow.util.DateUtils, .HeaderMap, .HeaderValues, .Headers, .HttpString, .LegacyCookieSupport, .ParameterLimitException, .StatusCodes, .URLUtils, io.undertow.connector.PooledByteBuffer, org.xnio.OptionMap, org.xnio.channels.StreamSourceChannel, org.xnio.conduits.ConduitStreamSinkChannel, java.io.IOException, java.nio.charset.StandardCharsets, java.util.Date, java.util.concurrent.Executor, .RejectedExecutionException

This class provides the connector part of the HttpServerExchange API.

It contains methods that logically belong on the exchange, however should only be used by connector implementations.

Authors
Stuart Douglas, Richard Opalka

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private static final boolean[]
private static final boolean[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
addCookie(final HttpServerExchange
The server exchange
exchange
,
Cookie
The cookie
cookie
)

Adds the cookie into the response header map.

private static String
private static String
private static String
public static boolean
areRequestHeadersValid(HeaderMap headers)

Verifies that the provided request headers are valid according to rfc7230.

public static void
executeRootHandler(final HttpHandler handler, final HttpServerExchange exchange)

public static void
flattenCookies(final HttpServerExchange
The server exchange
exchange
)

Flattens the exchange cookie map into the response header map.

public static ConduitStreamSinkChannel
private static String
getCookieString(final Cookie cookie, boolean enableRfc6265Validation)

public static StreamSourceChannel
getExistingRequestChannel(final HttpServerExchange
The http server exchange
exchange
)

Returns the existing request channel, if it exists.

public static boolean
public static boolean
public static boolean
public static boolean
isValidTokenCharacter(byte c)

Returns true if the token character is valid according to rfc7230

public static void
public static void
setExchangeRequestPath(final HttpServerExchange
The exchange
exchange
,
final String
The encoded path
encodedPath
,
final String
The charset
charset
,
boolean decode, final boolean allowEncodedSlash, StringBuilder decodeBuffer)
Deprecated

Sets the request path and query parameters, decoding to the requested charset.

public static void
setExchangeRequestPath(final HttpServerExchange
The exchange
exchange
,
final String
The encoded path to decode
encodedPath
,
StringBuilder
The decode buffer to use
decodeBuffer
)

Sets the request path and query parameters, decoding to the requested charset.

public static void
setExchangeRequestPath(final HttpServerExchange
The exchange
exchange
,
final String
The encoded path
encodedPath
,
final String
The charset
charset
,
boolean decode, final boolean decodeSlashFlag, StringBuilder decodeBuffer, int maxParameters)

Sets the request path and query parameters, decoding to the requested charset.

public static void
public static void
public static void
public static void
public static void
ungetRequestBytes(final HttpServerExchange
The HTTP server exchange
exchange
,
PooledByteBuffer...
The buffers to attach
buffers
)

Attached buffered data to the exchange.

public static void
public static void
verifyToken(HttpString
The header to verify
header
)

Verifies that the contents of the HttpString are a valid token according to rfc7230.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALLOWED_SCHEME_CHARACTERSback to summary
private static final boolean[] ALLOWED_SCHEME_CHARACTERS
ALLOWED_TOKEN_CHARACTERSback to summary
private static final boolean[] ALLOWED_TOKEN_CHARACTERS

Constructor Detail

Connectorsback to summary
public Connectors()

Method Detail

addCookieback to summary
public static void addCookie(final HttpServerExchange exchange, Cookie cookie)

Adds the cookie into the response header map. This should be called before the response is started.

Parameters
exchange:HttpServerExchange

The server exchange

cookie:Cookie

The cookie

addRfc6265ResponseCookieToExchangeback to summary
private static String addRfc6265ResponseCookieToExchange(final Cookie cookie)
addVersion0ResponseCookieToExchangeback to summary
private static String addVersion0ResponseCookieToExchange(final Cookie cookie)
addVersion1ResponseCookieToExchangeback to summary
private static String addVersion1ResponseCookieToExchange(final Cookie cookie)
areRequestHeadersValidback to summary
public static boolean areRequestHeadersValid(HeaderMap headers)

Verifies that the provided request headers are valid according to rfc7230. In particular: - At most one content-length or transfer encoding

executeRootHandlerback to summary
public static void executeRootHandler(final HttpHandler handler, final HttpServerExchange exchange)
flattenCookiesback to summary
public static void flattenCookies(final HttpServerExchange exchange)

Flattens the exchange cookie map into the response header map. This should be called by a connector just before the response is started.

Parameters
exchange:HttpServerExchange

The server exchange

getConduitSinkChannelback to summary
public static ConduitStreamSinkChannel getConduitSinkChannel(HttpServerExchange exchange)
getCookieStringback to summary
private static String getCookieString(final Cookie cookie, boolean enableRfc6265Validation)
getExistingRequestChannelback to summary
public static StreamSourceChannel getExistingRequestChannel(final HttpServerExchange exchange)

Returns the existing request channel, if it exists. Otherwise returns null

Parameters
exchange:HttpServerExchange

The http server exchange

isEntityBodyAllowedback to summary
public static boolean isEntityBodyAllowed(HttpServerExchange exchange)
isEntityBodyAllowedback to summary
public static boolean isEntityBodyAllowed(int code)
isValidSchemeCharacterback to summary
public static boolean isValidSchemeCharacter(byte c)
isValidTokenCharacterback to summary
public static boolean isValidTokenCharacter(byte c)

Returns true if the token character is valid according to rfc7230

resetRequestChannelback to summary
public static void resetRequestChannel(final HttpServerExchange exchange)
setExchangeRequestPathback to summary
public static void setExchangeRequestPath(final HttpServerExchange exchange, final String encodedPath, final String charset, boolean decode, final boolean allowEncodedSlash, StringBuilder decodeBuffer)

Deprecated

Sets the request path and query parameters, decoding to the requested charset.

Parameters
exchange:HttpServerExchange

The exchange

encodedPath:String

The encoded path

charset:String

The charset

Annotations
@Deprecated
setExchangeRequestPathback to summary
public static void setExchangeRequestPath(final HttpServerExchange exchange, final String encodedPath, StringBuilder decodeBuffer) throws ParameterLimitException

Sets the request path and query parameters, decoding to the requested charset. All the options are retrieved from the exchange undertow options.

Parameters
exchange:HttpServerExchange

The exchange

encodedPath:String

The encoded path to decode

decodeBuffer:StringBuilder

The decode buffer to use

setExchangeRequestPathback to summary
public static void setExchangeRequestPath(final HttpServerExchange exchange, final String encodedPath, final String charset, boolean decode, final boolean decodeSlashFlag, StringBuilder decodeBuffer, int maxParameters) throws ParameterLimitException

Sets the request path and query parameters, decoding to the requested charset.

Parameters
exchange:HttpServerExchange

The exchange

encodedPath:String

The encoded path

charset:String

The charset

setRequestStartTimeback to summary
public static void setRequestStartTime(HttpServerExchange exchange)
setRequestStartTimeback to summary
public static void setRequestStartTime(HttpServerExchange existing, HttpServerExchange newExchange)
terminateRequestback to summary
public static void terminateRequest(final HttpServerExchange exchange)
terminateResponseback to summary
public static void terminateResponse(final HttpServerExchange exchange)
ungetRequestBytesback to summary
public static void ungetRequestBytes(final HttpServerExchange exchange, PooledByteBuffer... buffers)

Attached buffered data to the exchange. The will generally be used to allow data to be re-read.

Parameters
exchange:HttpServerExchange

The HTTP server exchange

buffers:PooledByteBuffer[]

The buffers to attach

updateResponseBytesSentback to summary
public static void updateResponseBytesSent(HttpServerExchange exchange, long bytes)
verifyTokenback to summary
public static void verifyToken(HttpString header)

Verifies that the contents of the HttpString are a valid token according to rfc7230.

Parameters
header:HttpString

The header to verify

io.undertow.server back to summary

private final Enum Connectors.BufferedRequestDataCleanupListener

extends Enum<Connectors.BufferedRequestDataCleanupListener>
implements ExchangeCompletionListener
Class Inheritance
All Implemented Interfaces
io.undertow.server.ExchangeCompletionListener

Field Summary

Modifier and TypeField and Description
public static final Connectors.BufferedRequestDataCleanupListener

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
public static Connectors.BufferedRequestDataCleanupListener
public static Connectors.BufferedRequestDataCleanupListener[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final Connectors.BufferedRequestDataCleanupListener INSTANCE

Constructor Detail

BufferedRequestDataCleanupListenerback to summary
private BufferedRequestDataCleanupListener()

Method Detail

exchangeEventback to summary
public void exchangeEvent(HttpServerExchange exchange, ExchangeCompletionListener.NextListener nextListener)

Implements io.undertow.server.ExchangeCompletionListener.exchangeEvent.

Annotations
@Override
valueOfback to summary
public static Connectors.BufferedRequestDataCleanupListener valueOf(String name)
valuesback to summary
public static Connectors.BufferedRequestDataCleanupListener[] values()