Class SourceResponse
java.lang.Object
org.apache.synapse.transport.passthru.SourceResponse
-
Constructor Summary
ConstructorsConstructorDescriptionSourceResponse(SourceConfiguration config, int status, String statusLine, SourceRequest request) SourceResponse(SourceConfiguration config, int status, SourceRequest request) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcheckResponseChunkDisable(org.apache.axis2.context.MessageContext responseMsgContext) voidcopyAndWrite(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentEncoder encoder) Same aswrite(org.apache.http.nio.NHttpServerConnection, org.apache.http.nio.ContentEncoder)but gives out the data consumed through the PipebooleanvoidremoveHeader(String name) voidremoveHeaderIgnoreCase(String name) Removes every header whose name matches the given name ignoring its letter case.voidsetKeepAlive(boolean keepAlive) voidsetStatus(int status) voidsetStatusLine(String statusLine) voidstart(org.apache.http.nio.NHttpServerConnection conn) Starts the response by writing the headersintwrite(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentEncoder encoder) Consume the content through the Pipe and write them to the wire
-
Constructor Details
-
SourceResponse
-
SourceResponse
public SourceResponse(SourceConfiguration config, int status, String statusLine, SourceRequest request)
-
-
Method Details
-
connect
-
start
public void start(org.apache.http.nio.NHttpServerConnection conn) throws IOException, org.apache.http.HttpException Starts the response by writing the headers- Parameters:
conn- connection- Throws:
IOException- if an error occursorg.apache.http.HttpException- if an error occurs
-
checkResponseChunkDisable
public void checkResponseChunkDisable(org.apache.axis2.context.MessageContext responseMsgContext) throws IOException - Throws:
IOException
-
write
public int write(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentEncoder encoder) throws IOException Consume the content through the Pipe and write them to the wire- Parameters:
conn- connectionencoder- encoder- Returns:
- number of bytes written
- Throws:
IOException- if an error occurs
-
copyAndWrite
public ByteBuffer copyAndWrite(org.apache.http.nio.NHttpServerConnection conn, org.apache.http.nio.ContentEncoder encoder) throws IOException Same aswrite(org.apache.http.nio.NHttpServerConnection, org.apache.http.nio.ContentEncoder)but gives out the data consumed through the Pipe- Parameters:
conn- connectionencoder- encoder- Returns:
- data consumed
- Throws:
IOException- if an error occurs
-
addHeader
-
setStatus
public void setStatus(int status) -
setStatusLine
-
removeHeader
-
removeHeaderIgnoreCase
Removes every header whose name matches the given name ignoring its letter case. Used to avoid sending duplicate headers to the client when the backend has returned a header in a casing different to the one used by the transport (e.g. "content-type" against "Content-Type").- Parameters:
name- name of the header to be removed
-
getHeader
-
hasEntity
public boolean hasEntity() -
setKeepAlive
public void setKeepAlive(boolean keepAlive)
-