GWT RPC response head

Is there a way to read the header information received by the GWT client in the RPC response?

Response header
Server Apache-Coyote/1.1
Set-Cookie JSESSIONID=3379B1E57BEB2FE227EDC1F57BF550ED; Path=/GWT
Content- Encoding gzip
Content-Disposition attachment
Content-Type application/json;charset=utf-8
Content-Length 209
Date Fri, 05 Nov 2010 13:07:31 GMT

I am particularly interested in determining when the client receives the Set-Cookie attribute on its header.

Is there a way to do this on GWT?

I found it

com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter

exists Method

public void onResponseReceived(Request request, Response response) {... }

There seems to be the information I need in the parameter Response. This is there Some way to get GWT compiler code without “wringing”?

Thank you

JuDaC

You can try to overwrite RpcRequestBuilder.doSetCallback method and force your service to use it:

MyServiceAsync service = GWT.create(MyService.clas);
((ServiceDefTarget) service ).setRpcRequestBuilder(new RpcRequestBuilder() {
@Override
protected void doSetCallback(RequestBuilder rb, final RequestCallback callback) {
super.doSetCallback(rb, new RequestCallback() {

@Override
public void onResponseReceived(Request request, Response response) {
String headerValue = response.getHeader("my-header");
// do sth...
callback.onResponseReceived(request, response);
}

@Override
public void onError(Request request, Throwable exception) {
callback.onError (request, exception);
}
});
}
});

Inspired by http://stuffthathappens.com/blog/2009/12/22/custom-http-headers-with-gwt-rpc/

Is there a way to read the header information received by the GWT client in the RPC response?

Response header
Server Apache-Coyote/1.1
Set-Cookie JSESSIONID=3379B1E57BEB2FE227EDC1F57BF550ED; Path=/GWT
Content- Encoding gzip
Content-Disposition attachment
Content-Type application/json;charset=utf-8
Content-Length 209
Date Fri, 05 Nov 2010 13:07:31 GMT

I am particularly interested in determining when the client receives the Set-Cookie attribute on its header.

Is there a way to do this on GWT?

I found it

com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter

exists Method

public void onResponseReceived(Request request, Response response) {... }

There seems to be the information I need in the parameter Response. This is there Some way to get GWT compiler code without “wringing”?

Thank you

JuDaC

You can try to override the RpcRequestBuilder.doSetCallback method and force your service to use it:

MyServiceAsync service = GWT.create(MyService.clas);
((ServiceDefTarget) service).setRpcRequestBuilder(new RpcRequestBuilder() {
@Override
protected void doSetCallback(RequestBuilder rb, final RequestCallback callback) {
super.doSetCallback(rb, new RequestCallback() {

@Override
public void onResponseReceived(Request request, Response response) {
String headerValue = response.getHeader("my-header");
// do sth...
callback.onResponseReceived(request, response) ;
}

@Override
public void onError(Request request, Throwable exception) {
callback.onError(request, exception);
}< br /> });
}
});

Subject to http://stuffthathappens.com/b Inspiration from log/2009/12/22/custom-http-headers-with-gwt-rpc/

Leave a Comment

Your email address will not be published.