WebServiceContext (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.xml.ws Interface WebServiceContext


public interface WebServiceContext

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.

从以下版本开始:
JAX-WS 2.0
另请参见:
Resource

方法摘要
 MessageContext getMessageContext()
          Returns the MessageContext for the request being served at the time this method is called.
 Principal getUserPrincipal()
          Returns the Principal that identifies the sender of the request currently being serviced.
 boolean isUserInRole(String role)
          Returns a boolean indicating whether the authenticated user is included in the specified logical role.
 

方法详细信息

getMessageContext

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.

返回:
MessageContext The message context.
抛出异常:
IllegalStateException - This exception is thrown if the method is called while no request is being serviced.
另请参见:
MessageContext, MessageContext.Scope, IllegalStateException

getUserPrincipal

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.

返回:
Principal The principal object.
抛出异常:
IllegalStateException - This exception is thrown if the method is called while no request is being serviced.
另请参见:
Principal, IllegalStateException

isUserInRole

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.

参数:
role - A String specifying the name of the role
返回:
a boolean indicating whether the sender of the request belongs to a given role
抛出异常:
IllegalStateException - This exception is thrown if the method is called while no request is being serviced.

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.