1 /*
2 * Copyright 2005-2006 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package javax.xml.ws.handler;
27 import java.util.Map;
28
29 /** The interface <code>MessageContext</code> abstracts the message
30 * context that is processed by a handler in the <code>handle</code>
31 * method.
32 *
33 * <p>The <code>MessageContext</code> interface provides methods to
34 * manage a property set. <code>MessageContext</code> properties
35 * enable handlers in a handler chain to share processing related
36 * state.
37 *
38 * @since JAX-WS 2.0
39 **/
40 public interface MessageContext extends Map<String, Object> {
41
42 /** Standard property: message direction, <code>true</code> for
43 * outbound messages, <code>false</code> for inbound.
44 * <p>Type: boolean
45 **/
46 public static final String MESSAGE_OUTBOUND_PROPERTY =
47 "javax.xml.ws.handler.message.outbound";
48
49 /** Standard property: Map of attachments to a message for the inbound
50 * message, key is the MIME Content-ID, value is a DataHandler.
51 * <p>Type: java.util.Map<String,DataHandler>
52 **/
53 public static final String INBOUND_MESSAGE_ATTACHMENTS =
54 "javax.xml.ws.binding.attachments.inbound";
55
56 /** Standard property: Map of attachments to a message for the outbound
57 * message, key is the MIME Content-ID, value is a DataHandler.
58 * <p>Type: java.util.Map<String,DataHandler>
59 **/
60 public static final String OUTBOUND_MESSAGE_ATTACHMENTS =
61 "javax.xml.ws.binding.attachments.outbound";
62
63 /** Standard property: input source for WSDL document.
64 * <p>Type: org.xml.sax.InputSource
65 **/
66 public static final String WSDL_DESCRIPTION =
67 "javax.xml.ws.wsdl.description";
68
69 /** Standard property: name of WSDL service.
70 * <p>Type: javax.xml.namespace.QName
71 **/
72 public static final String WSDL_SERVICE =
73 "javax.xml.ws.wsdl.service";
74
75 /** Standard property: name of WSDL port.
76 * <p>Type: javax.xml.namespace.QName
77 **/
78 public static final String WSDL_PORT =
79 "javax.xml.ws.wsdl.port";
80
81 /** Standard property: name of wsdl interface (2.0) or port type (1.1).
82 * <p>Type: javax.xml.namespace.QName
83 **/
84 public static final String WSDL_INTERFACE =
85 "javax.xml.ws.wsdl.interface";
86
87 /** Standard property: name of WSDL operation.
88 * <p>Type: javax.xml.namespace.QName
89 **/
90 public static final String WSDL_OPERATION =
91 "javax.xml.ws.wsdl.operation";
92
93 /** Standard property: HTTP response status code.
94 * <p>Type: java.lang.Integer
95 **/
96 public static final String HTTP_RESPONSE_CODE =
97 "javax.xml.ws.http.response.code";
98
99 /** Standard property: HTTP request headers.
100 * <p>Type: java.util.Map<java.lang.String, java.util.List<java.lang.String>>
101 **/
102 public static final String HTTP_REQUEST_HEADERS =
103 "javax.xml.ws.http.request.headers";
104
105 /** Standard property: HTTP response headers.
106 * <p>Type: java.util.Map<java.lang.String, java.util.List<java.lang.String>>
107 **/
108 public static final String HTTP_RESPONSE_HEADERS =
109 "javax.xml.ws.http.response.headers";
110
111 /** Standard property: HTTP request method.
112 * <p>Type: java.lang.String
113 **/
114 public static final String HTTP_REQUEST_METHOD =
115 "javax.xml.ws.http.request.method";
116
117 /** Standard property: servlet request object.
118 * <p>Type: javax.servlet.http.HttpServletRequest
119 **/
120 public static final String SERVLET_REQUEST =
121 "javax.xml.ws.servlet.request";
122
123 /** Standard property: servlet response object.
124 * <p>Type: javax.servlet.http.HttpServletResponse
125 **/
126 public static final String SERVLET_RESPONSE =
127 "javax.xml.ws.servlet.response";
128
129 /** Standard property: servlet context object.
130 * <p>Type: javax.servlet.ServletContext
131 **/
132 public static final String SERVLET_CONTEXT =
133 "javax.xml.ws.servlet.context";
134
135 /** Standard property: Query string for request.
136 * <p>Type: String
137 **/
138 public static final String QUERY_STRING =
139 "javax.xml.ws.http.request.querystring";
140
141 /** Standard property: Request Path Info
142 * <p>Type: String
143 **/
144 public static final String PATH_INFO =
145 "javax.xml.ws.http.request.pathinfo";
146
147 /**
148 * Property scope. Properties scoped as <code>APPLICATION</code> are
149 * visible to handlers,
150 * client applications and service endpoints; properties scoped as
151 * <code>HANDLER</code>
152 * are only normally visible to handlers.
153 **/
154 public enum Scope {APPLICATION, HANDLER};
155
156 /** Sets the scope of a property.
157 *
158 * @param name Name of the property associated with the
159 * <code>MessageContext</code>
160 * @param scope Desired scope of the property
161 * @throws java.lang.IllegalArgumentException if an illegal
162 * property name is specified
163 *
164 **/
165 public void setScope(String name, Scope scope);
166
167 /** Gets the scope of a property.
168 *
169 * @param name Name of the property
170 * @return Scope of the property
171 * @throws java.lang.IllegalArgumentException if a non-existant
172 * property name is specified
173 *
174 **/
175 public Scope getScope(String name);
176 }