Package com.google.gwt.http.client

Examples of com.google.gwt.http.client.Response


public class AuthenticationFailureHandler implements RequestEvent.Handler {
  private String lastSeenUser = null;
 
  public void onRequestEvent(RequestEvent requestEvent) {
    if (requestEvent.getState() == State.RECEIVED) {
      Response response = requestEvent.getResponse();
      if (response == null) {
        // We should only get to this state if the RPC failed, in which
        // case we went through the RequestCallback.onError() code path
        // already and we don't need to do any additional error handling
        // here, but we don't want to throw further exceptions.
        return;
      }
      if (Response.SC_UNAUTHORIZED == response.getStatusCode()) {
        String loginUrl = response.getHeader("login");
        Location.replace(loginUrl);
      }
      String newUser = response.getHeader("userId");
      if (lastSeenUser == null) {
        lastSeenUser = newUser;
      } else if (!lastSeenUser.equals(newUser)) {
        // A new user has logged in, just reload the app and start over
        Location.reload();
View Full Code Here

TOP

Related Classes of com.google.gwt.http.client.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.