com.sun.xml.ws.transport.http.servlet
Class ServletConnectionImpl

java.lang.Object
  extended by com.oracle.webservices.api.message.BasePropertySet
      extended by com.sun.xml.ws.transport.http.WSHTTPConnection
          extended by com.sun.xml.ws.transport.http.servlet.ServletConnectionImpl
All Implemented Interfaces:
com.oracle.webservices.api.message.PropertySet, WebServiceContextDelegate

public class ServletConnectionImpl
extends WSHTTPConnection
implements WebServiceContextDelegate

WSHTTPConnection implemented for HttpServlet.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.oracle.webservices.api.message.BasePropertySet
com.oracle.webservices.api.message.BasePropertySet.Accessor, com.oracle.webservices.api.message.BasePropertySet.PropertyMap, com.oracle.webservices.api.message.BasePropertySet.PropertyMapEntry
 
Nested classes/interfaces inherited from interface com.oracle.webservices.api.message.PropertySet
com.oracle.webservices.api.message.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
ServletConnectionImpl(ServletAdapter adapter, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 java.lang.String getBaseAddress()
          Gets the absolute URL up to the context path.
 javax.servlet.ServletContext getContext()
          Environment specific context , if available
 java.lang.String getContextPath()
          Portion of the request URI that groups related service addresses.
 java.lang.String getCookie(java.lang.String name)
          Subclasses are expected to override
 java.lang.String getEPRAddress(Packet p, WSEndpoint endpoint)
          Gets the address of the endpoint.
 HaInfo getHaInfo()
           
 java.io.InputStream getInput()
          Transport's underlying input stream.
 java.io.OutputStream getOutput()
          Transport's underlying output stream
 java.lang.String getPathInfo()
          Extra portion of the request URI after the end of the expected address of the service but before the query string
protected  com.oracle.webservices.api.message.BasePropertySet.PropertyMap getPropertyMap()
          Map representing the Fields and Methods annotated with PropertySet.Property.
 java.lang.String getProtocol()
          Subclasses are expected to override
 java.lang.String getQueryString()
          HTTP Query string, such as "foo=bar", or null if none exists.
 javax.servlet.http.HttpServletRequest getRequest()
           
 java.lang.Object getRequestAttribute(java.lang.String key)
          Gets request metadata attribute
 java.lang.String getRequestHeader(java.lang.String headerName)
          Gets an HTTP request header.
 java.util.Set<java.lang.String> getRequestHeaderNames()
          HTTP request header names.
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestHeaders()
          HTTP request headers.
 java.util.List<java.lang.String> getRequestHeaderValues(java.lang.String headerName)
          Gets an HTTP request header.
 java.lang.String getRequestMethod()
          HTTP request method, such as "GET" or "POST".
 java.lang.String getRequestScheme()
          Requested scheme, e.g.
 java.lang.String getRequestURI()
          Requested path.
 java.lang.String getRequestURL()
           
 javax.servlet.http.HttpServletResponse getResponse()
           
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaders()
           
 java.lang.String getServerName()
          Server name
 int getServerPort()
          Server port
 int getStatus()
          Gets the last value set by WSHTTPConnection.setStatus(int).
 java.security.Principal getUserPrincipal()
          User principal associated with the request
 java.security.Principal getUserPrincipal(Packet p)
          Implements WebServiceContext.getUserPrincipal() for the given packet.
 WebServiceContextDelegate getWebServiceContextDelegate()
          Returns the WebServiceContextDelegate for this connection.
 java.lang.String getWSDLAddress(Packet request, WSEndpoint endpoint)
          Gets the address of the primary WSDL.
 boolean isSecure()
          Whether connection is HTTPS or not
 boolean isUserInRole(Packet p, java.lang.String role)
          Implements WebServiceContext.isUserInRole(String) for the given packet.
 boolean isUserInRole(java.lang.String role)
          Whether user associated with the request holds the given role
 void setContentLengthResponseHeader(int value)
          Subclasses are expected to override
 void setContentTypeResponseHeader(java.lang.String value)
          Sets the "Content-Type" header.
 void setCookie(java.lang.String name, java.lang.String value)
          Subclasses are expected to override
 void setHaInfo(HaInfo replicaInfo)
           
 void setResponseHeader(java.lang.String key, java.util.List<java.lang.String> value)
           
 void setResponseHeader(java.lang.String key, java.lang.String value)
           
 void setResponseHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
          sets response headers.
 void setStatus(int status)
          Sets the HTTP response code like WSHTTPConnection.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, createMapView, createView, get, mapAllowsAdditionalProperties, parse, put, remove, supports
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletConnectionImpl

public ServletConnectionImpl(@NotNull
                             ServletAdapter adapter,
                             javax.servlet.ServletContext context,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
Method Detail

getRequestHeaders

@NotNull
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestHeaders()
Description copied from class: WSHTTPConnection
HTTP request headers.

Specified by:
getRequestHeaders in class WSHTTPConnection
Returns:
can be empty but never null.

getRequestHeaderNames

public java.util.Set<java.lang.String> getRequestHeaderNames()
Description copied from class: WSHTTPConnection
HTTP request header names.

Specified by:
getRequestHeaderNames in class WSHTTPConnection
Returns:
can be empty but never null.

getRequestHeaderValues

public java.util.List<java.lang.String> getRequestHeaderValues(@NotNull
                                                               java.lang.String headerName)
Description copied from class: WSHTTPConnection
Gets an HTTP request header.

Specified by:
getRequestHeaderValues in class WSHTTPConnection
Returns:
null if no header exists.

setResponseHeaders

public void setResponseHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
sets response headers.

Specified by:
setResponseHeaders in class WSHTTPConnection
Parameters:
headers - See URLConnection.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:
WSHTTPConnection.setContentTypeResponseHeader(String)

setResponseHeader

public void setResponseHeader(java.lang.String key,
                              java.lang.String value)
Overrides:
setResponseHeader in class WSHTTPConnection

setResponseHeader

public void setResponseHeader(java.lang.String key,
                              java.util.List<java.lang.String> value)
Specified by:
setResponseHeader in class WSHTTPConnection

getResponseHeaders

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaders()
Specified by:
getResponseHeaders in class WSHTTPConnection
Returns:
HTTP response headers.

setStatus

public void setStatus(int status)
Description copied from class: WSHTTPConnection
Sets the HTTP response code like WSHTTPConnection.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 until WSHTTPConnection.getOutput() is invoked.

Specified by:
setStatus in class WSHTTPConnection

getStatus

public int getStatus()
Description copied from class: WSHTTPConnection
Gets the last value set by WSHTTPConnection.setStatus(int).

Specified by:
getStatus in class WSHTTPConnection
Returns:
if WSHTTPConnection.setStatus(int) has not been invoked yet, return 0.

setContentTypeResponseHeader

public void setContentTypeResponseHeader(@NotNull
                                         java.lang.String value)
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 class WSHTTPConnection
Parameters:
value - strings like "application/xml; charset=UTF-8" or "image/jpeg".

getInput

@NotNull
public java.io.InputStream getInput()
                             throws java.io.IOException
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 class WSHTTPConnection
Returns:
the stream from which the request body will be read.
Throws:
java.io.IOException

getOutput

@NotNull
public java.io.OutputStream getOutput()
                               throws java.io.IOException
Description copied from class: WSHTTPConnection
Transport's underlying output stream

This 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>), and WSHTTPConnection.setContentTypeResponseHeader(String) will never be invoked.

Specified by:
getOutput in class WSHTTPConnection
Throws:
java.io.IOException

getWebServiceContextDelegate

@NotNull
public WebServiceContextDelegate getWebServiceContextDelegate()
Description copied from class: WSHTTPConnection
Returns the WebServiceContextDelegate for this connection.

Specified by:
getWebServiceContextDelegate in class WSHTTPConnection

getUserPrincipal

public java.security.Principal getUserPrincipal(Packet p)
Description copied from interface: WebServiceContextDelegate
Implements WebServiceContext.getUserPrincipal() for the given packet.

Specified by:
getUserPrincipal in interface WebServiceContextDelegate
Parameters:
p - Always non-null. See class javadoc.
See Also:
WebServiceContext.getUserPrincipal()

isUserInRole

public boolean isUserInRole(Packet p,
                            java.lang.String role)
Description copied from interface: WebServiceContextDelegate
Implements WebServiceContext.isUserInRole(String) for the given packet.

Specified by:
isUserInRole in interface WebServiceContextDelegate
Parameters:
p - Always non-null. See class javadoc.
See Also:
WebServiceContext.isUserInRole(String)

getEPRAddress

@NotNull
public java.lang.String getEPRAddress(Packet p,
                                              WSEndpoint endpoint)
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 interface WebServiceContextDelegate
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

public java.lang.String getWSDLAddress(@NotNull
                                       Packet request,
                                       @NotNull
                                       WSEndpoint endpoint)
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 (IOW returning null.

Specified by:
getWSDLAddress in interface WebServiceContextDelegate
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

@NotNull
public java.lang.String getRequestMethod()
Description copied from class: WSHTTPConnection
HTTP request method, such as "GET" or "POST".

Specified by:
getRequestMethod in class WSHTTPConnection

isSecure

public boolean isSecure()
Description copied from class: WSHTTPConnection
Whether connection is HTTPS or not

Specified by:
isSecure in class WSHTTPConnection
Returns:
if the received request is on HTTPS, return true else false

getUserPrincipal

public java.security.Principal getUserPrincipal()
Description copied from class: WSHTTPConnection
User principal associated with the request

Overrides:
getUserPrincipal in class WSHTTPConnection
Returns:
user principal

isUserInRole

public boolean isUserInRole(java.lang.String role)
Description copied from class: WSHTTPConnection
Whether user associated with the request holds the given role

Overrides:
isUserInRole in class WSHTTPConnection
Parameters:
role - Role to check
Returns:
if the caller holds the role

getRequestHeader

public java.lang.String getRequestHeader(java.lang.String headerName)
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 class WSHTTPConnection
Returns:
null if no header exists.

getQueryString

public java.lang.String getQueryString()
Description copied from class: WSHTTPConnection
HTTP Query string, such as "foo=bar", or null if none exists.

Specified by:
getQueryString in class WSHTTPConnection

getPathInfo

@NotNull
public java.lang.String 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 class WSHTTPConnection

getRequestURI

@NotNull
public java.lang.String getRequestURI()
Description copied from class: WSHTTPConnection
Requested path. A string like "/foo/bar/baz"

Specified by:
getRequestURI in class WSHTTPConnection

getRequestScheme

@NotNull
public java.lang.String getRequestScheme()
Description copied from class: WSHTTPConnection
Requested scheme, e.g. "http" or "https"

Specified by:
getRequestScheme in class WSHTTPConnection

getServerName

@NotNull
public java.lang.String getServerName()
Description copied from class: WSHTTPConnection
Server name

Specified by:
getServerName in class WSHTTPConnection

getServerPort

@NotNull
public int getServerPort()
Description copied from class: WSHTTPConnection
Server port

Specified by:
getServerPort in class WSHTTPConnection

getContextPath

@NotNull
public java.lang.String 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 class WSHTTPConnection

getBaseAddress

@NotNull
public java.lang.String getBaseAddress()
Description copied from class: WSHTTPConnection
Gets the absolute URL up to the context path.

Overrides:
getBaseAddress in class WSHTTPConnection
Returns:
String like "http://myhost/myapp"

getRequestAttribute

public java.lang.Object getRequestAttribute(java.lang.String key)
Description copied from class: WSHTTPConnection
Gets request metadata attribute

Overrides:
getRequestAttribute in class WSHTTPConnection
Parameters:
key - Request metadata key
Returns:
Value of metadata attribute or null, if no value present

getContext

public javax.servlet.ServletContext getContext()
Description copied from class: WSHTTPConnection
Environment specific context , if available

Overrides:
getContext in class WSHTTPConnection

getResponse

public javax.servlet.http.HttpServletResponse getResponse()

getRequest

public javax.servlet.http.HttpServletRequest getRequest()

getRequestURL

public java.lang.String getRequestURL()

getProtocol

public java.lang.String getProtocol()
Description copied from class: WSHTTPConnection
Subclasses are expected to override

Overrides:
getProtocol in class WSHTTPConnection
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 class WSHTTPConnection

getCookie

public java.lang.String getCookie(java.lang.String name)
Description copied from class: WSHTTPConnection
Subclasses are expected to override

Overrides:
getCookie in class WSHTTPConnection
Returns:
value of given cookie

setCookie

public void setCookie(java.lang.String name,
                      java.lang.String value)
Description copied from class: WSHTTPConnection
Subclasses are expected to override

Overrides:
setCookie in class WSHTTPConnection

getHaInfo

public HaInfo getHaInfo()

setHaInfo

public void setHaInfo(HaInfo replicaInfo)

getPropertyMap

protected com.oracle.webservices.api.message.BasePropertySet.PropertyMap getPropertyMap()
Description copied from class: com.oracle.webservices.api.message.BasePropertySet
Map representing the Fields and Methods annotated with PropertySet.Property. Model of PropertySet 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;
 }
 

Specified by:
getPropertyMap in class com.oracle.webservices.api.message.BasePropertySet


Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.