Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Pass Header Param #75

Closed
hamroune opened this Issue · 8 comments

4 participants

@hamroune

Hi all, trying to pass a header param by setting custom header like

GIN SERVICE

@Provides
@Singleton
public MyService getMyService() {
     MyService myService = GWT.create(MyService.class);

     String url = GWT.getHostPageBaseURL()+"someURI";

    Map<String,String> headers = new HashMap<String,String>();
    headers.put("X-CustomHeader", "123456789");
    Resource resource = new Resource(url, headers);

((RestServiceProxy) embixUserRestService).setResource(resource);
return embixUserRestService;
}

and MyService esi defined as RestService like this

//SERVICE
public interface MyService extends RestService{
@GET
void someMethodToCall(...);
}

it doen's work but by manipulating method directly it works perfect

Map headers = new HashMap();
headers.put("X-CustomHeader", "123456789");
Method method = new Resource(url, headers).get();
method.send(...);
it works perfectly.
thanks for efforts

@mkristian
Owner

I found a bug which prevents to pass the headers through to the request builder but only if you have a @Path annotation in your method. do you have such a @Path ?

@hamroune
@mkristian
Owner
@mkristian
Owner

92dbf97
should fix it. I leave it open since I did not add any unit-test for it.

@kylebutt
@mkristian
Owner

added a small testcase 4ba364a

@mkristian mkristian closed this
@mkristian
Owner
@lucastschmidt

Hey, thanks for the answer, I deleted my message because eventually I found out that the problem was related to JSONP, I was trying to connect in another port locally and that wasnt allowed and since no error was being reported I never thought about that.

The weird thing is that the webservice was "responding" to something, but still, after a few hours I did make it work.

Thanks for the attention, its a great lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.