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.AbstractThresholdOutputStream
Wrapper output stream responsible for flushing headers and handling
the incoming HTTP-level response (not necessarily the MEP response).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.cxf.io.CacheAndWriteOutputStreamThis field contains the output stream with which we cache the request.protected booleanThis boolean is true if the request must be cached.protected final booleanIf we are going to be chunking, we won't flush till close which causes new chunks, small network packets, etc..protected Stringprotected org.apache.cxf.message.Messageprotected URIFields inherited from class org.apache.cxf.io.AbstractThresholdOutputStream
buffer, thresholdFields inherited from class org.apache.cxf.io.AbstractWrappedOutputStream
allowFlush, wrappedStream, written -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWrappedOutputStream(org.apache.cxf.message.Message outMessage, boolean possibleRetransmit, boolean isChunking, int chunkThreshold, String conduitName, URI url) protected -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanThis method performs a retransmit for authorization information.voidclose()Perform any actions required on stream closure (handle response etc.)protected abstract voidprotected intprotected Stringprotected abstract HttpsURLConnectionInfoprotected abstract InputStreamprotected Stringprotected abstract InputStreamprotected abstract intprotected abstract Stringprotected voidprotected voidprotected voidprotected voidThis procedure is called on the close of the output stream so we are ready to handle the response from the connection.protected abstract voidprotected voidprotected voidhandleResponseOnWorkqueue(boolean allowCurrentThread, boolean forceWQ) protected voidThis procedure handles all retransmits, if any.protected voidThis call must take place before anything is written to the URLConnection.protected voidPerform any actions required on stream flush (freeze headers, reset output stream ... etc.)protected booleanThis 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 booleanprotected voidretransmit(String newURL) protected abstract voidprotected abstract voidsetFixedLengthStreamingMode(int i) protected abstract voidprotected abstract voidsetupNewConnection(String newURL) protected abstract voidvoidprotected abstract voidprotected abstract voidupdateResponseHeaders(org.apache.cxf.message.Message inMessage) protected abstract booleanMethods inherited from class org.apache.cxf.io.AbstractThresholdOutputStream
thresholdReached, unBuffer, write, writeMethods inherited from class org.apache.cxf.io.AbstractWrappedOutputStream
allowFlush, flush, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
cachingForRetransmission
protected boolean cachingForRetransmissionThis boolean is true if the request must be cached. -
chunking
protected final boolean chunkingIf 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 cachedStreamThis 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
-
url
-
-
Constructor Details
-
WrappedOutputStream
-
WrappedOutputStream
-
-
Method Details
-
thresholdNotReached
public void thresholdNotReached()- Specified by:
thresholdNotReachedin classorg.apache.cxf.io.AbstractThresholdOutputStream
-
setupWrappedStream
- Throws:
IOException
-
getHttpsURLConnectionInfo
- Throws:
IOException
-
setProtocolHeaders
- Throws:
IOException
-
setFixedLengthStreamingMode
protected abstract void setFixedLengthStreamingMode(int i) -
getResponseCode
- Throws:
IOException
-
getResponseMessage
- Throws:
IOException
-
updateResponseHeaders
protected abstract void updateResponseHeaders(org.apache.cxf.message.Message inMessage) throws IOException - Throws:
IOException
-
handleResponseAsync
- Throws:
IOException
-
closeInputStream
- Throws:
IOException
-
usingProxy
protected abstract boolean usingProxy() -
getInputStream
- Throws:
IOException
-
getPartialResponse
- Throws:
IOException
-
setupNewConnection
- Throws:
IOException
-
retransmitStream
- Throws:
IOException
-
updateCookiesBeforeRetransmit
- Throws:
IOException
-
handleNoOutput
- Throws:
IOException
-
handleResponseOnWorkqueue
protected void handleResponseOnWorkqueue(boolean allowCurrentThread, boolean forceWQ) throws IOException - Throws:
IOException
-
retransmit
- Throws:
IOException
-
onFirstWrite
Perform any actions required on stream flush (freeze headers, reset output stream ... etc.)- Overrides:
onFirstWritein classorg.apache.cxf.io.AbstractWrappedOutputStream- Throws:
IOException
-
getMethod
-
handleHeadersTrustCaching
- Throws:
IOException
-
close
Perform 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
-
getExceptionMessage
-
handleRetransmits
This procedure handles all retransmits, if any.- Throws:
IOException
-
processRetransmit
This function processes any retransmits at the direction of redirections or "unauthorized" responses.- Returns:
- true if there was a retransmit
- Throws:
IOException
-
redirectRetransmit
- Throws:
IOException
-
authorizationRetransmit
This method performs a retransmit for authorization information.- Returns:
- true if there was a retransmit
- Throws:
IOException
-
handleResponse
This 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
- Throws:
IOException
-
handleResponseInternal
- Throws:
IOException
-
propagateConduit
protected void propagateConduit(org.apache.cxf.message.Exchange exchange, org.apache.cxf.message.Message in) -
handleHttpRetryException
- Throws:
IOException
-
makeTrustDecision
This 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:
-