Class ServletConnectionImpl
- 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.PropertyMapEntryNested 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
ConstructorsConstructorDescriptionServletConnectionImpl(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.ServletContextEnvironment 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.PropertyMapMap 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.HttpServletRequestGets 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.HttpServletResponseServer nameintServer portintGets the last value set byWSHTTPConnection.setStatus(int).User principal associated with the requestImplementsWebServiceContext.getUserPrincipal()for the given packet.Returns theWebServiceContextDelegatefor this connection.getWSDLAddress(Packet request, WSEndpoint endpoint) Gets the address of the primary WSDL.booleanisSecure()Whether connection is HTTPS or notbooleanisUserInRole(Packet p, String role) ImplementsWebServiceContext.isUserInRole(String)for the given packet.booleanisUserInRole(String role) Whether user associated with the request holds the given rolevoidsetContentLengthResponseHeader(int value) Subclasses are expected to overridevoidSets the"Content-Type"header.voidSubclasses are expected to overridevoidvoidsetResponseHeader(String key, String value) voidsetResponseHeader(String key, List<String> value) voidsetResponseHeaders(Map<String, List<String>> headers) sets response headers.voidsetStatus(int status) Sets the HTTP response code likeWSHTTPConnection.OK.Methods inherited from class com.sun.xml.ws.transport.http.WSHTTPConnection
close, isClosedMethods 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:WSHTTPConnectionHTTP request headers.- Specified by:
getRequestHeadersin classWSHTTPConnection- Returns:
- can be empty but never null.
-
getRequestHeaderNames
Description copied from class:WSHTTPConnectionHTTP request header names.- Specified by:
getRequestHeaderNamesin classWSHTTPConnection- Returns:
- can be empty but never null.
-
getRequestHeaderValues
Description copied from class:WSHTTPConnectionGets an HTTP request header.- Specified by:
getRequestHeaderValuesin classWSHTTPConnection- Returns:
- null if no header exists.
-
setResponseHeaders
sets response headers.- Specified by:
setResponseHeadersin 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:
setResponseHeaderin classWSHTTPConnection
-
setResponseHeader
- Specified by:
setResponseHeaderin classWSHTTPConnection
-
getResponseHeaders
- Specified by:
getResponseHeadersin classWSHTTPConnection- Returns:
- HTTP response headers.
-
setStatus
public void setStatus(int status) Description copied from class:WSHTTPConnectionSets 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:
setStatusin classWSHTTPConnection
-
getStatus
public int getStatus()Description copied from class:WSHTTPConnectionGets the last value set byWSHTTPConnection.setStatus(int).- Specified by:
getStatusin classWSHTTPConnection- Returns:
- if
WSHTTPConnection.setStatus(int)has not been invoked yet, return 0.
-
setContentTypeResponseHeader
Description copied from class:WSHTTPConnectionSets 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:
setContentTypeResponseHeaderin classWSHTTPConnection- Parameters:
value- strings like"application/xml; charset=UTF-8"or"image/jpeg".
-
getInput
Description copied from class:WSHTTPConnectionTransport'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:
getInputin classWSHTTPConnection- Returns:
- the stream from which the request body will be read.
- Throws:
IOException
-
getOutput
Description copied from class:WSHTTPConnectionTransport'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:
getOutputin classWSHTTPConnection- Throws:
IOException
-
getWebServiceContextDelegate
Description copied from class:WSHTTPConnectionReturns theWebServiceContextDelegatefor this connection.- Specified by:
getWebServiceContextDelegatein classWSHTTPConnection
-
getUserPrincipal
Description copied from interface:WebServiceContextDelegateImplementsWebServiceContext.getUserPrincipal()for the given packet.- Specified by:
getUserPrincipalin interfaceWebServiceContextDelegate- Parameters:
p- Always non-null. See class javadoc.- See Also:
-
isUserInRole
Description copied from interface:WebServiceContextDelegateImplementsWebServiceContext.isUserInRole(String)for the given packet.- Specified by:
isUserInRolein interfaceWebServiceContextDelegate- Parameters:
p- Always non-null. See class javadoc.- See Also:
-
getEPRAddress
Description copied from interface:WebServiceContextDelegateGets 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:
getEPRAddressin 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:
-
getWSDLAddress
Description copied from interface:WebServiceContextDelegateGets 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
WSEndpointdoes not have a corresponding WSDL to begin with (IOWreturning null.- Specified by:
getWSDLAddressin 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:WSHTTPConnectionHTTP request method, such as "GET" or "POST".- Specified by:
getRequestMethodin classWSHTTPConnection
-
isSecure
public boolean isSecure()Description copied from class:WSHTTPConnectionWhether connection is HTTPS or not- Specified by:
isSecurein classWSHTTPConnection- Returns:
- if the received request is on HTTPS, return true else false
-
getUserPrincipal
Description copied from class:WSHTTPConnectionUser principal associated with the request- Overrides:
getUserPrincipalin classWSHTTPConnection- Returns:
- user principal
-
isUserInRole
Description copied from class:WSHTTPConnectionWhether user associated with the request holds the given role- Overrides:
isUserInRolein classWSHTTPConnection- Parameters:
role- Role to check- Returns:
- if the caller holds the role
-
getRequestHeader
Description copied from class:WSHTTPConnectionGets 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:
getRequestHeaderin classWSHTTPConnection- Returns:
- null if no header exists.
-
getQueryString
Description copied from class:WSHTTPConnectionHTTP Query string, such as "foo=bar", or null if none exists.- Specified by:
getQueryStringin classWSHTTPConnection
-
getPathInfo
Description copied from class:WSHTTPConnectionExtra portion of the request URI after the end of the expected address of the service but before the query string- Specified by:
getPathInfoin classWSHTTPConnection
-
getRequestURI
Description copied from class:WSHTTPConnectionRequested path. A string like "/foo/bar/baz"- Specified by:
getRequestURIin classWSHTTPConnection
-
getRequestScheme
Description copied from class:WSHTTPConnectionRequested scheme, e.g. "http" or "https"- Specified by:
getRequestSchemein classWSHTTPConnection
-
getServerName
Description copied from class:WSHTTPConnectionServer name- Specified by:
getServerNamein classWSHTTPConnection
-
getServerPort
@NotNull public int getServerPort()Description copied from class:WSHTTPConnectionServer port- Specified by:
getServerPortin classWSHTTPConnection
-
getContextPath
Description copied from class:WSHTTPConnectionPortion 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:
getContextPathin classWSHTTPConnection
-
getBaseAddress
Description copied from class:WSHTTPConnectionGets the absolute URL up to the context path.- Overrides:
getBaseAddressin classWSHTTPConnection- Returns:
- String like "http://myhost/myapp"
-
getRequestAttribute
Description copied from class:WSHTTPConnectionGets request metadata attribute- Overrides:
getRequestAttributein 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:WSHTTPConnectionEnvironment specific context , if available- Overrides:
getContextin classWSHTTPConnection
-
getResponse
public jakarta.servlet.http.HttpServletResponse getResponse() -
getRequest
public jakarta.servlet.http.HttpServletRequest getRequest() -
getRequestURL
-
getProtocol
Description copied from class:WSHTTPConnectionSubclasses are expected to override- Overrides:
getProtocolin classWSHTTPConnection- Returns:
- a
Stringcontaining the protocol name and version number
-
setContentLengthResponseHeader
public void setContentLengthResponseHeader(int value) Description copied from class:WSHTTPConnectionSubclasses are expected to override- Overrides:
setContentLengthResponseHeaderin classWSHTTPConnection
-
getCookie
Description copied from class:WSHTTPConnectionSubclasses are expected to override- Overrides:
getCookiein classWSHTTPConnection- Returns:
- value of given cookie
-
setCookie
Description copied from class:WSHTTPConnectionSubclasses are expected to override- Overrides:
setCookiein classWSHTTPConnection
-
getHaInfo
-
setHaInfo
-
getPropertyMap
Description copied from class:BasePropertySetMap representing the Fields and Methods annotated withPropertySet.Property. Model ofPropertySetclass.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:
getPropertyMapin classBasePropertySet- Returns:
- the map of strongly-typed known properties keyed by property names
-