Class SourceHandler
java.lang.Object
org.apache.synapse.transport.passthru.SourceHandler
- All Implemented Interfaces:
org.apache.http.nio.NHttpServerEventHandler
This is the class where transport interacts with the client. This class
receives events for a particular connection. These events give information
about the message and its various states.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSourceHandler(SourceConfiguration sourceConfiguration) SourceHandler(SourceConfiguration sourceConfiguration, List<StreamInterceptor> streamInterceptors) -
Method Summary
Modifier and TypeMethodDescriptionbooleanapplyCorrelationId(org.apache.http.nio.NHttpServerConnection conn) Sets the correlation ID of the incoming request, and rejects the request if the incoming correlation header value is invalid and such requests are configured to be rejected.voidclosed(org.apache.http.nio.NHttpServerConnection conn) voidcommitResponseHideExceptions(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.HttpResponse response) Commit the response to the connection.voidconnected(org.apache.http.nio.NHttpServerConnection conn) voidendOfInput(org.apache.http.nio.NHttpServerConnection conn) voidgetOutputStream(String method, SourceRequest request) Create synapse.response-source-buffer for GET and HEAD Http methodsgetSourceRequest(org.apache.http.nio.NHttpServerConnection conn) Create SourceRequest from NHttpServerConnection connvoidinformReaderError(org.apache.http.nio.NHttpServerConnection conn) voidinformWriterError(org.apache.http.nio.NHttpServerConnection conn) voidinputReady(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentDecoder decoder) voidlogIOException(org.apache.http.nio.NHttpServerConnection conn, IOException e) voidoutputReady(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentEncoder encoder) voidrequestReceived(org.apache.http.nio.NHttpServerConnection conn) voidresponseReady(org.apache.http.nio.NHttpServerConnection conn) voidsetCorrelationId(org.apache.http.nio.NHttpServerConnection conn) Sets the correlation ID of the incoming request.voidstop()Shutting down the thread pools.voidtimeout(org.apache.http.nio.NHttpServerConnection conn)
-
Field Details
-
PROPERTY_FILE
- See Also:
-
MESSAGE_SIZE_VALIDATION
- See Also:
-
VALID_MAX_MESSAGE_SIZE
- See Also:
-
-
Constructor Details
-
SourceHandler
-
SourceHandler
public SourceHandler(SourceConfiguration sourceConfiguration, List<StreamInterceptor> streamInterceptors)
-
-
Method Details
-
connected
public void connected(org.apache.http.nio.NHttpServerConnection conn) - Specified by:
connectedin interfaceorg.apache.http.nio.NHttpServerEventHandler
-
requestReceived
public void requestReceived(org.apache.http.nio.NHttpServerConnection conn) - Specified by:
requestReceivedin interfaceorg.apache.http.nio.NHttpServerEventHandler
-
setCorrelationId
public void setCorrelationId(org.apache.http.nio.NHttpServerConnection conn) Sets the correlation ID of the incoming request. If the incoming correlation header value is invalid and such requests are configured to be rejected, the request is rejected, after whichgetSourceRequest(NHttpServerConnection)returns null.- Parameters:
conn- the client connection- See Also:
-
applyCorrelationId
public boolean applyCorrelationId(org.apache.http.nio.NHttpServerConnection conn) Sets the correlation ID of the incoming request, and rejects the request if the incoming correlation header value is invalid and such requests are configured to be rejected.- Parameters:
conn- the client connection- Returns:
- false if the request was rejected, in which case it must not be processed further, true otherwise
-
inputReady
public void inputReady(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentDecoder decoder) - Specified by:
inputReadyin interfaceorg.apache.http.nio.NHttpServerEventHandler
-
responseReady
public void responseReady(org.apache.http.nio.NHttpServerConnection conn) - Specified by:
responseReadyin interfaceorg.apache.http.nio.NHttpServerEventHandler
-
outputReady
public void outputReady(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentEncoder encoder) - Specified by:
outputReadyin interfaceorg.apache.http.nio.NHttpServerEventHandler
-
logIOException
-
timeout
public void timeout(org.apache.http.nio.NHttpServerConnection conn) - Specified by:
timeoutin interfaceorg.apache.http.nio.NHttpServerEventHandler
-
closed
public void closed(org.apache.http.nio.NHttpServerConnection conn) - Specified by:
closedin interfaceorg.apache.http.nio.NHttpServerEventHandler
-
endOfInput
- Specified by:
endOfInputin interfaceorg.apache.http.nio.NHttpServerEventHandler- Throws:
IOException
-
exception
- Specified by:
exceptionin interfaceorg.apache.http.nio.NHttpServerEventHandler
-
informReaderError
public void informReaderError(org.apache.http.nio.NHttpServerConnection conn) -
informWriterError
public void informWriterError(org.apache.http.nio.NHttpServerConnection conn) -
commitResponseHideExceptions
public void commitResponseHideExceptions(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.HttpResponse response) Commit the response to the connection. Processes the response through the configured HttpProcessor and submits it to be sent out. This method hides any exceptions and is targetted for non critical (i.e. browser requests etc) requests, which are not core messages- Parameters:
conn- the connection being processedresponse- the response to commit over the connection
-
stop
public void stop()Shutting down the thread pools. -
getOutputStream
Create synapse.response-source-buffer for GET and HEAD Http methods- Parameters:
method- Http Methodrequest- Source Request- Returns:
- OutputStream
-
getSourceRequest
public SourceRequest getSourceRequest(org.apache.http.nio.NHttpServerConnection conn) throws IOException, org.apache.http.HttpException Create SourceRequest from NHttpServerConnection conn- Parameters:
conn- the connection being processed- Returns:
- SourceRequest
- Throws:
IOExceptionorg.apache.http.HttpException
-