Class HttpExchangeConnection
java.lang.Object
org.springframework.ws.transport.AbstractWebServiceConnection
org.springframework.ws.transport.AbstractReceiverConnection
org.springframework.ws.transport.http.HttpExchangeConnection
- All Implemented Interfaces:
AutoCloseable,EndpointAwareWebServiceConnection,FaultAwareWebServiceConnection,HeadersAwareReceiverWebServiceConnection,WebServiceConnection
public class HttpExchangeConnection
extends AbstractReceiverConnection
implements EndpointAwareWebServiceConnection, FaultAwareWebServiceConnection
Implementation of
WebServiceConnection that is based on the Java 6 HttpServer
HttpExchange.- Since:
- 1.5.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpExchangeConnection(HttpExchange httpExchange) Constructs a new exchange connection with the givenHttpExchange. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResponseHeader(String name, String value) Adds a response header with the given name and value.voidCalled when an endpoint is not found.Returns the error message.Returns theHttpExchangefor this connection.Returns an iteration over all the header names this request contains.getRequestHeaders(String name) Returns an iteration over all the string values of the specified header.protected InputStreamReturns the input stream to read the response from.protected OutputStreamReturns the output stream to write the request to.getUri()Returns the URI for this connection.booleanhasError()Indicates whether this connection has an error.booleanhasFault()Indicates whether this connection received a fault.voidonClose()Template method invoked fromAbstractWebServiceConnection.close().protected voidonSendAfterWrite(WebServiceMessage message) Called after the given message has been written to theTransportOutputStream.voidsetFault(boolean fault) Deprecated.voidsetFaultCode(QName faultCode) Sets a specific fault code.Methods inherited from class org.springframework.ws.transport.AbstractReceiverConnection
createTransportInputStream, createTransportOutputStreamMethods inherited from class org.springframework.ws.transport.AbstractWebServiceConnection
close, onReceiveAfterRead, onReceiveBeforeRead, onSendBeforeWrite, receive, sendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ws.transport.WebServiceConnection
close, receive, send
-
Constructor Details
-
HttpExchangeConnection
Constructs a new exchange connection with the givenHttpExchange.
-
-
Method Details
-
getHttpExchange
Returns theHttpExchangefor this connection. -
getUri
Description copied from interface:WebServiceConnectionReturns the URI for this connection.- Specified by:
getUriin interfaceWebServiceConnection- Throws:
URISyntaxException
-
endpointNotFound
public void endpointNotFound()Description copied from interface:EndpointAwareWebServiceConnectionCalled when an endpoint is not found.- Specified by:
endpointNotFoundin interfaceEndpointAwareWebServiceConnection
-
hasError
Description copied from interface:WebServiceConnectionIndicates whether this connection has an error. Typically, error detection is done by inspecting connection error codes, etc.- Specified by:
hasErrorin interfaceWebServiceConnection- Returns:
trueif this connection has an error;falseotherwise.- Throws:
IOException
-
getErrorMessage
Description copied from interface:WebServiceConnectionReturns the error message.- Specified by:
getErrorMessagein interfaceWebServiceConnection- Returns:
- the connection error message, if any; returns
nullwhen no error is present - Throws:
IOException- See Also:
-
getRequestHeaderNames
Description copied from interface:HeadersAwareReceiverWebServiceConnectionReturns an iteration over all the header names this request contains. Returns an emptyIteratorif there are no headers.- Specified by:
getRequestHeaderNamesin interfaceHeadersAwareReceiverWebServiceConnection- Throws:
IOException
-
getRequestHeaders
Description copied from interface:HeadersAwareReceiverWebServiceConnectionReturns an iteration over all the string values of the specified header. Returns an emptyIteratorif there are no headers of the specified name.- Specified by:
getRequestHeadersin interfaceHeadersAwareReceiverWebServiceConnection- Throws:
IOException
-
getRequestInputStream
Description copied from class:AbstractReceiverConnectionReturns the input stream to read the response from.- Specified by:
getRequestInputStreamin classAbstractReceiverConnection- Throws:
IOException
-
addResponseHeader
Description copied from interface:HeadersAwareReceiverWebServiceConnectionAdds a response header with the given name and value. This method can be called multiple times, to allow for headers with multiple values.- Specified by:
addResponseHeaderin interfaceHeadersAwareReceiverWebServiceConnection- Parameters:
name- the name of the headervalue- the value of the header- Throws:
IOException
-
getResponseOutputStream
Description copied from class:AbstractReceiverConnectionReturns the output stream to write the request to.- Specified by:
getResponseOutputStreamin classAbstractReceiverConnection- Throws:
IOException
-
onSendAfterWrite
Description copied from class:AbstractWebServiceConnectionCalled after the given message has been written to theTransportOutputStream. Called fromAbstractWebServiceConnection.send(WebServiceMessage).Default implementation does nothing.
- Overrides:
onSendAfterWritein classAbstractWebServiceConnection- Parameters:
message- the message- Throws:
IOException- when an I/O exception occurs
-
onClose
Description copied from class:AbstractReceiverConnectionTemplate method invoked fromAbstractWebServiceConnection.close(). Default implementation is empty.- Overrides:
onClosein classAbstractReceiverConnection- Throws:
IOException- if an I/O error occurs when closing this connection
-
hasFault
Description copied from interface:FaultAwareWebServiceConnectionIndicates whether this connection received a fault.Typically implemented by looking at an HTTP status code.
- Specified by:
hasFaultin interfaceFaultAwareWebServiceConnection- Returns:
trueif this connection received a fault;falseotherwise.- Throws:
IOException- in case of I/O errors
-
setFault
Deprecated.Description copied from interface:FaultAwareWebServiceConnectionSets whether this connection will send a fault.Typically implemented by setting an HTTP status code.
- Specified by:
setFaultin interfaceFaultAwareWebServiceConnection- Parameters:
fault-trueif this will send a fault;falseotherwise.- Throws:
IOException- in case of I/O errors
-
setFaultCode
Description copied from interface:FaultAwareWebServiceConnectionSets a specific fault code.Typically implemented by setting an HTTP status code.
- Specified by:
setFaultCodein interfaceFaultAwareWebServiceConnection- Parameters:
faultCode- the fault code to be set on the connection, ornullfor no fault.- Throws:
IOException- in case of I/O errors
-