Google Web Toolkit (Beta)
Search this site:

# Class Response

public class Response
extends Object
Wrapper which provides access to the components of an HTTP response.

### Required Module

Modules that use this class should inherit `com.google.gwt.http.HTTP`.

    <!--                                                                        -->
    <!-- Copyright 2007 Google Inc.                                             -->
    <!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
    <!-- may not use this file except in compliance with the License. You may   -->
    <!-- may obtain a copy of the License at                                    -->
    <!--                                                                        -->
    <!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
    <!--                                                                        -->
    <!-- Unless required by applicable law or agreed to in writing, software    -->
    <!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
    <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
    <!-- implied. License for the specific language governing permissions and   -->
    <!-- limitations under the License.                                         -->

    <module>
      <!-- other inherited modules, such as com.google.gwt.user.User -->
      <inherits name="com.google.gwt.http.HTTP"/>
      <!-- additional module settings -->
    </module>

## Methods

getHeader(String) | Returns the value of the requested header or null if the header was not specified.
getHeaders() | Returns an array of HTTP headers associated with this response.
getHeadersAsString() | Returns all headers as a single string.
getStatusCode() | Returns the HTTP status code that is part of this response.
getStatusText() | Returns the HTTP status message text.
getText() | Returns the text associated with the response.

## Method Detail

### getHeader

public abstract String getHeader(String header)
Returns the value of the requested header or null if the header was not specified.

#### Parameters

header
  the header to query for

#### Return Value

the value of response header

### getHeaders

public abstract Header[] getHeaders()
Returns an array of HTTP headers associated with this response.

#### Return Value

array of HTTP headers; returns zero length array if there are no headers

### getHeadersAsString

public abstract String getHeadersAsString()
Returns all headers as a single string. The individual headers are delimited by a CR (U+000D) LF (U+000A) pair. An individual header is formatted according to RFC 2616.

#### Return Value

all headers as a single string delimited by CRLF pairs

### getStatusCode

public abstract int getStatusCode()
Returns the HTTP status code that is part of this response.

#### Return Value

the HTTP status code

### getStatusText

public abstract String getStatusText()
Returns the HTTP status message text.

#### Return Value

the HTTP status message text

### getText

public abstract String getText()
Returns the text associated with the response.

#### Return Value

the response text