KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > transport > http > HTTPConstants


1 /*
2  * Copyright 2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis2.transport.http;
17
18 import java.io.UnsupportedEncodingException JavaDoc;
19
20 /**
21  * HTTP protocol and message context constants.
22  */

23 public class HTTPConstants {
24  
25     public static final String JavaDoc PROTOCOL_VERSION = "PROTOCOL";
26
27     /**
28      * Field REQUEST_URI
29      */

30     public static final String JavaDoc REQUEST_URI = "REQUEST_URI";
31
32     /**
33      * Field RESPONSE_CODE
34      */

35     public static final String JavaDoc RESPONSE_CODE = "RESPONSE_CODE";
36
37     /**
38      * Field RESPONSE_WORD
39      */

40     public static final String JavaDoc RESPONSE_WORD = "RESPONSE_WORD";
41
42     /**
43      * Field RESPONSE_ACK_CODE_VAL
44      */

45     public static final String JavaDoc RESPONSE_ACK_CODE_VAL = "202";
46
47     /**
48      * Field SOCKET
49      */

50     public static final String JavaDoc SOCKET = "SOCKET";
51
52     /**
53      * Field HEADER_PROTOCOL_10
54      */

55     public static final String JavaDoc HEADER_PROTOCOL_10 = "HTTP/1.0";
56
57     /**
58      * Field HEADER_PROTOCOL_11
59      */

60     public static final String JavaDoc HEADER_PROTOCOL_11 = "HTTP/1.1";
61
62     /**
63      * Field HEADER_PROTOCOL_V10
64      */

65     public static final String JavaDoc HEADER_PROTOCOL_V10 = "1.0".intern();
66
67     /**
68      * Field HEADER_PROTOCOL_V11
69      */

70     public static final String JavaDoc HEADER_PROTOCOL_V11 = "1.1".intern();
71
72     /**
73      * Field HEADER_POST
74      */

75     public static final String JavaDoc HEADER_POST = "POST";
76     
77     /**
78      * Field HEADER_GET
79      */

80     public static final String JavaDoc HEADER_GET = "GET";
81
82     /**
83      * Field HEADER_HOST
84      */

85     public static final String JavaDoc HEADER_HOST = "Host";
86
87     /**
88      * Field HEADER_CONTENT_DESCRIPTION
89      */

90     public static final String JavaDoc HEADER_CONTENT_DESCRIPTION =
91             "Content-Description";
92
93     /**
94      * Field HEADER_CONTENT_TYPE
95      */

96     public static final String JavaDoc HEADER_CONTENT_TYPE = "Content-Type";
97
98     /**
99      * Field HEADER_CONTENT_TRANSFER_ENCODING
100      */

101     public static final String JavaDoc HEADER_CONTENT_TRANSFER_ENCODING =
102             "Content-Transfer-Encoding";
103
104     /**
105      * Field HEADER_CONTENT_TYPE_JMS
106      */

107     public static final String JavaDoc HEADER_CONTENT_TYPE_JMS = "ContentType";
108
109     /**
110      * Field HEADER_CONTENT_LENGTH
111      */

112     public static final String JavaDoc HEADER_CONTENT_LENGTH = "Content-Length";
113
114     /**
115      * Field HEADER_CONTENT_LOCATION
116      */

117     public static final String JavaDoc HEADER_CONTENT_LOCATION = "Content-Location";
118
119     /**
120      * Field HEADER_CONTENT_ID
121      */

122     public static final String JavaDoc HEADER_CONTENT_ID = "Content-Id";
123
124     /**
125      * Field HEADER_SOAP_ACTION
126      */

127     public static final String JavaDoc HEADER_SOAP_ACTION = "SOAPAction";
128
129     /**
130      * Field HEADER_AUTHORIZATION
131      */

132     public static final String JavaDoc HEADER_AUTHORIZATION = "Authorization";
133
134     /**
135      * Field HEADER_PROXY_AUTHORIZATION
136      */

137     public static final String JavaDoc HEADER_PROXY_AUTHORIZATION =
138             "Proxy-Authorization";
139
140     /**
141      * Field HEADER_EXPECT
142      */

143     public static final String JavaDoc HEADER_EXPECT = "Expect";
144
145     /**
146      * Field HEADER_EXPECT_100_Continue
147      */

148     public static final String JavaDoc HEADER_EXPECT_100_Continue = "100-continue";
149
150     /**
151      * Field HEADER_USER_AGENT
152      */

153     public static final String JavaDoc HEADER_USER_AGENT = "User-Agent";
154
155     /**
156      * Field HEADER_CACHE_CONTROL
157      */

158     public static final String JavaDoc HEADER_CACHE_CONTROL = "Cache-Control";
159
160     /**
161      * Field HEADER_CACHE_CONTROL_NOCACHE
162      */

163     public static final String JavaDoc HEADER_CACHE_CONTROL_NOCACHE = "no-cache";
164
165     /**
166      * Field HEADER_PRAGMA
167      */

168     public static final String JavaDoc HEADER_PRAGMA = "Pragma";
169
170     /**
171      * Field HEADER_LOCATION
172      */

173     public static final String JavaDoc HEADER_LOCATION = "Location";
174
175     /**
176      * Field REQUEST_HEADERS
177      */

178     public static final String JavaDoc REQUEST_HEADERS = "HTTP-Request-Headers";
179
180     /**
181      * Field RESPONSE_HEADERS
182      */

183     public static final String JavaDoc RESPONSE_HEADERS = "HTTP-Response-Headers";
184
185     /* http 1.1 */
186
187     /**
188      * Field HEADER_TRANSFER_ENCODING
189      */

190     public static final String JavaDoc HEADER_TRANSFER_ENCODING =
191             "Transfer-Encoding".intern();
192
193     /**
194      * Field HEADER_TRANSFER_ENCODING_CHUNKED
195      */

196     public static final String JavaDoc HEADER_TRANSFER_ENCODING_CHUNKED =
197             "chunked".intern();
198
199     /**
200      * Field HEADER_CONNECTION
201      */

202     public static final String JavaDoc HEADER_CONNECTION = "Connection";
203
204     /**
205      * Field HEADER_CONNECTION_CLOSE
206      */

207     public static final String JavaDoc HEADER_CONNECTION_CLOSE = "close".intern();
208
209     /**
210      * Field HEADER_CONNECTION_KEEPALIVE
211      */

212     public static final String JavaDoc HEADER_CONNECTION_KEEPALIVE =
213             "Keep-Alive".intern(); // The default don't send.
214

215     /**
216      * Field HEADER_ACCEPT
217      */

218     public static final String JavaDoc HEADER_ACCEPT = "Accept";
219
220     /**
221      * Field HEADER_ACCEPT_TEXT_ALL
222      */

223     public static final String JavaDoc HEADER_ACCEPT_TEXT_ALL = "text/*";
224
225     /**
226      * Field HEADER_ACCEPT_APPL_SOAP
227      */

228     public static final String JavaDoc HEADER_ACCEPT_APPL_SOAP = "application/soap+xml";
229
230     /**
231      * Field HEADER_ACCEPT_MULTIPART_RELATED
232      */

233     public static final String JavaDoc HEADER_ACCEPT_MULTIPART_RELATED =
234             "multipart/related";
235
236     /**
237      * Field HEADER_ACCEPT_APPLICATION_DIME
238      */

239     public static final String JavaDoc HEADER_ACCEPT_APPLICATION_DIME =
240             "application/dime";
241
242     /**
243      * Cookie headers
244      */

245     public static final String JavaDoc HEADER_COOKIE = "Cookie";
246
247     /**
248      * Field HEADER_COOKIE2
249      */

250     public static final String JavaDoc HEADER_COOKIE2 = "Cookie2";
251
252     /**
253      * Field HEADER_SET_COOKIE
254      */

255     public static final String JavaDoc HEADER_SET_COOKIE = "Set-Cookie";
256
257     /**
258      * Field HEADER_SET_COOKIE2
259      */

260     public static final String JavaDoc HEADER_SET_COOKIE2 = "Set-Cookie2";
261
262     /**
263      * Integer
264      */

265     public static String JavaDoc MC_HTTP_STATUS_CODE = "transport.http.statusCode";
266
267     /**
268      * String
269      */

270     public static String JavaDoc MC_HTTP_STATUS_MESSAGE =
271             "transport.http.statusMessage";
272
273     /**
274      * HttpServlet
275      */

276     public static String JavaDoc MC_HTTP_SERVLET = "transport.http.servlet";
277
278     /**
279      * HttpServletRequest
280      */

281     public static String JavaDoc MC_HTTP_SERVLETREQUEST =
282             "transport.http.servletRequest";
283
284     /**
285      * HttpServletResponse
286      */

287     public static String JavaDoc MC_HTTP_SERVLETRESPONSE =
288             "transport.http.servletResponse";
289
290     /**
291      * Field MC_HTTP_SERVLETLOCATION
292      */

293     public static String JavaDoc MC_HTTP_SERVLETLOCATION =
294             "transport.http.servletLocation";
295
296     /**
297      * Field MC_HTTP_SERVLETPATHINFO
298      */

299     public static String JavaDoc MC_HTTP_SERVLETPATHINFO =
300             "transport.http.servletPathInfo";
301
302     /**
303      * HTTP header field values
304      */

305     public static final String JavaDoc HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";
306
307     /**
308      * AXIS servlet plugin parameter names.
309      */

310     public static final String JavaDoc PLUGIN_NAME = "transport.http.plugin.pluginName";
311
312     /**
313      * Field PLUGIN_SERVICE_NAME
314      */

315     public static final String JavaDoc PLUGIN_SERVICE_NAME =
316             "transport.http.plugin.serviceName";
317
318     /**
319      * Field PLUGIN_IS_DEVELOPMENT
320      */

321     public static final String JavaDoc PLUGIN_IS_DEVELOPMENT =
322             "transport.http.plugin.isDevelopment";
323
324     /**
325      * Field PLUGIN_ENABLE_LIST
326      */

327     public static final String JavaDoc PLUGIN_ENABLE_LIST =
328             "transport.http.plugin.enableList";
329
330     /**
331      * Field PLUGIN_ENGINE
332      */

333     public static final String JavaDoc PLUGIN_ENGINE = "transport.http.plugin.engine";
334
335     /**
336      * Field PLUGIN_WRITER
337      */

338     public static final String JavaDoc PLUGIN_WRITER = "transport.http.plugin.writer";
339
340     /**
341      * Field PLUGIN_LOG
342      */

343     public static final String JavaDoc PLUGIN_LOG = "transport.http.plugin.log";
344
345     /**
346      * Field PLUGIN_EXCEPTION_LOG
347      */

348     public static final String JavaDoc PLUGIN_EXCEPTION_LOG =
349             "transport.http.plugin.exceptionLog";
350
351     /**
352          * Field OK[]
353          */

354     public static final char OK[] = ("200 OK").toCharArray();
355
356     /**
357          * Field NOCONTENT[]
358          */

359     public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
360
361     /**
362          * Field UNAUTH[]
363          */

364     public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
365
366     /**
367          * Field SENDER[]
368          */

369     public static final byte SENDER[] = "400".getBytes();
370
371     /**
372          * Field ISE[]
373          */

374     public static final byte ISE[] = ("500 Internal server error").getBytes();
375
376     // HTTP prefix
377

378     /**
379          * Field HTTP[]
380          */

381     public static char HTTP[] = "HTTP/1.0 ".toCharArray();
382     
383     /**
384      * Field HTTP_REQ_TYPE
385      */

386     public static final String JavaDoc HTTP_REQ_TYPE = "HTTP_REQ_TYPE";
387     
388     public static final String JavaDoc HTTPOutTransportInfo = "HTTPOutTransportInfo";
389     public static final String JavaDoc MTOM_RECIVED_CONTENT_TYPE = "MTOM_RECEIVED";
390
391        /**
392         * Default content encoding chatset
393         */

394          public static final String JavaDoc HTTP_ELEMENT_CHARSET = "US-ASCII";
395
396     /**
397        * Method getBytes
398        * @param data
399        * @return
400        */

401        public static byte[] getBytes(final String JavaDoc data) {
402           if (data == null) {
403               throw new IllegalArgumentException JavaDoc("Parameter may not be null");
404           }
405
406           try {
407               return data.getBytes(HTTP_ELEMENT_CHARSET);
408           } catch (UnsupportedEncodingException JavaDoc e){
409
410           }
411               return data.getBytes();
412           }
413
414     
415 }
416
Popular Tags