001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019:
020: package org.apache.axis2.transport.http;
021:
022: import java.io.UnsupportedEncodingException;
023:
024: /**
025: * HTTP protocol and message context constants.
026: */
027: public class HTTPConstants {
028:
029: public static final String HTTP_CONTENT_TYPE = "HTTP_CONTENT_TYPE";
030: public static final String PROTOCOL_VERSION = "PROTOCOL";
031: public static final String MEDIA_TYPE_X_WWW_FORM = "application/x-www-form-urlencoded";
032: public static final String MEDIA_TYPE_TEXT_XML = "text/xml";
033: public static final String MEDIA_TYPE_MULTIPART_RELATED = "multipart/related";
034: public static final String MEDIA_TYPE_MULTIPART_FORM_DATA = "multipart/form-data";
035: public static final String MEDIA_TYPE_APPLICATION_XML = "application/xml";
036: public static final String MEDIA_TYPE_APPLICATION_SOAP_XML = "application/soap+xml";
037: public static final String MEDIA_TYPE_APPLICATION_ECHO_XML = "application/echo+xml";
038:
039: /**
040: * Field REQUEST_URI
041: */
042: public static final String REQUEST_URI = "REQUEST_URI";
043:
044: /**
045: * Field RESPONSE_CODE
046: */
047: public static final String RESPONSE_CODE = "RESPONSE_CODE";
048:
049: /**
050: * Field RESPONSE_WORD
051: */
052: public static final String RESPONSE_WORD = "RESPONSE_WORD";
053:
054: /**
055: * Field RESPONSE_ACK_CODE_VAL
056: */
057: public static final String RESPONSE_ACK_CODE_VAL = "202";
058:
059: /**
060: * Field SOCKET
061: */
062: public static final String SOCKET = "SOCKET";
063:
064: /**
065: * Field RESPONSE_HEADERS
066: */
067: public static final String RESPONSE_HEADERS = "HTTP-Response-Headers";
068:
069: /**
070: * Field REQUEST_HEADERS
071: */
072: public static final String REQUEST_HEADERS = "HTTP-Request-Headers";
073:
074: /**
075: * Field PLUGIN_WRITER
076: */
077: public static final String PLUGIN_WRITER = "transport.http.plugin.writer";
078:
079: /**
080: * Field PLUGIN_SERVICE_NAME
081: */
082: public static final String PLUGIN_SERVICE_NAME = "transport.http.plugin.serviceName";
083:
084: /**
085: * AXIS servlet plugin parameter names.
086: */
087: public static final String PLUGIN_NAME = "transport.http.plugin.pluginName";
088:
089: /**
090: * Field PLUGIN_LOG
091: */
092: public static final String PLUGIN_LOG = "transport.http.plugin.log";
093:
094: /**
095: * Field PLUGIN_IS_DEVELOPMENT
096: */
097: public static final String PLUGIN_IS_DEVELOPMENT = "transport.http.plugin.isDevelopment";
098:
099: /**
100: * Field PLUGIN_EXCEPTION_LOG
101: */
102: public static final String PLUGIN_EXCEPTION_LOG = "transport.http.plugin.exceptionLog";
103:
104: /**
105: * Field PLUGIN_ENGINE
106: */
107: public static final String PLUGIN_ENGINE = "transport.http.plugin.engine";
108:
109: /**
110: * Field PLUGIN_ENABLE_LIST
111: */
112: public static final String PLUGIN_ENABLE_LIST = "transport.http.plugin.enableList";
113:
114: /**
115: * Field OK[]
116: */
117: public static final char OK[] = ("200 OK").toCharArray();
118:
119: /**
120: * Field NOCONTENT[]
121: */
122: public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
123:
124: /**
125: * Field MC_HTTP_STATUS_MESSAGE
126: */
127: public static String MC_HTTP_STATUS_MESSAGE = "transport.http.statusMessage";
128:
129: /**
130: * Field MC_HTTP_STATUS_CODE
131: */
132: public static String MC_HTTP_STATUS_CODE = "transport.http.statusCode";
133:
134: /**
135: * Field MC_HTTP_SERVLETRESPONSE
136: */
137: public static String MC_HTTP_SERVLETRESPONSE = "transport.http.servletResponse";
138:
139: /**
140: * Field MC_HTTP_SERVLETREQUEST
141: */
142: public static String MC_HTTP_SERVLETREQUEST = "transport.http.servletRequest";
143:
144: /**
145: * Field MC_HTTP_SERVLETPATHINFO
146: */
147: public static String MC_HTTP_SERVLETPATHINFO = "transport.http.servletPathInfo";
148:
149: /**
150: * Field MC_HTTP_SERVLETLOCATION
151: */
152: public static String MC_HTTP_SERVLETLOCATION = "transport.http.servletLocation";
153:
154: /**
155: * Field MC_HTTP_SERVLET
156: */
157: public static String MC_HTTP_SERVLET = "transport.http.servlet";
158:
159: /**
160: * Field MC_HTTP_SERVLETCONTEXT
161: */
162: public static String MC_HTTP_SERVLETCONTEXT = "transport.http.servletContext";
163:
164: /**
165: * transport.http.servletConfig
166: */
167: public static String HTTP_SERVLETCONFIG = "transport.http.servletConfig";
168:
169: /**
170: * Field HEADER_USER_AGENT
171: */
172: public static final String HEADER_USER_AGENT = "User-Agent";
173:
174: /**
175: * Field HEADER_TRANSFER_ENCODING_CHUNKED
176: */
177: public static final String HEADER_TRANSFER_ENCODING_CHUNKED = "chunked"
178: .intern();
179:
180: /* http 1.1 */
181:
182: /**
183: * Field HEADER_TRANSFER_ENCODING
184: */
185: public static final String HEADER_TRANSFER_ENCODING = "Transfer-Encoding"
186: .intern();
187:
188: /**
189: * Field HEADER_SOAP_ACTION
190: */
191: public static final String HEADER_SOAP_ACTION = "SOAPAction";
192:
193: /**
194: * Field HEADER_SET_COOKIE2
195: */
196: public static final String HEADER_SET_COOKIE2 = "Set-Cookie2";
197:
198: /**
199: * Field HEADER_SET_COOKIE
200: */
201: public static final String HEADER_SET_COOKIE = "Set-Cookie";
202:
203: /**
204: * Field HEADER_PROXY_AUTHORIZATION
205: */
206: public static final String HEADER_PROXY_AUTHORIZATION = "Proxy-Authorization";
207:
208: /**
209: * Field HEADER_PROTOCOL_V11
210: */
211: public static final String HEADER_PROTOCOL_V11 = "1.1".intern();
212:
213: /**
214: * Field HEADER_PROTOCOL_V10
215: */
216: public static final String HEADER_PROTOCOL_V10 = "1.0".intern();
217:
218: /**
219: * Field HEADER_PROTOCOL_11
220: */
221: public static final String HEADER_PROTOCOL_11 = "HTTP/1.1";
222:
223: /**
224: * Field HEADER_PROTOCOL_10
225: */
226: public static final String HEADER_PROTOCOL_10 = "HTTP/1.0";
227:
228: /**
229: * Field HEADER_PRAGMA
230: */
231: public static final String HEADER_PRAGMA = "Pragma";
232:
233: /**
234: * Field HEADER_POST
235: */
236: public static final String HEADER_POST = "POST";
237:
238: /**
239: * Field HEADER_PUT
240: */
241: public static final String HEADER_PUT = "PUT";
242:
243: /**
244: * Field HEADER_LOCATION
245: */
246: public static final String HEADER_LOCATION = "Location";
247:
248: /**
249: * Field HEADER_HOST
250: */
251: public static final String HEADER_HOST = "Host";
252:
253: /**
254: * Field HEADER_GET
255: */
256: public static final String HEADER_GET = "GET";
257:
258: /**
259: * Field HEADER_DELETE
260: */
261: public static final String HEADER_DELETE = "DELETE";
262:
263: /**
264: * Field HEADER_EXPECT_100_Continue
265: */
266: public static final String HEADER_EXPECT_100_Continue = "100-continue";
267:
268: /**
269: * Field HEADER_EXPECT
270: */
271: public static final String HEADER_EXPECT = "Expect";
272:
273: /**
274: * Field HEADER_DEFAULT_CHAR_ENCODING
275: */
276: public static final String HEADER_DEFAULT_CHAR_ENCODING = "iso-8859-1";
277:
278: /**
279: * Field HEADER_COOKIE2
280: */
281: public static final String HEADER_COOKIE2 = "Cookie2";
282:
283: /**
284: * Field HEADER_COOKIE
285: */
286: public static final String HEADER_COOKIE = "Cookie";
287:
288: /**
289: * Field HEADER_CONTENT_TYPE
290: */
291: public static final String HEADER_CONTENT_TYPE = "Content-Type";
292:
293: /**
294: * Field HEADER_CONTENT_TRANSFER_ENCODING
295: */
296: public static final String HEADER_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
297:
298: /**
299: * Field HEADER_CONTENT_LOCATION
300: */
301: public static final String HEADER_CONTENT_LOCATION = "Content-Location";
302:
303: /**
304: * Field HEADER_CONTENT_LENGTH
305: */
306: public static final String HEADER_CONTENT_LENGTH = "Content-Length";
307:
308: /**
309: * Field HEADER_CONTENT_ID
310: */
311: public static final String HEADER_CONTENT_ID = "Content-Id";
312:
313: /**
314: * Field HEADER_CONTENT_DESCRIPTION
315: */
316: public static final String HEADER_CONTENT_DESCRIPTION = "Content-Description";
317:
318: /**
319: * Field HEADER_CONNECTION_KEEPALIVE
320: */
321: public static final String HEADER_CONNECTION_KEEPALIVE = "Keep-Alive"
322: .intern();
323:
324: /**
325: * Field HEADER_CONNECTION_CLOSE
326: */
327: public static final String HEADER_CONNECTION_CLOSE = "close"
328: .intern();
329:
330: /**
331: * Field HEADER_CONNECTION
332: */
333: public static final String HEADER_CONNECTION = "Connection";
334:
335: /**
336: * Field HEADER_CACHE_CONTROL_NOCACHE
337: */
338: public static final String HEADER_CACHE_CONTROL_NOCACHE = "no-cache";
339:
340: /**
341: * Field HEADER_CACHE_CONTROL
342: */
343: public static final String HEADER_CACHE_CONTROL = "Cache-Control";
344:
345: /**
346: * Field HEADER_AUTHORIZATION
347: */
348: public static final String HEADER_AUTHORIZATION = "Authorization";
349:
350: /**
351: * Field HEADER_ACCEPT_TEXT_ALL
352: */
353: public static final String HEADER_ACCEPT_TEXT_ALL = "text/*";
354:
355: /**
356: * Field HEADER_ACCEPT_MULTIPART_RELATED
357: */
358: public static final String HEADER_ACCEPT_MULTIPART_RELATED = "multipart/related";
359:
360: /**
361: * Field HEADER_ACCEPT_APPL_SOAP
362: */
363: public static final String HEADER_ACCEPT_APPL_SOAP = "application/soap+xml";
364:
365: /**
366: * Field HEADER_ACCEPT_APPLICATION_DIME
367: */
368: public static final String HEADER_ACCEPT_APPLICATION_DIME = "application/dime";
369:
370: /**
371: * Field HEADER_ACCEPT
372: */
373: public static final String HEADER_ACCEPT = "Accept";
374:
375: /**
376: * Field CHAR_SET_ENCODING
377: */
378: public static String CHAR_SET_ENCODING = "charset";
379:
380: /**
381: * Field UNAUTH[]
382: */
383: public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
384:
385: /**
386: * Field SO_TIMEOUT
387: */
388: public static final String SO_TIMEOUT = "SO_TIMEOUT";
389:
390: /**
391: * Field SENDER[]
392: */
393: public static final byte SENDER[] = "400".getBytes();
394: public static final String PROXY = "PROXY";
395: public static final String AUTHENTICATE = "_NTLM_DIGEST_BASIC_AUTHENTICATION_";
396:
397: /**
398: * @deprecated
399: */
400: public static final String MTOM_RECEIVED_CONTENT_TYPE = "MTOM_RECEIVED";
401:
402: /**
403: * Field ISE[]
404: */
405: public static final byte ISE[] = ("500 Internal server error")
406: .getBytes();
407:
408: /**
409: * Field HTTP_REQ_TYPE
410: */
411: public static final String HTTP_REQ_TYPE = "HTTP_REQ_TYPE";
412:
413: /**
414: * Default content encoding chatset
415: */
416: public static final String HTTP_ELEMENT_CHARSET = "US-ASCII";
417:
418: /**
419: * Field HTTP[]
420: */
421: public static char HTTP[] = "HTTP/1.0 ".toCharArray();
422:
423: /**
424: * Field DEFAULT_SO_TIMEOUT
425: */
426: public static final int DEFAULT_SO_TIMEOUT = 60000;
427:
428: /**
429: * Field DEFAULT_CONNECTION_TIMEOUT
430: */
431: public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;
432:
433: /**
434: * Field CONNECTION_TIMEOUT
435: */
436: public static final String CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT";
437:
438: /**
439: * Field CACHED_HTTP_CLIENT
440: */
441: public static final String CACHED_HTTP_CLIENT = "CACHED_HTTP_CLIENT";
442:
443: public static final String MUTTITHREAD_HTTP_CONNECTION_MANAGER = "MUTTITHREAD_HTTP_CONNECTION_MANAGER";
444:
445: /**
446: * Field CACHED_HTTP_CLIENT
447: */
448: public static final String REUSE_HTTP_CLIENT = "REUSE_HTTP_CLIENT";
449:
450: /**
451: * Field HTTP_METHOD
452: */
453: public static final String HTTP_METHOD = "HTTP_METHOD_OBJECT";
454:
455: public static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding";
456: public static final String HEADER_CONTENT_ENCODING = "Content-Encoding";
457: public static final String HEADER_CONTENT_ENCODING_LOWERCASE = HEADER_CONTENT_ENCODING
458: .toLowerCase();
459:
460: public static final String COMPRESSION_GZIP = "gzip";
461:
462: /**
463: * If you want the HTTP sender to indicate that it can accept a gziped
464: * response, set this message context property to true. The sender will
465: * automatically unzip the response if its gzipped.
466: */
467: public static final String MC_ACCEPT_GZIP = "transport.http.acceptGzip";
468:
469: /**
470: * by default the HTTP request body is not compressed. set this message
471: * context property to true to have the request body gzip compressed.
472: */
473: public static final String MC_GZIP_REQUEST = "transport.http.gzipRequest";
474:
475: /* by default the HTTP response body is not compressed. set this message
476: * context property to true to have the response body gzip compressed.
477: */
478: public static final String MC_GZIP_RESPONSE = "gzipResponse";
479:
480: /**
481: * This will allow users to set any custom headers to the message context, which will be picked
482: * up by the sender while sending the request
483: */
484: public static final String HTTP_HEADERS = "HTTP_HEADERS";
485: public static final String CHUNKED = "__CHUNKED__";
486: public static final String HTTP_PROTOCOL_VERSION = "__HTTP_PROTOCOL_VERSION__";
487: //to set and get the property from service context
488: public static final String COOKIE_STRING = "Cookie";
489: public static final String HTTP_METHOD_GET = "GET";
490: public static final String HTTP_METHOD_POST = "POST";
491:
492: /**
493: * @deprecated Please use Constants.Configuration.CONTENT_TYPE
494: */
495: public static final String CONTENT_TYPE = "Content-Type";
496:
497: public static final String OMIT_SOAP_12_ACTION = "OmitSOAP12Action";
498: public static final String CUSTOM_PROTOCOL_HANDLER = "CUSTOM_PROTOCOL_HANDLER";
499:
500: /*
501: * Automatically release connections.
502: */
503: public static final String AUTO_RELEASE_CONNECTION = "AutoReleaseConnection";
504:
505: /**
506: * Method getBytes.
507: *
508: * @param data
509: * @return Returns byte[].
510: */
511: public static byte[] getBytes(final String data) {
512: if (data == null) {
513: throw new IllegalArgumentException(
514: "Parameter may not be null");
515: }
516:
517: try {
518: return data.getBytes(HTTP_ELEMENT_CHARSET);
519: } catch (UnsupportedEncodingException e) {
520: }
521:
522: return data.getBytes();
523: }
524:
525: public static final String USER_AGENT = "userAgent";
526: public static final String SERVER = "server";
527: }
|