Class ProxyRequestHandler
java.lang.Object
io.fluxzero.sdk.common.AbstractNamespaced<ProxyRequestHandler>
io.fluxzero.proxy.ProxyRequestHandler
- All Implemented Interfaces:
Namespaced<ProxyRequestHandler>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected classprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringEnables returning proxy benchmark trace headers when a request also includesBENCHMARK_TRACE_ID_HEADER.static final Stringstatic final StringMaximum payload bytes per web request chunk whenREQUEST_CHUNKING_ENABLED_PROPERTYis enabled.static final StringEnables publishing large or unknown-length request bodies as chunked web request messages.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyBenchmarkTraceHeaders(SerializedMessage responseMessage, ProxyRequestHandler.ProxyResponseContext responseContext, Instant proxyWebResponseReceived) protected booleanvoidclose()protected voidcompleteChunkedResponse(ProxyRequestHandler.ChunkedProxyRequest chunkedRequest, SerializedMessage response, Throwable error, ProxyRequestHandler.ProxyResponseContext responseContext) protected voidcompleteResponse(SerializedMessage response, Throwable error, ProxyRequestHandler.ProxyResponseContext responseContext) protected booleancorsOrigin(String origin) protected SerializedMessagecreateChunkedRequestMessage(WebRequest webRequest, byte[] chunk, long chunkIndex, boolean firstChunk, boolean finalChunk) protected ProxyRequestHandlercreateForNamespace(String namespace) protected ProxyRequestHandler.ProxyResponseContextcreateResponseContext(WebRequest webRequest, ProxyRequestHandler.JettyExchange exchange) protected WebRequestcreateWebRequest(ProxyRequestHandler.JettyExchange exchange, byte[] payload) protected ProxyRequestHandler.ChunkedProxyRequestdispatchReadableChunks(WebRequest webRequest, ProxyRequestHandler.ChunkAccumulator pending, boolean last, ProxyRequestHandler.ChunkedProxyRequest chunkedRequest) protected voiddoSendChunkedWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest) protected voiddoSendWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest) booleanhandle(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, org.eclipse.jetty.util.Callback callback) protected booleanprotected voidhandleResponse(SerializedMessage responseMessage, ProxyRequestHandler.ProxyResponseContext responseContext) protected booleanprotected booleanprotected voidprepareForSending(SerializedMessage responseMessage, ProxyRequestHandler.JettyExchange exchange, int statusCode) protected voidreadChunkedWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest) protected voidprotected voidprotected voidsendResolvedWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest, boolean chunked) protected voidsendResponse(SerializedMessage responseMessage, ProxyRequestHandler.JettyExchange exchange) protected voidprotected voidsendWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest, boolean chunked) protected booleanprotected WebRequesttryUpgrade(WebRequest webRequest) Methods inherited from class AbstractNamespaced
forNamespaceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Namespaced
forDefaultNamespace
-
Field Details
-
CORS_DOMAINS_PROPERTY
- See Also:
-
REQUEST_TIMEOUT_SECONDS_PROPERTY
- See Also:
-
REQUEST_CHUNKING_ENABLED_PROPERTY
Enables publishing large or unknown-length request bodies as chunked web request messages.Defaults to
falsefor backward compatibility with applications that still run older SDK clients.- See Also:
-
REQUEST_CHUNK_SIZE_PROPERTY
Maximum payload bytes per web request chunk whenREQUEST_CHUNKING_ENABLED_PROPERTYis enabled.- See Also:
-
BENCHMARK_TRACE_HEADERS_ENABLED_PROPERTY
Enables returning proxy benchmark trace headers when a request also includesBENCHMARK_TRACE_ID_HEADER.Use system property
fluxzero.proxy.benchmark.trace.headers.enabled=trueor environment variableFLUXZERO_PROXY_BENCHMARK_TRACE_HEADERS_ENABLED=true.- See Also:
-
-
Constructor Details
-
ProxyRequestHandler
-
-
Method Details
-
createForNamespace
- Specified by:
createForNamespacein classAbstractNamespaced<ProxyRequestHandler>
-
handle
public boolean handle(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, org.eclipse.jetty.util.Callback callback) -
createWebRequest
-
tryUpgrade
-
knownRequestBodyTooLarge
-
shouldChunkRequest
-
isWebsocketUpgrade
-
handleCorsPreflight
-
applyCorsHeaders
-
corsOrigin
-
sendWebRequest
protected void sendWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest, boolean chunked) -
sendResolvedWebRequest
protected void sendResolvedWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest, boolean chunked) -
doSendWebRequest
-
createResponseContext
protected ProxyRequestHandler.ProxyResponseContext createResponseContext(WebRequest webRequest, ProxyRequestHandler.JettyExchange exchange) -
doSendChunkedWebRequest
protected void doSendChunkedWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest) -
readChunkedWebRequest
protected void readChunkedWebRequest(ProxyRequestHandler.JettyExchange exchange, WebRequest webRequest) -
dispatchReadableChunks
protected ProxyRequestHandler.ChunkedProxyRequest dispatchReadableChunks(WebRequest webRequest, ProxyRequestHandler.ChunkAccumulator pending, boolean last, ProxyRequestHandler.ChunkedProxyRequest chunkedRequest) -
createChunkedRequestMessage
protected SerializedMessage createChunkedRequestMessage(WebRequest webRequest, byte[] chunk, long chunkIndex, boolean firstChunk, boolean finalChunk) -
completeChunkedResponse
protected void completeChunkedResponse(ProxyRequestHandler.ChunkedProxyRequest chunkedRequest, SerializedMessage response, Throwable error, ProxyRequestHandler.ProxyResponseContext responseContext) -
completeResponse
protected void completeResponse(SerializedMessage response, Throwable error, ProxyRequestHandler.ProxyResponseContext responseContext) -
handleResponse
protected void handleResponse(SerializedMessage responseMessage, ProxyRequestHandler.ProxyResponseContext responseContext) -
applyBenchmarkTraceHeaders
protected void applyBenchmarkTraceHeaders(SerializedMessage responseMessage, ProxyRequestHandler.ProxyResponseContext responseContext, Instant proxyWebResponseReceived) -
prepareForSending
protected void prepareForSending(SerializedMessage responseMessage, ProxyRequestHandler.JettyExchange exchange, int statusCode) -
sendResponse
protected void sendResponse(SerializedMessage responseMessage, ProxyRequestHandler.JettyExchange exchange) -
sendServerError
-
sendGatewayTimeout
-
sendRequestTimeout
-
close
public void close()- Overrides:
closein classAbstractNamespaced<ProxyRequestHandler>
-