Java Code Examples for com.google.gwt.http.client.Response.getHeader()

The following are Jave code examples for showing how to use getHeader() of the com.google.gwt.http.client.Response class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: che   File: AsyncRequestCallback.java   View Source Code Vote up 5 votes
private void handleFailure(Response response) {
  Exception exception;
  String contentType = response.getHeader(CONTENT_TYPE);

  if (contentType != null && !contentType.contains(APPLICATION_JSON)) {
    String message = generateErrorMessage(response);
    exception = new Exception(message);
  } else {
    exception = new ServerException(response);
  }
  onFailure(exception);
}
 
Example 2
Project: che   File: LocationUnmarshaller.java   View Source Code Vote up 4 votes
/** {@inheritDoc} */
public void unmarshal(Response response) throws UnmarshallerException {
  result = response.getHeader("Location");
}
 
Example 3
Project: gerrit   File: RestApi.java   View Source Code Vote up 4 votes
private static boolean isContentType(Response res, String want) {
  String type = res.getHeader("Content-Type");
  return type != null && want.equals(simpleType(type));
}