Google Web Toolkit (Beta)
Search this site:

# Interface RequestCallback

public interface RequestCallback
The primary interface a caller must implement to receive a response to a Request.

### Required Module

Modules that use this interface 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

onError(Request, Throwable) | Called when a Request does not complete normally.
onResponseReceived(Request, Response) | Called when a pending Request completes normally.

## Method Detail

### onError

public void onError(Request request, Throwable exception)
Called when a Request does not complete normally. A RequestTimeoutException is one example of the type of error that a request may encounter.

#### Parameters

request
  the request object which has experienced the error condition
exception
  the error that was encountered

### onResponseReceived

public void onResponseReceived(Request request, Response response)
Called when a pending Request completes normally. Note this method is called even when the status code of the HTTP response is not "OK", 200.

#### Parameters

request
  the object that generated this event
response
  an instance of the Response class