cancel
Showing results for 
Search instead for 
Did you mean: 

REST

krigu
Champ in-the-making
Champ in-the-making
I'm new to Activiti and after playing around a bit I'm trying to call the REST-services from a GWT-built web application.

I can call the login service (http://localhost:8080/activiti-rest/service/) and get the response  {"success":true}

After that call i build a new RequestBuilder and set the properties username/password. This results in the request URL http://kermit:kermit@localhost:8080/activiti-rest/service/process-engine. However I always get a 403 Forbidden response.

Thanks for you help

btw: Thanks for your great work on Activity!
5 REPLIES 5

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
please search the forum. Passing credentials in rest is done in another way…

smee82
Champ in-the-making
Champ in-the-making
You have to use Http Basic Authentication with each Request you drop.

http://en.wikipedia.org/wiki/Basic_access_authentication

krigu
Champ in-the-making
Champ in-the-making
Thank you for the responses. I was able to solve the problem.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
and exactly how did you solve the problem (so others can find it easily as well)

krigu
Champ in-the-making
Champ in-the-making
Sorry for the late replay, I enjoyed a few days off.

To use the REST-API you have to modify the request header and add "Authorization" (Key) and "Basic usernameSmiley Tongueassword" (Value). The username and the password need to be encoded with the Base64 algorithm.

Here is a small GWT code snipped:

    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, hostname + RequestURI);
    builder.setHeader("Authorization", "Basic "
        + Base64.encode(username.getValueAsString()
          + ":" + password.getValueAsString()));