Class SourceHandler
- java.lang.Object
-
- org.apache.synapse.transport.passthru.SourceHandler
-
- All Implemented Interfaces:
org.apache.http.nio.NHttpServerEventHandler
public class SourceHandler extends Object implements 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 Modifier and Type Field Description static StringMESSAGE_SIZE_VALIDATIONstatic StringPROPERTY_FILEstatic StringVALID_MAX_MESSAGE_SIZE
-
Constructor Summary
Constructors Constructor Description SourceHandler(SourceConfiguration sourceConfiguration)SourceHandler(SourceConfiguration sourceConfiguration, List<StreamInterceptor> streamInterceptors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)voidexception(org.apache.http.nio.NHttpServerConnection conn, Exception ex)OutputStreamgetOutputStream(String method, SourceRequest request)Create synapse.response-source-buffer for GET and HEAD Http methodsSourceRequestgetSourceRequest(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)voidstop()Shutting down the thread pools.voidtimeout(org.apache.http.nio.NHttpServerConnection conn)
-
-
-
Field Detail
-
PROPERTY_FILE
public static final String PROPERTY_FILE
- See Also:
- Constant Field Values
-
MESSAGE_SIZE_VALIDATION
public static final String MESSAGE_SIZE_VALIDATION
- See Also:
- Constant Field Values
-
VALID_MAX_MESSAGE_SIZE
public static final String VALID_MAX_MESSAGE_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SourceHandler
public SourceHandler(SourceConfiguration sourceConfiguration)
-
SourceHandler
public SourceHandler(SourceConfiguration sourceConfiguration, List<StreamInterceptor> streamInterceptors)
-
-
Method Detail
-
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)
-
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
public void logIOException(org.apache.http.nio.NHttpServerConnection conn, IOException e)
-
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
public void endOfInput(org.apache.http.nio.NHttpServerConnection conn) throws IOException- Specified by:
endOfInputin interfaceorg.apache.http.nio.NHttpServerEventHandler- Throws:
IOException
-
exception
public void exception(org.apache.http.nio.NHttpServerConnection conn, Exception ex)- 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
public OutputStream getOutputStream(String method, SourceRequest request)
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
-
-