KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > rpc > server > ServletEndpointContext


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package javax.xml.rpc.server;
17
18 import javax.servlet.ServletContext JavaDoc;
19 import javax.servlet.http.HttpSession JavaDoc;
20 import javax.xml.rpc.handler.MessageContext JavaDoc;
21 import java.security.Principal JavaDoc;
22
23 /**
24  * The <code>ServletEndpointContext</code> provides an endpoint
25  * context maintained by the underlying servlet container based
26  * JAX-RPC runtime system. For service endpoints deployed on a
27  * servlet container based JAX-RPC runtime system, the context
28  * parameter in the <code>ServiceLifecycle.init</code> method is
29  * required to be of the Java type
30  * <code>javax.xml.rpc.server.ServletEndpointContext</code>.
31  * <p>
32  * A servlet container based JAX-RPC runtime system implements
33  * the <code>ServletEndpointContext</code> interface. The JAX-RPC
34  * runtime system is required to provide appropriate session,
35  * message context, servlet context and user principal information
36  * per method invocation on the endpoint class.
37  *
38  * @version 1.0
39  */

40 public interface ServletEndpointContext {
41
42     /**
43      * The method <code>getMessageContext</code> returns the
44      * <code>MessageContext</code> targeted for this endpoint instance.
45      * This enables the service endpoint instance to acccess the
46      * <code>MessageContext</code> propagated by request
47      * <code>HandlerChain</code> (and its contained <code>Handler</code>
48      * instances) to the target endpoint instance and to share any
49      * SOAP message processing related context. The endpoint instance
50      * can access and manipulate the <code>MessageContext</code>
51      * and share the SOAP message processing related context with
52      * the response <code>HandlerChain</code>.
53      *
54      * @return MessageContext; If there is no associated
55      * <code>MessageContext</code>, this method returns
56      * <code>null</code>.
57      * @throws java.lang.IllegalStateException if this method is invoked outside a
58      * remote method implementation by a service endpoint instance.
59      */

60     public MessageContext JavaDoc getMessageContext();
61
62     /**
63      * Returns a <code>java.security.Principal</code> instance that
64      * contains the name of the authenticated user for the current
65      * method invocation on the endpoint instance. This method returns
66      * <code>null</code> if there is no associated principal yet.
67      * The underlying JAX-RPC runtime system takes the responsibility
68      * of providing the appropriate authenticated principal for a
69      * remote method invocation on the service endpoint instance.
70      *
71      * @return A <code>java.security.Principal</code> for the
72      * authenticated principal associated with the current
73      * invocation on the servlet endpoint instance;
74      * Returns <code>null</code> if there no authenticated
75      * user associated with a method invocation.
76      */

77     public Principal JavaDoc getUserPrincipal();
78
79     /**
80      * The <code>getHttpSession</code> method returns the current
81      * HTTP session (as a <code>javax.servlet.http.HTTPSession</code>).
82      * When invoked by the service endpoint within a remote method
83      * implementation, the <code>getHttpSession</code> returns the
84      * HTTP session associated currently with this method invocation.
85      * This method returns <code>null</code> if there is no HTTP
86      * session currently active and associated with this service
87      * endpoint. An endpoint class should not rely on an active
88      * HTTP session being always there; the underlying JAX-RPC
89      * runtime system is responsible for managing whether or not
90      * there is an active HTTP session.
91      * <p>
92      * The getHttpSession method throws <code>JAXRPCException</code>
93      * if invoked by an non HTTP bound endpoint.
94      *
95      * @return The HTTP session associated with the current
96      * invocation or <code>null</code> if there is no active session.
97      * @throws javax.xml.rpc.JAXRPCException - If this method invoked by a non-HTTP bound
98      * endpoints.
99      */

100     public HttpSession JavaDoc getHttpSession();
101
102     /**
103      * The method <code>getServletContext</code> returns the
104      * <code>ServletContex</code>t associated with the web
105      * application that contain this endpoint. According to
106      * the Servlet specification, There is one context per web
107      * application (installed as a WAR) per JVM . A servlet
108      * based service endpoint is deployed as part of a web
109      * application.
110      *
111      * @return the current <code>ServletContext</code>
112      */

113     public ServletContext JavaDoc getServletContext();
114
115     public boolean isUserInRole(java.lang.String JavaDoc s);
116 }
117
Popular Tags