I wrote a custom RpcRequestBuilder for authentication, much like this:
http://stuffthathappens.com/blog/2009/12/22/custom-http-headers-with-gwt-rpc
But i need every GWT RPC service to have my custom builder set before it is used or, if possible, tell GWT to use my version as default. How can i do this?
public static final UtilServiceAsync getInstance() {
if (instance == null) {
instance = (UtilServiceAsync) GWT.create(UtilService.class);
ServiceDefTarget target = (ServiceDefTarget) instance;
RpcRequestBuilder reqBuilder = new RpcRequestBuilder() {
@Override
protected RequestBuilder doCreate(String serviceEntryPoint) {
RequestBuilder rb = super.doCreate(serviceEntryPoint);
rb.setHeader("HEADER_SIGNATURE", "your token");
return rb;
}
};
target.setRpcRequestBuilder(reqBuilder);
//target.setServiceEntryPoint(GWT.getModuleBaseURL() + "springGwtServices/" + "utilService");
}
return instance;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With