public class HttpServletConnection extends AbstractReceiverConnection implements EndpointAwareWebServiceConnection, FaultAwareWebServiceConnection
WebServiceConnection
that is based on the Servlet API.Modifier | Constructor and Description |
---|---|
protected |
HttpServletConnection(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
Constructs a new servlet connection with the given
HttpServletRequest and
HttpServletResponse . |
Modifier and Type | Method and Description |
---|---|
void |
addResponseHeader(String name,
String value)
Adds a response header with the given name and value.
|
void |
endpointNotFound()
Called when an endpoint is not found.
|
String |
getErrorMessage()
Returns the error message.
|
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Returns the
HttpServletRequest for this connection. |
javax.servlet.http.HttpServletResponse |
getHttpServletResponse()
Returns the
HttpServletResponse for this connection. |
Iterator<String> |
getRequestHeaderNames()
Returns an iteration over all the header names this request contains.
|
Iterator<String> |
getRequestHeaders(String name)
Returns an iteration over all the string values of the specified header.
|
protected InputStream |
getRequestInputStream()
Returns the input stream to read the response from.
|
protected OutputStream |
getResponseOutputStream()
Returns the output stream to write the request to.
|
URI |
getUri()
Returns the URI for this connection.
|
boolean |
hasError()
Indicates whether this connection has an error.
|
boolean |
hasFault()
Indicates whether this connection received a fault.
|
void |
onClose()
Template method invoked from
AbstractWebServiceConnection.close() . |
protected void |
onSendAfterWrite(WebServiceMessage message)
Called after the given message has been written to the
TransportOutputStream . |
void |
setFault(boolean fault)
Deprecated.
|
void |
setFaultCode(QName faultCode)
Sets a specific fault code.
|
createTransportInputStream, createTransportOutputStream
close, onReceiveAfterRead, onReceiveBeforeRead, onSendBeforeWrite, receive, send
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, receive, send
protected HttpServletConnection(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
HttpServletRequest
and
HttpServletResponse
.public javax.servlet.http.HttpServletRequest getHttpServletRequest()
HttpServletRequest
for this connection.public javax.servlet.http.HttpServletResponse getHttpServletResponse()
HttpServletResponse
for this connection.public void endpointNotFound()
EndpointAwareWebServiceConnection
endpointNotFound
in interface EndpointAwareWebServiceConnection
public boolean hasError() throws IOException
WebServiceConnection
hasError
in interface WebServiceConnection
true
if this connection has an error; false
otherwise.IOException
public String getErrorMessage() throws IOException
WebServiceConnection
getErrorMessage
in interface WebServiceConnection
null
when no error is presentIOException
WebServiceConnection.hasError()
public URI getUri() throws URISyntaxException
WebServiceConnection
getUri
in interface WebServiceConnection
URISyntaxException
public Iterator<String> getRequestHeaderNames() throws IOException
HeadersAwareReceiverWebServiceConnection
Iterator
if
there are no headers.getRequestHeaderNames
in interface HeadersAwareReceiverWebServiceConnection
IOException
public Iterator<String> getRequestHeaders(String name) throws IOException
HeadersAwareReceiverWebServiceConnection
Iterator
if there are no headers of the specified name.getRequestHeaders
in interface HeadersAwareReceiverWebServiceConnection
IOException
protected InputStream getRequestInputStream() throws IOException
AbstractReceiverConnection
getRequestInputStream
in class AbstractReceiverConnection
IOException
public void addResponseHeader(String name, String value) throws IOException
HeadersAwareReceiverWebServiceConnection
addResponseHeader
in interface HeadersAwareReceiverWebServiceConnection
name
- the name of the headervalue
- the value of the headerIOException
protected OutputStream getResponseOutputStream() throws IOException
AbstractReceiverConnection
getResponseOutputStream
in class AbstractReceiverConnection
IOException
protected void onSendAfterWrite(WebServiceMessage message) throws IOException
AbstractWebServiceConnection
TransportOutputStream
. Called from AbstractWebServiceConnection.send(WebServiceMessage)
.
Default implementation does nothing.
onSendAfterWrite
in class AbstractWebServiceConnection
message
- the messageIOException
- when an I/O exception occurspublic void onClose() throws IOException
AbstractReceiverConnection
AbstractWebServiceConnection.close()
. Default implementation is empty.onClose
in class AbstractReceiverConnection
IOException
- if an I/O error occurs when closing this connectionpublic boolean hasFault() throws IOException
FaultAwareWebServiceConnection
Typically implemented by looking at an HTTP status code.
hasFault
in interface FaultAwareWebServiceConnection
true
if this connection received a fault; false
otherwise.IOException
- in case of I/O errors@Deprecated public void setFault(boolean fault) throws IOException
FaultAwareWebServiceConnection
Typically implemented by setting an HTTP status code.
setFault
in interface FaultAwareWebServiceConnection
fault
- true
if this will send a fault; false
otherwise.IOException
- in case of I/O errorspublic void setFaultCode(QName faultCode) throws IOException
FaultAwareWebServiceConnection
Typically implemented by setting an HTTP status code.
setFaultCode
in interface FaultAwareWebServiceConnection
faultCode
- the fault code to be set on the connection, or null
for no fault.IOException
- in case of I/O errorsCopyright © 2020 Pivotal Software. All rights reserved.