Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lyo » OslcClient Locale (Accept-Language)
OslcClient Locale (Accept-Language) [message #1488174] Wed, 26 November 2014 11:20 Go to next message
Matt Stone is currently offline Matt StoneFriend
Messages: 46
Registered: August 2014
Member
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 16:16 Go to previous messageGo to next message
Samuel Padgett is currently offline Samuel PadgettFriend
Messages: 30
Registered: July 2009
Member
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 18:00 Go to previous messageGo to next message
Samuel Padgett is currently offline Samuel PadgettFriend
Messages: 30
Registered: July 2009
Member
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 18:25]

Report message to a moderator

Re: OslcClient Locale (Accept-Language) [message #1718765 is a reply to message #1494721] Tue, 29 December 2015 22:59 Go to previous messageGo to next message
Matt Stone is currently offline Matt StoneFriend
Messages: 8
Registered: September 2012
Junior Member
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 17:21 Go to previous message
Jim Ruehlin is currently offline Jim RuehlinFriend
Messages: 73
Registered: July 2009
Member
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: Tue Mar 19 08:17:32 GMT 2024

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

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

Back to the top