Package org.apache.cxf.transport.http
Class HTTPConduit.WrappedOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.cxf.io.AbstractWrappedOutputStream
-
- org.apache.cxf.io.AbstractThresholdOutputStream
-
- org.apache.cxf.transport.http.HTTPConduit.WrappedOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Enclosing class:
- HTTPConduit
protected abstract class HTTPConduit.WrappedOutputStream extends org.apache.cxf.io.AbstractThresholdOutputStreamWrapper output stream responsible for flushing headers and handling the incoming HTTP-level response (not necessarily the MEP response).
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.cxf.io.CacheAndWriteOutputStreamcachedStreamThis field contains the output stream with which we cache the request.protected booleancachingForRetransmissionThis boolean is true if the request must be cached.protected booleanchunkingIf we are going to be chunking, we won't flush till close which causes new chunks, small network packets, etc..protected StringconduitNameprotected org.apache.cxf.message.MessageoutMessageprotected URIurl
-
Constructor Summary
Constructors Modifier Constructor Description protectedWrappedOutputStream(org.apache.cxf.message.Message outMessage, boolean possibleRetransmit, boolean isChunking, int chunkThreshold, String conduitName, URI url)protectedWrappedOutputStream(HTTPConduit.WrappedOutputStream wos)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanauthorizationRetransmit()This method performs a retransmit for authorization information.voidclose()Perform any actions required on stream closure (handle response etc.)protected abstract voidcloseInputStream()protected intdoProcessResponseCode()protected StringgetExceptionMessage(Throwable t)protected abstract HttpsURLConnectionInfogetHttpsURLConnectionInfo()protected abstract InputStreamgetInputStream()protected StringgetMethod()protected abstract InputStreamgetPartialResponse()protected abstract intgetResponseCode()protected abstract StringgetResponseMessage()protected voidhandleHeadersTrustCaching()protected voidhandleHttpRetryException(HttpRetryException e)protected voidhandleNoOutput()protected voidhandleResponse()This procedure is called on the close of the output stream so we are ready to handle the response from the connection.protected abstract voidhandleResponseAsync()protected voidhandleResponseInternal()protected voidhandleResponseOnWorkqueue(boolean allowCurrentThread, boolean forceWQ)protected voidhandleRetransmits()This procedure handles all retransmits, if any.protected voidmakeTrustDecision()This call must take place before anything is written to the URLConnection.protected voidonFirstWrite()Perform any actions required on stream flush (freeze headers, reset output stream ...protected booleanprocessRetransmit()This function processes any retransmits at the direction of redirections or "unauthorized" responses.protected voidpropagateConduit(org.apache.cxf.message.Exchange exchange, org.apache.cxf.message.Message in)protected booleanredirectRetransmit()protected voidretransmit(String newURL)protected abstract voidretransmitStream()protected abstract voidsetFixedLengthStreamingMode(int i)protected abstract voidsetProtocolHeaders()protected abstract voidsetupNewConnection(String newURL)protected abstract voidsetupWrappedStream()voidthresholdNotReached()protected abstract voidupdateCookiesBeforeRetransmit()protected abstract voidupdateResponseHeaders(org.apache.cxf.message.Message inMessage)protected abstract booleanusingProxy()-
Methods inherited from class org.apache.cxf.io.AbstractThresholdOutputStream
thresholdReached, unBuffer, write, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
cachingForRetransmission
protected boolean cachingForRetransmission
This boolean is true if the request must be cached.
-
chunking
protected final boolean chunking
If we are going to be chunking, we won't flush till close which causes new chunks, small network packets, etc..
-
cachedStream
protected org.apache.cxf.io.CacheAndWriteOutputStream cachedStream
This field contains the output stream with which we cache the request. It maybe null if we are not caching.
-
outMessage
protected org.apache.cxf.message.Message outMessage
-
conduitName
protected String conduitName
-
url
protected URI url
-
-
Constructor Detail
-
WrappedOutputStream
protected WrappedOutputStream(org.apache.cxf.message.Message outMessage, boolean possibleRetransmit, boolean isChunking, int chunkThreshold, String conduitName, URI url)
-
WrappedOutputStream
protected WrappedOutputStream(HTTPConduit.WrappedOutputStream wos)
-
-
Method Detail
-
thresholdNotReached
public void thresholdNotReached()
- Specified by:
thresholdNotReachedin classorg.apache.cxf.io.AbstractThresholdOutputStream
-
setupWrappedStream
protected abstract void setupWrappedStream() throws IOException- Throws:
IOException
-
getHttpsURLConnectionInfo
protected abstract HttpsURLConnectionInfo getHttpsURLConnectionInfo() throws IOException
- Throws:
IOException
-
setProtocolHeaders
protected abstract void setProtocolHeaders() throws IOException- Throws:
IOException
-
setFixedLengthStreamingMode
protected abstract void setFixedLengthStreamingMode(int i)
-
getResponseCode
protected abstract int getResponseCode() throws IOException- Throws:
IOException
-
getResponseMessage
protected abstract String getResponseMessage() throws IOException
- Throws:
IOException
-
updateResponseHeaders
protected abstract void updateResponseHeaders(org.apache.cxf.message.Message inMessage) throws IOException- Throws:
IOException
-
handleResponseAsync
protected abstract void handleResponseAsync() throws IOException- Throws:
IOException
-
closeInputStream
protected abstract void closeInputStream() throws IOException- Throws:
IOException
-
usingProxy
protected abstract boolean usingProxy()
-
getInputStream
protected abstract InputStream getInputStream() throws IOException
- Throws:
IOException
-
getPartialResponse
protected abstract InputStream getPartialResponse() throws IOException
- Throws:
IOException
-
setupNewConnection
protected abstract void setupNewConnection(String newURL) throws IOException
- Throws:
IOException
-
retransmitStream
protected abstract void retransmitStream() throws IOException- Throws:
IOException
-
updateCookiesBeforeRetransmit
protected abstract void updateCookiesBeforeRetransmit() throws IOException- Throws:
IOException
-
handleNoOutput
protected void handleNoOutput() throws IOException- Throws:
IOException
-
handleResponseOnWorkqueue
protected void handleResponseOnWorkqueue(boolean allowCurrentThread, boolean forceWQ) throws IOException- Throws:
IOException
-
retransmit
protected void retransmit(String newURL) throws IOException
- Throws:
IOException
-
onFirstWrite
protected void onFirstWrite() throws IOExceptionPerform any actions required on stream flush (freeze headers, reset output stream ... etc.)- Overrides:
onFirstWritein classorg.apache.cxf.io.AbstractWrappedOutputStream- Throws:
IOException
-
getMethod
protected String getMethod()
-
handleHeadersTrustCaching
protected void handleHeadersTrustCaching() throws IOException- Throws:
IOException
-
close
public void close() throws IOExceptionPerform any actions required on stream closure (handle response etc.)- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classorg.apache.cxf.io.AbstractThresholdOutputStream- Throws:
IOException
-
handleRetransmits
protected void handleRetransmits() throws IOExceptionThis procedure handles all retransmits, if any.- Throws:
IOException
-
processRetransmit
protected boolean processRetransmit() throws IOExceptionThis function processes any retransmits at the direction of redirections or "unauthorized" responses.- Returns:
- true if there was a retransmit
- Throws:
IOException
-
redirectRetransmit
protected boolean redirectRetransmit() throws IOException- Throws:
IOException
-
authorizationRetransmit
protected boolean authorizationRetransmit() throws IOExceptionThis method performs a retransmit for authorization information.- Returns:
- true if there was a retransmit
- Throws:
IOException
-
handleResponse
protected void handleResponse() throws IOExceptionThis procedure is called on the close of the output stream so we are ready to handle the response from the connection. We may retransmit until we finally get a response.- Throws:
IOException
-
doProcessResponseCode
protected int doProcessResponseCode() throws IOException- Throws:
IOException
-
handleResponseInternal
protected void handleResponseInternal() throws IOException- Throws:
IOException
-
propagateConduit
protected void propagateConduit(org.apache.cxf.message.Exchange exchange, org.apache.cxf.message.Message in)
-
handleHttpRetryException
protected void handleHttpRetryException(HttpRetryException e) throws IOException
- Throws:
IOException
-
makeTrustDecision
protected void makeTrustDecision() throws IOExceptionThis call must take place before anything is written to the URLConnection. The URLConnection.connect() will be called in order to get the connection information. This method is invoked just after setURLRequestHeaders() from the WrappedOutputStream before it writes data to the URLConnection. If trust cannot be established the Trust Decider implemenation throws an IOException.- Throws:
IOException- This exception is thrown if trust cannot be established by the configured MessageTrustDecider.- See Also:
MessageTrustDecider
-
-