KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > http > client > Response


1 /*
2  * Copyright 2006 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * 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, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.http.client;
17
18 /**
19  * Wrapper which provides access to the components of an HTTP response.
20  *
21  * <h3>Required Module</h3>
22  * Modules that use this class should inherit
23  * <code>com.google.gwt.http.HTTP</code>.
24  *
25  * {@gwt.include com/google/gwt/examples/http/InheritsExample.gwt.xml}
26  */

27 public abstract class Response {
28   /**
29    * Returns the value of the requested header or null if the header was not
30    * specified.
31    *
32    * @param header the header to query for
33    * @return the value of response header
34    *
35    * @throws IllegalArgumentException if the header name is empty
36    * @throws NullPointerException if the header name is null
37    */

38   public abstract String JavaDoc getHeader(String JavaDoc header);
39
40   /**
41    * Returns an array of HTTP headers associated with this response.
42    *
43    * @return array of HTTP headers; returns zero length array if there are no
44    * headers
45    */

46   public abstract Header[] getHeaders();
47
48   /**
49    * Returns all headers as a single string. The individual headers are
50    * delimited by a CR (U+000D) LF (U+000A) pair. An individual header is
51    * formatted according to <a HREF="http://ietf.org/rfc/rfc2616"> RFC 2616</a>.
52    *
53    * @return all headers as a single string delimited by CRLF pairs
54    */

55   public abstract String JavaDoc getHeadersAsString();
56
57   /**
58    * Returns the HTTP status code that is part of this response.
59    *
60    * @return the HTTP status code
61    */

62   public abstract int getStatusCode();
63
64   /**
65    * Returns the HTTP status message text.
66    *
67    * @return the HTTP status message text
68    */

69   public abstract String JavaDoc getStatusText();
70
71   /**
72    * Returns the text associated with the response.
73    *
74    * @return the response text
75    */

76   public abstract String JavaDoc getText();
77 }
78
Popular Tags