-
Notifications
You must be signed in to change notification settings - Fork 11
/
ServletEndpointContext.java
139 lines (126 loc) · 6.1 KB
/
ServletEndpointContext.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
* Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package javax.xml.rpc.server;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.ServiceException;
import javax.servlet.ServletContext;
import javax.xml.rpc.handler.MessageContext;
import javax.servlet.http.HttpSession;
/** The <code>ServletEndpointContext</code> provides an endpoint
* context maintained by the underlying servlet container based
* Jakarta XML RPC runtime system. For service endpoints deployed on a
* servlet container based Jakarta XML RPC runtime system, the context
* parameter in the <code>ServiceLifecycle.init</code> method is
* required to be of the Java type
* <code>javax.xml.rpc.server.ServletEndpointContext</code>.
*
* <p>A servlet container based Jakarta XML RPC runtime system implements
* the <code>ServletEndpointContext</code> interface. The Jakarta XML 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
* @author Roberto Chinnici
**/
public interface ServletEndpointContext {
/** The method <code>getMessageContext</code> returns the
* <code>MessageContext</code> targeted for this endpoint instance.
* This enables the service endpoint instance to acccess the
* <code>MessageContext</code> propagated by request
* <code>HandlerChain</code> (and its contained <code>Handler</code>
* instances) to the target endpoint instance and to share any
* SOAP message processing related context. The endpoint instance
* can access and manipulate the <code>MessageContext</code>
* and share the SOAP message processing related context with
* the response <code>HandlerChain</code>.
*
* @return MessageContext; If there is no associated
* <code>MessageContext</code>, this method returns
* <code>null</code>.
* @throws java.lang.IllegalStateException if this method is
* invoked outside a remote method implementation by
* a service endpoint instance.
* @see javax.xml.rpc.handler.MessageContext
* @see javax.xml.rpc.handler.HandlerChain
* @see javax.xml.rpc.handler.Handler
**/
public javax.xml.rpc.handler.MessageContext getMessageContext();
/** Returns a <code>java.security.Principal</code> instance that
* contains the name of the authenticated user for the current
* method invocation on the endpoint instance. This method returns
* <code>null</code> if there is no associated principal yet.
* The underlying Jakarta XML RPC runtime system takes the responsibility
* of providing the appropriate authenticated principal for a
* remote method invocation on the service endpoint instance.
*
* @return A <code>java.security.Principal</code> for the
* authenticated principal associated with the current
* invocation on the servlet endpoint instance;
* Returns <code>null</code> if there no authenticated
* user associated with a method invocation.
* @see java.security.Principal
**/
public java.security.Principal getUserPrincipal();
/** The <code>getHttpSession</code> method returns the current
* HTTP session (as a <code>javax.servlet.http.HTTPSession</code>).
* When invoked by the service endpoint within a remote method
* implementation, the <code>getHttpSession</code> returns the
* HTTP session associated currently with this method invocation.
* This method returns <code>null</code> 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 Jakarta XML RPC
* runtime system is responsible for managing whether or not
* there is an active HTTP session.
* <p>The getHttpSession method throws <code>JAXRPCException</code>
* if invoked by an non HTTP bound endpoint.
*
* @return The HTTP session associated with the current
* invocation or <code>null</code> if there is
* no active session.
*
* @throws JAXRPCException If this method invoked by any
* non-HTTP bound endpoint
* @see javax.servlet.http.HttpSession
**/
public javax.servlet.http.HttpSession getHttpSession();
/** The method <code>getServletContext</code> returns the
* <code>ServletContex</code>t 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.
*
* @return <code>ServletContext</code>
* @see javax.servlet.ServletContext
**/
public javax.servlet.ServletContext getServletContext();
/** Returns a boolean indicating whether the authenticated user
* for the current method invocation on the endpoint instance
* is included in the specified logical "role".
*
* @param role a <code>String</code> specifying the name
* of the role
* @return a <code>boolean</code> indicating whether the
* authenticated user associated with the current
* method invocation belongs to a given role;
* <code>false</code> if the user has not been authenticated
**/
public boolean isUserInRole(String role);
}