Hi there

I am trying to make a REST call through HTTPS and read the response
headers. Even though the response text (response.getText()) has
absolutely no problem, getHeaders() throws a NullPointerException:

java.lang.NullPointerException: null
    at com.google.gwt.http.client.Request.getHeaders(Request.java:88)
    at com.google.gwt.http.client.Request.access$0(Request.java:86)
    at com.google.gwt.http.client.Request$1.getHeaders(Request.java:
53)
    at com.bc.adminconsole.client.shared.core.services.ServiceBase
$1.onResponseReceived(ServiceBase.java:76)
    at
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
287)
    at com.google.gwt.http.client.RequestBuilder
$1.onReadyStateChange(RequestBuilder.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)


My code is mostly like this (RestService creates a RequestBuilder when
calling ()).

RestService restService = new RestService(requestUri, requestMethod,
requestBody, authToken);

RequestCallback r = new RequestCallback() {
        @Override
        public void onResponseReceived(Request request, Response response) {
                int responseStatusCode = response.getStatusCode();
                if (responseStatusCode != Response.SC_OK && responseStatusCode 
!=
Response.SC_CREATED) {
                        // ... stuff ...
                } else {
                        headers = response.getHeaders();
                        T result = reader.read(response.getText());

                        resultCallback.onSuccess(result);
                }
        }

        // ... stuff ...
};

restService.setCallback(r);
restService.send();

Any ideas why getHeaders() would return null even though my request
has statusCode 201 and everything else is OK?

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to