Skip to main content



      Home
Home » Eclipse Projects » Lyo » OslcClient Locale (Accept-Language)
OslcClient Locale (Accept-Language) [message #1488174] Wed, 26 November 2014 06:20 Go to next message
Eclipse UserFriend
Would someone please provide me with sample code which sets the preferred Locale(s) for OslcClient requests?

I have a handle on the OslcClient object and I need to set the "Accept-Language" header sent within all OslcClient's HTTP request at run time. I know the OslcClient uses an HttpClient under the hood but I don't see any way to inject HTTP headers when a oslc resource is requested.

Thanks,
Matt
Re: OslcClient Locale (Accept-Language) [message #1494620 is a reply to message #1488174] Mon, 01 December 2014 11:16 Go to previous messageGo to next message
Eclipse UserFriend
Matt, it's not possible now unfortunately. You'd have to use Wink client directly.

I opened an enhancement, and I'm looking at it now.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=453782

Sam
Re: OslcClient Locale (Accept-Language) [message #1494721 is a reply to message #1494620] Mon, 01 December 2014 13:00 Go to previous messageGo to next message
Eclipse UserFriend
I believe I have a fix, available in this build:

https://hudson.eclipse.org/lyo/job/lyo-client-nightly/117/

You can now make calls like this:

    ChangeRequest bug =
        client.getResource("http://example.com/bugs/43",
                           Collections.singletonMap("Accept-Language", "da"))
              .getEntity(ChangeRequest.class);


Let me know if it works for you.

Edit: correct build link.

[Updated on: Mon, 01 December 2014 13:25] by Moderator

Re: OslcClient Locale (Accept-Language) [message #1718765 is a reply to message #1494721] Tue, 29 December 2015 17:59 Go to previous messageGo to next message
Eclipse UserFriend
Sam,

It works but it doesn't work for OslcOAuthClient's. I think someone needs implement an...

protected ClientResponse getResource(String url, Map<String, String> requestHeaders, String defaultMediaType) 
throws IOException, OAuthException, URISyntaxException;


In the OslcOAuthClient class. Further, all the getResource() methods in the OslcClient class need their signatures updated to include the following throws...

throws IOException, OAuthException, URISyntaxException


I've attached my updates for this scenario. Most of the code is a copy of your OslcClient.getResource(String, Map, String) method.

Best regards,
Matt
Re: OslcClient Locale (Accept-Language) [message #1720606 is a reply to message #1718765] Tue, 19 January 2016 12:21 Go to previous message
Eclipse UserFriend
Hi Matt,

My understanding is that we can't accept code attached to an email. Can you submit it as a Gerrit request associated with https://bugs.eclipse.org/bugs/show_bug.cgi?id=453782, or create a new bug for it?

Instructions for contributing via Gerrit are here: https://wiki.eclipse.org/Development_Resources/Contributing_via_Git#via_Gerrit
Let me know if you need any assistance and I'd be happy to help.

- Jim Ruehlin
Previous Topic:Error making POST call to DOORS[9.6] .
Next Topic:Bugzilla Consumer key/secret?
Goto Forum:
  


Current Time: Sun Mar 16 23:06:51 EDT 2025

Powered by FUDForum. Page generated in 0.21519 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top