Top Description Methods
javax.xml.ws

public Interface WebServiceContext

Imports
java.security.Principal, javax.xml.ws.handler.MessageContext, javax.xml.ws.wsaddressing.W3CEndpointReference, org.w3c.dom.Element

A WebServiceContext makes it possible for a web service endpoint implementation class to access message context and security information relative to a request being served. Typically a WebServiceContext is injected into an endpoint implementation class using the Resource annotation.
Since
1.6, JAX-WS 2.0
See Also
javax.annotation.Resource

Method Summary

Modifier and TypeMethod and Description
public EndpointReference

Returns:

EndpointReference of the endpoint associated with this WebServiceContext. If the returned EndpointReference is of type W3CEndpointReference then it MUST contain the the specified referenceParameters.
getEndpointReference
(Element...
Reference parameters to be associated with the returned EndpointReference instance.
referenceParameters
)

Returns the EndpointReference for this endpoint.

public <
The type of EndpointReference.
T extends EndpointReference
>
T

Returns:

EndpointReference of type clazz of the endpoint associated with this WebServiceContext instance. If the returned EndpointReference is of type W3CEndpointReference then it MUST contain the the specified referenceParameters.
getEndpointReference
(Class<T>
The type of EndpointReference that MUST be returned.
clazz
,
Element...
Reference parameters to be associated with the returned EndpointReference instance.
referenceParameters
)

Returns the EndpointReference associated with this endpoint.

public MessageContext

Returns:

MessageContext The message context.
getMessageContext
()

Returns the MessageContext for the request being served at the time this method is called.

public Principal

Returns:

Principal The principal object.
getUserPrincipal
()

Returns the Principal that identifies the sender of the request currently being serviced.

public boolean

Returns:

a boolean indicating whether the sender of the request belongs to a given role
isUserInRole
(String
A String specifying the name of the role
role
)

Returns a boolean indicating whether the authenticated user is included in the specified logical role.

Method Detail

getEndpointReferenceback to summary
public EndpointReference getEndpointReference(Element... referenceParameters)

Returns the EndpointReference for this endpoint.

If the Binding for this bindingProvider is either SOAP1.1/HTTP or SOAP1.2/HTTP, then a W3CEndpointReference MUST be returned.

Parameters
referenceParameters:Element[]

Reference parameters to be associated with the returned EndpointReference instance.

Returns:EndpointReference

EndpointReference of the endpoint associated with this WebServiceContext. If the returned EndpointReference is of type W3CEndpointReference then it MUST contain the the specified referenceParameters.

Exceptions
IllegalStateException:
This exception is thrown if the method is called while no request is being serviced.
Since
1.6, JAX-WS 2.1
See Also
W3CEndpointReference
getEndpointReferenceback to summary
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters)

Returns the EndpointReference associated with this endpoint.

Parameters
<T>
The type of EndpointReference.
clazz:Class<T>

The type of EndpointReference that MUST be returned.

referenceParameters:Element[]

Reference parameters to be associated with the returned EndpointReference instance.

Returns:T

EndpointReference of type clazz of the endpoint associated with this WebServiceContext instance. If the returned EndpointReference is of type W3CEndpointReference then it MUST contain the the specified referenceParameters.

Exceptions
IllegalStateException:
This exception is thrown if the method is called while no request is being serviced.
WebServiceException:
If the clazz type of EndpointReference is not supported.
Since
1.6, JAX-WS 2.1
getMessageContextback to summary
public MessageContext getMessageContext()

Returns the MessageContext for the request being served at the time this method is called. Only properties with APPLICATION scope will be visible to the application.

Returns:MessageContext

MessageContext The message context.

Exceptions
IllegalStateException:
This exception is thrown if the method is called while no request is being serviced.
See Also
javax.xml.ws.handler.MessageContext, javax.xml.ws.handler.MessageContext.Scope, java.lang.IllegalStateException
getUserPrincipalback to summary
public Principal getUserPrincipal()

Returns the Principal that identifies the sender of the request currently being serviced. If the sender has not been authenticated, the method returns null.

Returns:Principal

Principal The principal object.

Exceptions
IllegalStateException:
This exception is thrown if the method is called while no request is being serviced.
See Also
java.security.Principal, java.lang.IllegalStateException
isUserInRoleback to summary
public boolean isUserInRole(String role)

Returns a boolean indicating whether the authenticated user is included in the specified logical role. If the user has not been authenticated, the method returns false.

Parameters
role:String

A String specifying the name of the role

Returns:boolean

a boolean indicating whether the sender of the request belongs to a given role

Exceptions
IllegalStateException:
This exception is thrown if the method is called while no request is being serviced.