Tanks for the quick reply and the suggestions, but, I found a much
easier way to achieve what i want:
You can set the RPCRequestBuilder if you downcast the constructed
service:
service = GWT.create(Dispatch.class);
((ServiceDefTarget)
service).setRpcRequestBuilder(this.authenticatingRequestBuilder);
With and RPCRequestBuilder looking like this:
public class AuthenticatingRequestBuilder extends RpcRequestBuilder {
private final LoginProvider loginProvider;
@Inject
public AuthenticatingRequestBuilder(LoginProvider loginProvider) {
this.loginProvider = loginProvider;
}
@Override
protected RequestBuilder doCreate(String serviceEntryPoint) {
RequestBuilder requestBuilder = super.doCreate(serviceEntryPoint);
UserLogin userLogin = loginProvider.get();
if (userLogin != null) {
requestBuilder.setHeader("X-GWT-CRED", userLogin.getCredentials());
}
return requestBuilder;
}
}
- Daniel Kurka
On 3 Mai, 05:34, David Peterson <
da...@randombits.org> wrote:
> I guess one way would be to add a method that allows you to provide a
> Map<String, String> with any custom header values you want to send.
>
> The other thing is, why not just create a custom implementation of the
> DispatchService that handles the header settings, rather than putting it
> into the Async API. Have the service handle it behind the scenes...
>
> David
>