- All Implemented Interfaces:
PropertySet
- Direct Known Subclasses:
ServletConnectionImpl
Different HTTP server layer uses different implementations of this class so that JAX-WS can be shielded from individuality of such layers. This is an interface implemented as an abstract class, so that future versions of the JAX-WS RI can add new methods.
This class extends PropertySet
so that a transport can
expose its properties to the application and pipes. (This object
will be added to BaseDistributedPropertySet.addSatellite(PropertySet)
.)
- Author:
- Jitendra Kotamraju
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.webservices.api.message.BasePropertySet
BasePropertySet.Accessor, BasePropertySet.PropertyMap, BasePropertySet.PropertyMapEntry
Nested classes/interfaces inherited from interface com.oracle.webservices.api.message.PropertySet
PropertySet.Property
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the connectionGets the absolute URL up to the context path.Environment specific context , if availablePortion of the request URI that groups related service addresses.Subclasses are expected to overrideabstract InputStream
getInput()
Transport's underlying input stream.abstract OutputStream
Transport's underlying output streamabstract String
Extra portion of the request URI after the end of the expected address of the service but before the query stringSubclasses are expected to overrideabstract String
HTTP Query string, such as "foo=bar", or null if none exists.Gets request metadata attributeabstract String
getRequestHeader
(String headerName) Gets an HTTP request header.Deprecated.This is a potentially expensive operation.Deprecated.This is a potentially expensive operation.getRequestHeaderValues
(String headerName) Gets an HTTP request header.abstract String
HTTP request method, such as "GET" or "POST".abstract String
Requested scheme, e.g.abstract String
Requested path.abstract String
Server nameabstract int
Server portabstract int
Gets the last value set bysetStatus(int)
.User principal associated with the requestabstract WebServiceContextDelegate
Returns theWebServiceContextDelegate
for this connection.boolean
isClosed()
Retuns whether connection is closed or not.abstract boolean
isSecure()
Whether connection is HTTPS or notboolean
isUserInRole
(String role) Whether user associated with the request holds the given rolevoid
setContentLengthResponseHeader
(int value) Subclasses are expected to overrideabstract void
Sets the"Content-Type"
header.void
Subclasses are expected to overridevoid
setResponseHeader
(String key, String value) abstract void
setResponseHeader
(String key, List<String> value) abstract void
setResponseHeaders
(Map<String, List<String>> headers) Overwrites all the HTTP response headers written thus far.abstract void
setStatus
(int status) Sets the HTTP response code likeOK
.Methods inherited from class com.oracle.webservices.api.message.BasePropertySet
asMap, containsKey, createEntrySet, createView, get, getPropertyMap, mapAllowsAdditionalProperties, parse, parse, put, remove, supports
-
Field Details
-
OK
public static final int OK- See Also:
-
ONEWAY
public static final int ONEWAY- See Also:
-
UNSUPPORTED_MEDIA
public static final int UNSUPPORTED_MEDIA- See Also:
-
MALFORMED_XML
public static final int MALFORMED_XML- See Also:
-
INTERNAL_ERR
public static final int INTERNAL_ERR- See Also:
-
-
Constructor Details
-
WSHTTPConnection
protected WSHTTPConnection()Default constructor.
-
-
Method Details
-
setResponseHeaders
Overwrites all the HTTP response headers written thus far.The implementation should copy the contents of the
Map
, rather than retaining a reference. TheMap
passed as a parameter may change after this method is invoked.This method may be called repeatedly, although in normal use case that's rare (so the implementation is encourage to take advantage of this usage pattern to improve performance, if possible.)
Initially, no header is set.
This parameter is usually exposed to
WebServiceContext
asPacket.OUTBOUND_TRANSPORT_HEADERS
, and thus it should ignoreContent-Type
andContent-Length
headers.- Parameters:
headers
- SeeURLConnection.getHeaderFields()
for the format. This parameter may not be null, but since the user application code may invoke this method, a graceful error checking with an helpful error message should be provided if it's actually null.- See Also:
-
setResponseHeader
-
setResponseHeader
-
setContentTypeResponseHeader
Sets the"Content-Type"
header.If the Content-Type header has already been set, this method will overwrite the previously set value. If not, this method adds it.
Note that this method and
setResponseHeaders(java.util.Map)
may be invoked in any arbitrary order.- Parameters:
value
- strings like"application/xml; charset=UTF-8"
or"image/jpeg"
.
-
setStatus
public abstract void setStatus(int status) Sets the HTTP response code likeOK
.While JAX-WS processes a
WSHTTPConnection
, it will at least call this method once to set a valid HTTP response code. Note that this method may be invoked multiple times (from user code), so do not consider the value to be final untilgetOutput()
is invoked. -
getStatus
public abstract int getStatus()Gets the last value set bysetStatus(int)
.- Returns:
- if
setStatus(int)
has not been invoked yet, return 0.
-
getInput
Transport's underlying input stream.This method will be invoked at most once by the JAX-WS RI to read the request body. If there's no request body, this method should return an empty
InputStream
.- Returns:
- the stream from which the request body will be read.
- Throws:
IOException
-
getOutput
Transport's underlying output streamThis method will be invoked exactly once by the JAX-WS RI to start writing the response body (unless the processing aborts abnormally.) Even if there's no response body to write, this method will still be invoked only to be closed immediately.
Once this method is called, the status code and response headers will never change (IOW
setStatus(int)
,setResponseHeaders(java.util.Map<java.lang.String, java.util.List<java.lang.String>>)
, andsetContentTypeResponseHeader(String)
will never be invoked.- Throws:
IOException
-
getWebServiceContextDelegate
Returns theWebServiceContextDelegate
for this connection. -
getRequestMethod
HTTP request method, such as "GET" or "POST". -
getRequestHeaders
Deprecated.This is a potentially expensive operation. Programs that want to access HTTP headers should consider using other methods such asgetRequestHeader(String)
.HTTP request headers.- Returns:
- can be empty but never null.
-
getRequestHeaderNames
Deprecated.This is a potentially expensive operation. Programs that want to access HTTP headers should consider using other methods such asgetRequestHeader(String)
.HTTP request header names.- Returns:
- can be empty but never null.
-
getResponseHeaders
- Returns:
- HTTP response headers.
-
getRequestHeader
Gets an HTTP request header.if multiple headers are present, this method returns one of them. (The implementation is free to choose which one it returns.)
- Returns:
- null if no header exists.
-
getRequestHeaderValues
Gets an HTTP request header.- Returns:
- null if no header exists.
-
getQueryString
HTTP Query string, such as "foo=bar", or null if none exists. -
getPathInfo
Extra portion of the request URI after the end of the expected address of the service but before the query string -
getRequestURI
Requested path. A string like "/foo/bar/baz" -
getRequestScheme
Requested scheme, e.g. "http" or "https" -
getServerName
Server name -
getServerPort
public abstract int getServerPort()Server port -
getContextPath
Portion of the request URI that groups related service addresses. The value, if non-empty, will always begin with '/', but will never end with '/'. Environments that do not support context paths must return an empty string. -
getContext
Environment specific context , if available -
getBaseAddress
Gets the absolute URL up to the context path.- Returns:
- String like "http://myhost/myapp"
- Since:
- 2.1.2
-
isSecure
public abstract boolean isSecure()Whether connection is HTTPS or not- Returns:
- if the received request is on HTTPS, return true else false
-
getUserPrincipal
User principal associated with the request- Returns:
- user principal
-
isUserInRole
Whether user associated with the request holds the given role- Parameters:
role
- Role to check- Returns:
- if the caller holds the role
-
getRequestAttribute
Gets request metadata attribute- Parameters:
key
- Request metadata key- Returns:
- Value of metadata attribute or null, if no value present
-
close
public void close()Close the connection -
isClosed
public boolean isClosed()Retuns whether connection is closed or not. -
getProtocol
Subclasses are expected to override- Returns:
- a
String
containing the protocol name and version number
-
getCookie
Subclasses are expected to override- Returns:
- value of given cookie
- Since:
- JAX-WS RI 2.2.2
-
setCookie
Subclasses are expected to override- Since:
- JAX-WS RI 2.2.2
-
setContentLengthResponseHeader
public void setContentLengthResponseHeader(int value) Subclasses are expected to override
-