01: /*
02: * Copyright 2006 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: * The primary interface a caller must implement to receive a response to a
20: * {@link com.google.gwt.http.client.Request}.
21: *
22: * <h3>Required Module</h3>
23: * Modules that use this interface should inherit
24: * <code>com.google.gwt.http.HTTP</code>.
25: *
26: * {@gwt.include com/google/gwt/examples/http/InheritsExample.gwt.xml}
27: */
28: public interface RequestCallback {
29: /**
30: * Called when a pending {@link com.google.gwt.http.client.Request} completes
31: * normally. Note this method is called even when the status code of the
32: * HTTP response is not "OK", 200.
33: *
34: * @param request the object that generated this event
35: * @param response an instance of the
36: * {@link com.google.gwt.http.client.Response} class
37: */
38: void onResponseReceived(Request request, Response response);
39:
40: /**
41: * Called when a {@link com.google.gwt.http.client.Request} does not complete
42: * normally. A {@link com.google.gwt.http.client.RequestTimeoutException RequestTimeoutException} is
43: * one example of the type of error that a request may encounter.
44: *
45: * @param request the request object which has experienced the error condition
46: * @param exception the error that was encountered
47: */
48: void onError(Request request, Throwable exception);
49: }
|