com.sun.xml.ws.api.server
Interface WebServiceContextDelegate

All Known Implementing Classes:
ServletConnectionImpl

public interface WebServiceContextDelegate

This object is set to Packet.webServiceContextDelegate to serve WebServiceContext methods for a Packet.

When the user application calls a method on WebServiceContext, the JAX-WS RI goes to the Packet that represents the request, then check Packet.webServiceContextDelegate, and forwards the method calls to WebServiceContextDelegate.

All the methods defined on this interface takes Packet (whose Packet.webServiceContextDelegate points to this object), so that a single stateless WebServiceContextDelegate can be used to serve multiple concurrent Packets, if the implementation wishes to do so.

(It is also allowed to create one instance of WebServiceContextDelegate for each packet, and thus effectively ignore the packet parameter.)

Attaching this on a Packet allows Pipes to intercept and replace them, if they wish.


Method Summary
 java.lang.String getEPRAddress(Packet request, WSEndpoint endpoint)
          Gets the address of the endpoint.
 java.security.Principal getUserPrincipal(Packet request)
          Implements WebServiceContext.getUserPrincipal() for the given packet.
 java.lang.String getWSDLAddress(Packet request, WSEndpoint endpoint)
          Gets the address of the primary WSDL.
 boolean isUserInRole(Packet request, java.lang.String role)
          Implements WebServiceContext.isUserInRole(String) for the given packet.
 

Method Detail

getUserPrincipal

java.security.Principal getUserPrincipal(@NotNull
                                         Packet request)
Implements WebServiceContext.getUserPrincipal() for the given packet.

Parameters:
request - Always non-null. See class javadoc.
See Also:
WebServiceContext.getUserPrincipal()

isUserInRole

boolean isUserInRole(@NotNull
                     Packet request,
                     java.lang.String role)
Implements WebServiceContext.isUserInRole(String) for the given packet.

Parameters:
request - Always non-null. See class javadoc.
See Also:
WebServiceContext.isUserInRole(String)

getEPRAddress

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

Parameters:
request - 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.
Throws:
javax.xml.ws.WebServiceException - if this method could not compute the address for some reason.
See Also:
WebServiceContext.getEndpointReference(org.w3c.dom.Element...)

getWSDLAddress

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

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.


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