1 /*
2  * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package javax.xml.ws.handler;
27 import java.util.Map;
28 
29 /**
30  * The interface <code>MessageContext</code> abstracts the message
31  * context that is processed by a handler in the <code>handle</code>
32  * method.
33  *
34  * <p>The <code>MessageContext</code> interface provides methods to
35  * manage a property set. <code>MessageContext</code> properties
36  * enable handlers in a handler chain to share processing related
37  * state.
38  *
39  * @since JAX-WS 2.0
40  */
41 public interface MessageContext extends Map<String, Object> {
42 
43     /**
44      * Standard property: message direction, <code>true</code> for
45      * outbound messages, <code>false</code> for inbound.
46      * <p>Type: boolean
47      */
48     public static final String MESSAGE_OUTBOUND_PROPERTY =
49             "javax.xml.ws.handler.message.outbound";
50 
51     /**
52      * Standard property: Map of attachments to a message for the inbound
53      * message, key is  the MIME Content-ID, value is a DataHandler.
54      * <p>Type: java.util.Map&lt;String,DataHandler>
55      */
56     public static final String INBOUND_MESSAGE_ATTACHMENTS =
57             "javax.xml.ws.binding.attachments.inbound";
58 
59     /**
60      * Standard property: Map of attachments to a message for the outbound
61      * message, key is the MIME Content-ID, value is a DataHandler.
62      * <p>Type: java.util.Map&lt;String,DataHandler>
63      */
64     public static final String OUTBOUND_MESSAGE_ATTACHMENTS =
65             "javax.xml.ws.binding.attachments.outbound";
66 
67     /**
68      * Standard property: input source for WSDL document.
69      * <p>Type: org.xml.sax.InputSource
70      */
71     public static final String WSDL_DESCRIPTION =
72             "javax.xml.ws.wsdl.description";
73 
74     /**
75      * Standard property: name of WSDL service.
76      * <p>Type: javax.xml.namespace.QName
77      */
78     public static final String WSDL_SERVICE =
79             "javax.xml.ws.wsdl.service";
80 
81     /**
82      * Standard property: name of WSDL port.
83      * <p>Type: javax.xml.namespace.QName
84      */
85     public static final String WSDL_PORT =
86             "javax.xml.ws.wsdl.port";
87 
88     /**
89      * Standard property: name of wsdl interface (2.0) or port type (1.1).
90      * <p>Type: javax.xml.namespace.QName
91      */
92     public static final String WSDL_INTERFACE =
93             "javax.xml.ws.wsdl.interface";
94 
95     /**
96      * Standard property: name of WSDL operation.
97      * <p>Type: javax.xml.namespace.QName
98      */
99     public static final String WSDL_OPERATION =
100             "javax.xml.ws.wsdl.operation";
101 
102     /**
103      * Standard property: HTTP response status code.
104      * <p>Type: java.lang.Integer
105      */
106     public static final String HTTP_RESPONSE_CODE =
107             "javax.xml.ws.http.response.code";
108 
109     /**
110      * Standard property: HTTP request headers.
111      * <p>Type: java.util.Map&lt;java.lang.String, java.util.List&lt;java.lang.String>>
112      */
113     public static final String HTTP_REQUEST_HEADERS =
114             "javax.xml.ws.http.request.headers";
115 
116     /**
117      * Standard property: HTTP response headers.
118      * <p>Type: java.util.Map&lt;java.lang.String, java.util.List&lt;java.lang.String>>
119      */
120     public static final String HTTP_RESPONSE_HEADERS =
121             "javax.xml.ws.http.response.headers";
122 
123     /**
124      * Standard property: HTTP request method.
125      * <p>Type: java.lang.String
126      */
127     public static final String HTTP_REQUEST_METHOD =
128             "javax.xml.ws.http.request.method";
129 
130     /**
131      * Standard property: servlet request object.
132      * <p>Type: javax.servlet.http.HttpServletRequest
133      */
134     public static final String SERVLET_REQUEST =
135             "javax.xml.ws.servlet.request";
136 
137     /**
138      * Standard property: servlet response object.
139      * <p>Type: javax.servlet.http.HttpServletResponse
140      */
141     public static final String SERVLET_RESPONSE =
142             "javax.xml.ws.servlet.response";
143 
144     /**
145      * Standard property: servlet context object.
146      * <p>Type: javax.servlet.ServletContext
147      */
148     public static final String SERVLET_CONTEXT =
149             "javax.xml.ws.servlet.context";
150 
151     /**
152      * Standard property: Query string for request.
153      * <p>Type: String
154      **/
155     public static final String QUERY_STRING =
156             "javax.xml.ws.http.request.querystring";
157 
158     /**
159      * Standard property: Request Path Info
160      * <p>Type: String
161      */
162     public static final String PATH_INFO =
163             "javax.xml.ws.http.request.pathinfo";
164 
165     /**
166      * Standard property: WS Addressing Reference Parameters.
167      * The list MUST include all SOAP headers marked with the
168      * wsa:IsReferenceParameter="true" attribute.
169      * <p>Type: List&lt;Element>
170      *
171      * @since JAX-WS 2.1
172      */
173     public static final String REFERENCE_PARAMETERS =
174             "javax.xml.ws.reference.parameters";
175 
176     /**
177      * Property scope. Properties scoped as <code>APPLICATION</code> are
178      * visible to handlers,
179      * client applications and service endpoints; properties scoped as
180      * <code>HANDLER</code>
181      * are only normally visible to handlers.
182      */
183     public enum Scope {APPLICATION, HANDLER};
184 
185     /**
186      * Sets the scope of a property.
187      *
188      * @param name Name of the property associated with the
189      *             <code>MessageContext</code>
190      * @param scope Desired scope of the property
191      * @throws java.lang.IllegalArgumentException if an illegal
192      *             property name is specified
193      */
setScope(String name, Scope scope)194     public void setScope(String name,  Scope scope);
195 
196     /**
197      * Gets the scope of a property.
198      *
199      * @param name Name of the property
200      * @return Scope of the property
201      * @throws java.lang.IllegalArgumentException if a non-existant
202      *             property name is specified
203      */
getScope(String name)204     public Scope getScope(String  name);
205 }
206