ServletEndpointContext (Java EE 5)

Java EE API


javax.xml.rpc.server Interface ServletEndpointContext


public interface ServletEndpointContext


ServletEndpointContext 提供由底层基于 servlet 容器的 JAX-RPC 运行时系统所维护的端点上下文。对于基于 servlet 容器的 JAX-RPC 运行时系统上部署的服务端点,ServiceLifecycle.init 方法中的 context 参数的类型必须为 Java 类型 javax.xml.rpc.server.ServletEndpointContext

基于 servlet 容器的 JAX-RPC 运行时系统实现 ServletEndpointContext 接口。每次在端点类上执行方法调用时,JAX-RPC 运行时系统都必须提供相应的会话、消息上下文、servlet 上下文和用户主体信息。

英文文档:

The ServletEndpointContext provides an endpoint context maintained by the underlying servlet container based JAX-RPC runtime system. For service endpoints deployed on a servlet container based JAX-RPC runtime system, the context parameter in the ServiceLifecycle.init method is required to be of the Java type javax.xml.rpc.server.ServletEndpointContext.

A servlet container based JAX-RPC runtime system implements the ServletEndpointContext interface. The JAX-RPC runtime system is required to provide appropriate session, message context, servlet context and user principal information per method invocation on the endpoint class.

Version:
1.1
Author:
Rahul Sharma, Roberto Chinnici

Method Summary
 HttpSession
 MessageContext
 ServletContext
 Principal
 boolean
 

Method Detail

public MessageContext getMessageContext()
方法 getMessageContext 返回以此端点实例为目标的 MessageContext。这使服务端点实例能够访问由请求 HandlerChain(及其包含的 Handler 实例)传播到目标端点实例的 MessageContext,并能够共享任何与 SOAP 消息处理有关的上下文。端点实例可以访问和操作 MessageContext,并与响应 HandlerChain 共享与 SOAP 消息处理相关的上下文。
return MessageContext;如果没有关联的 MessageContext,则此方法返回 null
ThrowsIllegalStateException: 如果服务端点实例在远程方法实现范围以外调用此方法。
See also javax.xml.rpc.handler.MessageContext, javax.xml.rpc.handler.HandlerChain, javax.xml.rpc.handler.Handler
英文文档:

getMessageContext

MessageContext getMessageContext()
The method getMessageContext returns the MessageContext targeted for this endpoint instance. This enables the service endpoint instance to acccess the MessageContext propagated by request HandlerChain (and its contained Handler instances) to the target endpoint instance and to share any SOAP message processing related context. The endpoint instance can access and manipulate the MessageContext and share the SOAP message processing related context with the response HandlerChain.

Returns:
MessageContext; If there is no associated MessageContext, this method returns null.
Throws:
IllegalStateException - if this method is invoked outside a remote method implementation by a service endpoint instance.
See Also:
MessageContext, HandlerChain, Handler

public java.security.Principal getUserPrincipal()
返回 java.security.Principal 实例,该实例包含当前对端点实例调用的方法的已验证用户名。如果不存在任何关联的主体,则此方法返回 null。底层 JAX-RPC 运行时系统负责为对服务端点实例调用的远程方法提供相应的已验证主体。
return 一个 java.security.Principal,它用于与 servlet 端点实例的当前调用关联的已验证主体;如果没有任何与方法调用关联的已验证用户,则返回 null
See also java.security.Principal
英文文档:

getUserPrincipal

Principal getUserPrincipal()
Returns a java.security.Principal instance that contains the name of the authenticated user for the current method invocation on the endpoint instance. This method returns null if there is no associated principal yet. The underlying JAX-RPC runtime system takes the responsibility of providing the appropriate authenticated principal for a remote method invocation on the service endpoint instance.

Returns:
A java.security.Principal for the authenticated principal associated with the current invocation on the servlet endpoint instance; Returns null if there no authenticated user associated with a method invocation.
See Also:
Principal

public HttpSession getHttpSession()
getHttpSession 方法返回当前 HTTP 会话(javax.servlet.http.HTTPSession 形式)。当由远程服务实现中的服务端点调用时,getHttpSession 返回当前与此方法调用关联的 HTTP 会话。如果当前没有任何处于活动状态且与此服务端点关联的 HTTP 会话,则此方法返回 null。端点类不应该依赖于总是存在的活动 HTTP 会话;底层 JAX-RPC 运行时系统负责管理是否存在活动的 HTTP 会话。

如果由非 HTTP 绑定端点调用,那么 getHttpSession 方法将抛出 JAXRPCException

return 与当前调用关联的 HTTP 会话;如果没有任何活动会话,则返回 null
ThrowsJAXRPCException: 如果此方法由非 HTTP 绑定端点调用
See also javax.servlet.http.HttpSession

英文文档:

getHttpSession

HttpSession getHttpSession()
The getHttpSession method returns the current HTTP session (as a javax.servlet.http.HTTPSession). When invoked by the service endpoint within a remote method implementation, the getHttpSession returns the HTTP session associated currently with this method invocation. This method returns null if there is no HTTP session currently active and associated with this service endpoint. An endpoint class should not rely on an active HTTP session being always there; the underlying JAX-RPC runtime system is responsible for managing whether or not there is an active HTTP session.

The getHttpSession method throws JAXRPCException if invoked by an non HTTP bound endpoint.

Returns:
The HTTP session associated with the current invocation or null if there is no active session.
Throws:
JAXRPCException - If this method invoked by any non-HTTP bound endpoint
See Also:
HttpSession

public ServletContext getServletContext()
方法 getServletContext 返回与包含此端点的 Web 应用程序关联的 ServletContext。根据 Servlet 规范,每个 JVM 的每个 Web 应用程序(安装为 WAR)都有一个上下文。基于 servlet 的服务端点是作为 Web 应用程序的一部分部署的。
return
ServletContext
See also javax.servlet.ServletContext
英文文档:

getServletContext

ServletContext getServletContext()
The method getServletContext returns the ServletContext associated with the web application that contain this endpoint. According to the Servlet specification, There is one context per web application (installed as a WAR) per JVM . A servlet based service endpoint is deployed as part of a web application.

Returns:
ServletContext
See Also:
ServletContext

public boolean isUserInRole(String role)
返回一个 boolean 值,指示指定的逻辑“角色”中是否包含当前对端点实例调用的方法的已验证用户。
role 指定角色名称的 String
return 一个 boolean 值,指示与当前方法调用关联的已验证用户是否属于给定角色;如果用户未经过验证,则返回 false
英文文档:

isUserInRole

boolean isUserInRole(String role)
Returns a boolean indicating whether the authenticated user for the current method invocation on the endpoint instance is included in the specified logical "role".

Parameters:
role - a String specifying the name of the role
Returns:
a boolean indicating whether the authenticated user associated with the current method invocation belongs to a given role; false if the user has not been authenticated


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!