001 /*
002 * Copyright 2001-2004 The Apache Software Foundation.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package javax.xml.rpc.server;
017
018 import javax.servlet.ServletContext;
019 import javax.servlet.http.HttpSession;
020 import javax.xml.rpc.handler.MessageContext;
021 import java.security.Principal;
022
023 /**
024 * The <code>ServletEndpointContext</code> provides an endpoint
025 * context maintained by the underlying servlet container based
026 * JAX-RPC runtime system. For service endpoints deployed on a
027 * servlet container based JAX-RPC runtime system, the context
028 * parameter in the <code>ServiceLifecycle.init</code> method is
029 * required to be of the Java type
030 * <code>javax.xml.rpc.server.ServletEndpointContext</code>.
031 * <p>
032 * A servlet container based JAX-RPC runtime system implements
033 * the <code>ServletEndpointContext</code> interface. The JAX-RPC
034 * runtime system is required to provide appropriate session,
035 * message context, servlet context and user principal information
036 * per method invocation on the endpoint class.
037 *
038 * @version 1.0
039 */
040 public interface ServletEndpointContext {
041
042 /**
043 * The method <code>getMessageContext</code> returns the
044 * <code>MessageContext</code> targeted for this endpoint instance.
045 * This enables the service endpoint instance to acccess the
046 * <code>MessageContext</code> propagated by request
047 * <code>HandlerChain</code> (and its contained <code>Handler</code>
048 * instances) to the target endpoint instance and to share any
049 * SOAP message processing related context. The endpoint instance
050 * can access and manipulate the <code>MessageContext</code>
051 * and share the SOAP message processing related context with
052 * the response <code>HandlerChain</code>.
053 *
054 * @return MessageContext; If there is no associated
055 * <code>MessageContext</code>, this method returns
056 * <code>null</code>.
057 * @throws java.lang.IllegalStateException if this method is invoked outside a
058 * remote method implementation by a service endpoint instance.
059 */
060 public MessageContext getMessageContext();
061
062 /**
063 * Returns a <code>java.security.Principal</code> instance that
064 * contains the name of the authenticated user for the current
065 * method invocation on the endpoint instance. This method returns
066 * <code>null</code> if there is no associated principal yet.
067 * The underlying JAX-RPC runtime system takes the responsibility
068 * of providing the appropriate authenticated principal for a
069 * remote method invocation on the service endpoint instance.
070 *
071 * @return A <code>java.security.Principal</code> for the
072 * authenticated principal associated with the current
073 * invocation on the servlet endpoint instance;
074 * Returns <code>null</code> if there no authenticated
075 * user associated with a method invocation.
076 */
077 public Principal getUserPrincipal();
078
079 /**
080 * The <code>getHttpSession</code> method returns the current
081 * HTTP session (as a <code>javax.servlet.http.HTTPSession</code>).
082 * When invoked by the service endpoint within a remote method
083 * implementation, the <code>getHttpSession</code> returns the
084 * HTTP session associated currently with this method invocation.
085 * This method returns <code>null</code> if there is no HTTP
086 * session currently active and associated with this service
087 * endpoint. An endpoint class should not rely on an active
088 * HTTP session being always there; the underlying JAX-RPC
089 * runtime system is responsible for managing whether or not
090 * there is an active HTTP session.
091 * <p>
092 * The getHttpSession method throws <code>JAXRPCException</code>
093 * if invoked by an non HTTP bound endpoint.
094 *
095 * @return The HTTP session associated with the current
096 * invocation or <code>null</code> if there is no active session.
097 * @throws javax.xml.rpc.JAXRPCException - If this method invoked by a non-HTTP bound
098 * endpoints.
099 */
100 public HttpSession 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 getServletContext();
114
115 public boolean isUserInRole(java.lang.String s);
116 }