KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > ws > WebServiceContext


1 /*
2  * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
3  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4  */

5
6 package javax.xml.ws;
7
8 import java.security.Principal JavaDoc;
9 import javax.xml.ws.handler.MessageContext;
10 import javax.xml.ws.wsaddressing.W3CEndpointReference;
11 import org.w3c.dom.Element JavaDoc;
12
13
14 /**
15  * A <code>WebServiceContext</code> makes it possible for
16  * a web service endpoint implementation class to access
17  * message context and security information relative to
18  * a request being served.
19  *
20  * Typically a <code>WebServiceContext</code> is injected
21  * into an endpoint implementation class using the
22  * <code>Resource</code> annotation.
23  *
24  * @since JAX-WS 2.0
25  *
26  * @see javax.annotation.Resource
27  **/

28 public interface WebServiceContext {
29     
30     /**
31      * Returns the <code>MessageContext</code> for the request being served
32      * at the time this method is called. Only properties with
33      * APPLICATION scope will be visible to the application.
34      *
35      * @return MessageContext The message context.
36      *
37      * @throws IllegalStateException This exception is thrown
38      * if the method is called while no request is
39      * being serviced.
40      *
41      * @see javax.xml.ws.handler.MessageContext
42      * @see javax.xml.ws.handler.MessageContext.Scope
43      * @see java.lang.IllegalStateException
44      **/

45     public MessageContext getMessageContext();
46     
47     /**
48      * Returns the Principal that identifies the sender
49      * of the request currently being serviced. If the
50      * sender has not been authenticated, the method
51      * returns <code>null</code>.
52      *
53      * @return Principal The principal object.
54      *
55      * @throws IllegalStateException This exception is thrown
56      * if the method is called while no request is
57      * being serviced.
58      *
59      * @see java.security.Principal
60      * @see java.lang.IllegalStateException
61      **/

62     public Principal JavaDoc getUserPrincipal();
63     
64     /**
65      * Returns a boolean indicating whether the
66      * authenticated user is included in the specified
67      * logical role. If the user has not been
68      * authenticated, the method returns </code>false</code>.
69      *
70      * @param role A <code>String</code> specifying the name of the role
71      *
72      * @return a <code>boolean</code> indicating whether
73      * the sender of the request belongs to a given role
74      *
75      * @throws IllegalStateException This exception is thrown
76      * if the method is called while no request is
77      * being serviced.
78      **/

79     public boolean isUserInRole(String JavaDoc role);
80     
81     /**
82      * Returns the <code>EndpointReference</code> for this
83      * endpoint.
84      * <p>
85      * If the {@link Binding} for this <code>bindingProvider</code> is
86      * either SOAP1.1/HTTP or SOAP1.2/HTTP, then a
87      * <code>W3CEndpointReference</code> MUST be returned.
88      *
89      * @param referenceParameters Reference parameters to be associated with the
90      * returned <code>EndpointReference</code> instance.
91      * @return EndpointReference of the endpoint associated with this
92      * <code>WebServiceContext</code>.
93      * If the returned <code>EndpointReference</code> is of type
94      * <code>W3CEndpointReference</code> then it MUST contain the
95      * the specified <code>referenceParameters</code>.
96      *
97      * @throws IllegalStateException This exception is thrown
98      * if the method is called while no request is
99      * being serviced.
100      *
101      * @see W3CEndpointReference
102      *
103      * @since JAX-WS 2.1
104      */

105     public EndpointReference getEndpointReference(Element JavaDoc... referenceParameters);
106
107     /**
108      * Returns the <code>EndpointReference</code> associated with
109      * this endpoint.
110      *
111      * @param clazz The type of <code>EndpointReference</code> that
112      * MUST be returned.
113      * @param referenceParameters Reference parameters to be associated with the
114      * returned <code>EndpointReference</code> instance.
115      * @return EndpointReference of type <code>clazz</code> of the endpoint
116      * associated with this <code>WebServiceContext</code> instance.
117      * If the returned <code>EndpointReference</code> is of type
118      * <code>W3CEndpointReference</code> then it MUST contain the
119      * the specified <code>referenceParameters</code>.
120      *
121      * @throws IllegalStateException This exception is thrown
122      * if the method is called while no request is
123      * being serviced.
124      * @throws WebServiceException If the <code>clazz</code> type of
125      * <code>EndpointReference</code> is not supported.
126      *
127      * @since JAX-WS 2.1
128      **/

129     public <T extends EndpointReference> T getEndpointReference(Class JavaDoc<T> clazz,
130             Element JavaDoc... referenceParameters);
131 }
132
Popular Tags