Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not available in a maven repo #3

Open
tbee opened this issue Sep 22, 2013 · 10 comments
Open

Not available in a maven repo #3

tbee opened this issue Sep 22, 2013 · 10 comments

Comments

@tbee
Copy link

tbee commented Sep 22, 2013

I really like the fluent API that Rapa uses, but a downloadable jar would be highly required (I don't think I can access file:///home/hari/jsg/code-repo/maven-repository ;-) but even better would be uploading it to Maven central.

@harikrishnan83
Copy link
Owner

Thanks Tom. I will start work on uploading it to Maven Central.

@harikrishnan83
Copy link
Owner

Hi Tom,

I have uploaded rapa on a Github maven repository and I have updated the instructions with maven repo url in the link below.
https://github.com/harikrishnan83/rapa/wiki/Documentation

I will continue working on pushing the library to Maven Central.

Thanks,
HariKrishnan

@tbee
Copy link
Author

tbee commented Sep 28, 2013

Thanks!

By now I've already started using raw connections via Apache HttpClient, because I need to add signature headers to the request. Does Rapa expose the request object so I can do that? Then I may migrate to Rapa (the fluent API still is very luring :-)

Tom

On 2013-09-26 20:37, HariKrishnan wrote:

Hi Tom,

I have uploaded rapa on a Github maven repository and I have updated the instructions with maven repo url in the link below.
https://github.com/harikrishnan83/rapa/wiki/Documentation

I will continue working on pushing the library to Maven Central.

Thanks,
HariKrishnan


Reply to this email directly or view it on GitHub #3 (comment).

@harikrishnan83
Copy link
Owner

Hi Tom,

Sorry, Rapa currently does not expose the request object. If you can paste a sample of what you are trying achieve, I would be glad to see if we can make modifications to Rapa. Pull requests are welcome as well. :)

Thanks,
HariKrishnan

@tbee
Copy link
Author

tbee commented Sep 30, 2013

This is code that I've written on top of Apache's HttpClient using the example code I got from BOL, basically I need to be able to set and get headers.

         final HttpGet request = new HttpGet("https://plazaapi.bol.com/services/rest/orders/v1/open");
         request.addHeader("Content-MD5", "MD5");
         request.addHeader("Content-Type", "application/xml");
         request.addHeader("X-BOL-Date", "Tue, 15 Aug 2013 08:12:31 GMT");
         final String stringToSign = AuthUtils.createStringToSign(request);
         final String signedString = AuthUtils.calculateRFC2104HMAC(stringToSign, PRIVATE_KEY);
         request.addHeader("X-BOL-Authorization", PUBLIC_KEY + ":" + signedString);
         request.addHeader("Accept", "application/xml");

I must mention that this code is not working yet, I'm still on it with BOL to get it going. So there may be more.

Tom

@harikrishnan83
Copy link
Owner

Thanks Tom. I will add support in rapa to set and get headers.

Regards,
HariKrishnan

@harikrishnan83
Copy link
Owner

Hi Tom,

I have added the support for setting request headers. Below are the instructions.

  1. Add rapa 0.9.2 to your dependencies

              <repositories>
                  <repository>
                    <id>rapa</id>
                    <url>https://github.com/harikrishnan83/maven-repository/raw/master/</url>
                  </repository>
              </repositories>
    
              <dependencies>
                <dependency>
                  <groupId>org.rest.rapa</groupId>
                  <artifactId>rapa</artifactId>
                  <version>0.9.1</version>
                  <scope>compile</scope>
                </dependency>
              </dependencies>
    
  2. Set request headers

            RestClient restClient = new RestClientBuilder().withUrl("http://localhost:3000/customers")
            .withUserName("username")
            .withPassword("password")
            .withFormatHandler(new JSonHandler())
            .build();
    
    Map<String, String> headers = new HashMap<String, String>();
    headers.put("Content-MD5", "MD5");
    headers.put("Content-Type", "application/xml");
    Resource user = restClient.getById(1, User.class, headers);
    

Hope this helps.

Thanks,
HariKrishnan

@harikrishnan83
Copy link
Owner

Hi Tom,

Let me know if you need any changes on the headers change I have explained in my previous response.

Thanks and Regards,
HariKrishnan

@tbee
Copy link
Author

tbee commented Oct 10, 2013

Yes, will do. Currently I'm not actively working on the project, but had to switch to more urgent matters.

On 2013-10-10 11:53, HariKrishnan wrote:

Hi Tom,

Let me know if you need any changes on the headers change I have explained in my previous response.

Thanks and Regards,
HariKrishnan


Reply to this email directly or view it on GitHub #3 (comment).

@harikrishnan83
Copy link
Owner

No worries. Please take your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants