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