- All Implemented Interfaces:
PropertySet
,WebServiceContextDelegate
WSHTTPConnection
implemented for HttpServlet
.- Author:
- WS Development Team
-
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
Fields inherited from class com.sun.xml.ws.transport.http.WSHTTPConnection
INTERNAL_ERR, MALFORMED_XML, OK, ONEWAY, UNSUPPORTED_MEDIA
-
Constructor Summary
ConstructorDescriptionServletConnectionImpl
(ServletAdapter adapter, jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) -
Method Summary
Modifier and TypeMethodDescriptionGets the absolute URL up to the context path.jakarta.servlet.ServletContext
Environment specific context , if availablePortion of the request URI that groups related service addresses.Subclasses are expected to overridegetEPRAddress
(Packet p, WSEndpoint endpoint) Gets the address of the endpoint.getInput()
Transport's underlying input stream.Transport's underlying output streamExtra portion of the request URI after the end of the expected address of the service but before the query stringprotected BasePropertySet.PropertyMap
Map representing the Fields and Methods annotated withPropertySet.Property
.Subclasses are expected to overrideHTTP Query string, such as "foo=bar", or null if none exists.jakarta.servlet.http.HttpServletRequest
Gets request metadata attributegetRequestHeader
(String headerName) Gets an HTTP request header.HTTP request header names.HTTP request headers.getRequestHeaderValues
(String headerName) Gets an HTTP request header.HTTP request method, such as "GET" or "POST".Requested scheme, e.g.Requested path.jakarta.servlet.http.HttpServletResponse
Server nameint
Server portint
Gets the last value set byWSHTTPConnection.setStatus(int)
.User principal associated with the requestImplementsWebServiceContext.getUserPrincipal()
for the given packet.Returns theWebServiceContextDelegate
for this connection.getWSDLAddress
(Packet request, WSEndpoint endpoint) Gets the address of the primary WSDL.boolean
isSecure()
Whether connection is HTTPS or notboolean
isUserInRole
(Packet p, String role) ImplementsWebServiceContext.isUserInRole(String)
for the given packet.boolean
isUserInRole
(String role) Whether user associated with the request holds the given rolevoid
setContentLengthResponseHeader
(int value) Subclasses are expected to overridevoid
Sets the"Content-Type"
header.void
Subclasses are expected to overridevoid
void
setResponseHeader
(String key, String value) void
setResponseHeader
(String key, List<String> value) void
setResponseHeaders
(Map<String, List<String>> headers) sets response headers.void
setStatus
(int status) Sets the HTTP response code likeWSHTTPConnection.OK
.Methods inherited from class com.sun.xml.ws.transport.http.WSHTTPConnection
close, isClosed
Methods inherited from class com.oracle.webservices.api.message.BasePropertySet
asMap, containsKey, createEntrySet, createView, get, mapAllowsAdditionalProperties, parse, parse, put, remove, supports
-
Constructor Details
-
ServletConnectionImpl
public ServletConnectionImpl(@NotNull ServletAdapter adapter, jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
-
-
Method Details
-
getRequestHeaders
Description copied from class:WSHTTPConnection
HTTP request headers.- Specified by:
getRequestHeaders
in classWSHTTPConnection
- Returns:
- can be empty but never null.
-
getRequestHeaderNames
Description copied from class:WSHTTPConnection
HTTP request header names.- Specified by:
getRequestHeaderNames
in classWSHTTPConnection
- Returns:
- can be empty but never null.
-
getRequestHeaderValues
Description copied from class:WSHTTPConnection
Gets an HTTP request header.- Specified by:
getRequestHeaderValues
in classWSHTTPConnection
- Returns:
- null if no header exists.
-
setResponseHeaders
sets response headers.- Specified by:
setResponseHeaders
in classWSHTTPConnection
- 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
- Overrides:
setResponseHeader
in classWSHTTPConnection
-
setResponseHeader
- Specified by:
setResponseHeader
in classWSHTTPConnection
-
getResponseHeaders
- Specified by:
getResponseHeaders
in classWSHTTPConnection
- Returns:
- HTTP response headers.
-
setStatus
public void setStatus(int status) Description copied from class:WSHTTPConnection
Sets the HTTP response code likeWSHTTPConnection.OK
.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 untilWSHTTPConnection.getOutput()
is invoked.- Specified by:
setStatus
in classWSHTTPConnection
-
getStatus
public int getStatus()Description copied from class:WSHTTPConnection
Gets the last value set byWSHTTPConnection.setStatus(int)
.- Specified by:
getStatus
in classWSHTTPConnection
- Returns:
- if
WSHTTPConnection.setStatus(int)
has not been invoked yet, return 0.
-
setContentTypeResponseHeader
Description copied from class:WSHTTPConnection
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
WSHTTPConnection.setResponseHeaders(java.util.Map)
may be invoked in any arbitrary order.- Specified by:
setContentTypeResponseHeader
in classWSHTTPConnection
- Parameters:
value
- strings like"application/xml; charset=UTF-8"
or"image/jpeg"
.
-
getInput
Description copied from class:WSHTTPConnection
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
.- Specified by:
getInput
in classWSHTTPConnection
- Returns:
- the stream from which the request body will be read.
- Throws:
IOException
-
getOutput
Description copied from class:WSHTTPConnection
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
WSHTTPConnection.setStatus(int)
,WSHTTPConnection.setResponseHeaders(java.util.Map<java.lang.String, java.util.List<java.lang.String>>)
, andWSHTTPConnection.setContentTypeResponseHeader(String)
will never be invoked.- Specified by:
getOutput
in classWSHTTPConnection
- Throws:
IOException
-
getWebServiceContextDelegate
Description copied from class:WSHTTPConnection
Returns theWebServiceContextDelegate
for this connection.- Specified by:
getWebServiceContextDelegate
in classWSHTTPConnection
-
getUserPrincipal
Description copied from interface:WebServiceContextDelegate
ImplementsWebServiceContext.getUserPrincipal()
for the given packet.- Specified by:
getUserPrincipal
in interfaceWebServiceContextDelegate
- Parameters:
p
- Always non-null. See class javadoc.- See Also:
-
WebServiceContext.getUserPrincipal()
-
isUserInRole
Description copied from interface:WebServiceContextDelegate
ImplementsWebServiceContext.isUserInRole(String)
for the given packet.- Specified by:
isUserInRole
in interfaceWebServiceContextDelegate
- Parameters:
p
- Always non-null. See class javadoc.- See Also:
-
WebServiceContext.isUserInRole(String)
-
getEPRAddress
Description copied from interface:WebServiceContextDelegate
Gets the address of the endpoint.The "address" of endpoints is always affected by a particular client being served, hence it's up to transport to provide this information.
- Specified by:
getEPRAddress
in interfaceWebServiceContextDelegate
- Parameters:
p
- Always non-null. See class javadoc.endpoint
- The endpoint whose address will be returned.- Returns:
- Absolute URL of the endpoint. This shold be an address that the client can use to talk back to this same service later.
- See Also:
-
WebServiceContext.getEndpointReference(org.w3c.dom.Element...)
-
getWSDLAddress
Description copied from interface:WebServiceContextDelegate
Gets the address of the primary WSDL.If a transport supports publishing of WSDL by itself (instead/in addition to MEX), then it should implement this method so that the rest of the JAX-WS RI can use that information. For example, HTTP transports often use the convention
getEPRAddress()+"?wsdl"
for publishing WSDL on HTTP.Some transports may not have such WSDL publishing mechanism on its own. Those transports may choose to return null, indicating that WSDL is not published. If such transports are always used in conjunction with other transports that support WSDL publishing (such as SOAP/TCP used with Servlet transport), then such transport may choose to find the corresponding servlet endpoint by
Module.getBoundEndpoints()
and try to obtain the address from there.This information is used to put a metadata reference inside an EPR, among other things. Clients that do not support MEX rely on this WSDL URL to retrieve metadata, it is desirable for transports to support this, but not mandatory.
This method will be never invoked if the
WSEndpoint
does not have a corresponding WSDL to begin with (IOWreturning null
.- Specified by:
getWSDLAddress
in interfaceWebServiceContextDelegate
- Parameters:
request
- Always non-null. See class javadoc.endpoint
- The endpoint whose address will be returned.- Returns:
- null if the implementation does not support the notion of WSDL publishing.
-
getRequestMethod
Description copied from class:WSHTTPConnection
HTTP request method, such as "GET" or "POST".- Specified by:
getRequestMethod
in classWSHTTPConnection
-
isSecure
public boolean isSecure()Description copied from class:WSHTTPConnection
Whether connection is HTTPS or not- Specified by:
isSecure
in classWSHTTPConnection
- Returns:
- if the received request is on HTTPS, return true else false
-
getUserPrincipal
Description copied from class:WSHTTPConnection
User principal associated with the request- Overrides:
getUserPrincipal
in classWSHTTPConnection
- Returns:
- user principal
-
isUserInRole
Description copied from class:WSHTTPConnection
Whether user associated with the request holds the given role- Overrides:
isUserInRole
in classWSHTTPConnection
- Parameters:
role
- Role to check- Returns:
- if the caller holds the role
-
getRequestHeader
Description copied from class:WSHTTPConnection
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.)
- Specified by:
getRequestHeader
in classWSHTTPConnection
- Returns:
- null if no header exists.
-
getQueryString
Description copied from class:WSHTTPConnection
HTTP Query string, such as "foo=bar", or null if none exists.- Specified by:
getQueryString
in classWSHTTPConnection
-
getPathInfo
Description copied from class:WSHTTPConnection
Extra portion of the request URI after the end of the expected address of the service but before the query string- Specified by:
getPathInfo
in classWSHTTPConnection
-
getRequestURI
Description copied from class:WSHTTPConnection
Requested path. A string like "/foo/bar/baz"- Specified by:
getRequestURI
in classWSHTTPConnection
-
getRequestScheme
Description copied from class:WSHTTPConnection
Requested scheme, e.g. "http" or "https"- Specified by:
getRequestScheme
in classWSHTTPConnection
-
getServerName
Description copied from class:WSHTTPConnection
Server name- Specified by:
getServerName
in classWSHTTPConnection
-
getServerPort
@NotNull public int getServerPort()Description copied from class:WSHTTPConnection
Server port- Specified by:
getServerPort
in classWSHTTPConnection
-
getContextPath
Description copied from class:WSHTTPConnection
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.- Overrides:
getContextPath
in classWSHTTPConnection
-
getBaseAddress
Description copied from class:WSHTTPConnection
Gets the absolute URL up to the context path.- Overrides:
getBaseAddress
in classWSHTTPConnection
- Returns:
- String like "http://myhost/myapp"
-
getRequestAttribute
Description copied from class:WSHTTPConnection
Gets request metadata attribute- Overrides:
getRequestAttribute
in classWSHTTPConnection
- Parameters:
key
- Request metadata key- Returns:
- Value of metadata attribute or null, if no value present
-
getContext
public jakarta.servlet.ServletContext getContext()Description copied from class:WSHTTPConnection
Environment specific context , if available- Overrides:
getContext
in classWSHTTPConnection
-
getResponse
public jakarta.servlet.http.HttpServletResponse getResponse() -
getRequest
public jakarta.servlet.http.HttpServletRequest getRequest() -
getRequestURL
-
getProtocol
Description copied from class:WSHTTPConnection
Subclasses are expected to override- Overrides:
getProtocol
in classWSHTTPConnection
- Returns:
- a
String
containing the protocol name and version number
-
setContentLengthResponseHeader
public void setContentLengthResponseHeader(int value) Description copied from class:WSHTTPConnection
Subclasses are expected to override- Overrides:
setContentLengthResponseHeader
in classWSHTTPConnection
-
getCookie
Description copied from class:WSHTTPConnection
Subclasses are expected to override- Overrides:
getCookie
in classWSHTTPConnection
- Returns:
- value of given cookie
-
setCookie
Description copied from class:WSHTTPConnection
Subclasses are expected to override- Overrides:
setCookie
in classWSHTTPConnection
-
getHaInfo
-
setHaInfo
-
getPropertyMap
Description copied from class:BasePropertySet
Map representing the Fields and Methods annotated withPropertySet.Property
. Model ofPropertySet
class.At the end of the derivation chain this method just needs to be implemented as:
private static final PropertyMap model; static { model = parse(MyDerivedClass.class); } protected PropertyMap getPropertyMap() { return model; }
or if the implementation is in different Java module.private static final PropertyMap model; static { model = parse(MyDerivedClass.class, MethodHandles.lookup()); } protected PropertyMap getPropertyMap() { return model; }
- Specified by:
getPropertyMap
in classBasePropertySet
- Returns:
- the map of strongly-typed known properties keyed by property names
-