I think I figured out the problem...case sensitivivity...
The HTTP header has upper/lower case char in the header name, but when you
use the HeaderParam annotation, you must give all lowercase. So the
following worked:
@GET
@Path("/get/{id}")
public Response getInfo(@HeaderParam("myheaderkeyname") String keyValue,
@PathParam(value = "id") String myid)
HG-1 wrote:
>
> Here is the HTTP packet:
>
> GET /test_ws/ws/get/guid-100 HTTP/1.1
> MyHeaderKeyName: testdata
> User-Agent: Java/1.6.0_11
> Host: localhost:8080
> Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
> Connection: keep-alive
>
>
>
>
>
>
> Sergey Beryozkin-2 wrote:
>>
>> Hi
>>
>> This should work in 2.1.4 without problems.
>> Can you post please on-the-wire representation of MyHeaderKeyName ?
>> Thanks, Sergey
>>
>> -----Original Message-----
>> From: HG-1 [mailto:[email protected]]
>> Sent: 18 March 2009 17:38
>> To: [email protected]
>> Subject: How to get HTTP header values for a REST app
>>
>>
>> All,
>>
>> How do I get HTTP header values for a REST interface.
>> I have tried to get HTTP header values in in my REST application using
>> CXF
>> 2.1.4 and 2.1.3 without success. Here is my method declaration.
>>
>> @GET
>> @Path("/get/{id}")
>> public Response getInfo(@HeaderParam("MyHeaderKeyName") String keyValue,
>> @PathParam(value = "id") String myid)
>>
>> I also tried:
>> @GET
>> @Path("/get/{id}")
>> public Response getInfo(@HeaderParam(value="MyHeaderKeyName") String
>> keyValue, @PathParam(value = "id") String myid)
>>
>> When my method is called, keyValue is always null.
>> Any suggestion would be helpful.
>>
>> Thanks for your help.
>> HG
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-get-HTTP-header-values-for-a-REST-app-tp225
>> 84486p22584486.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/How-to-get-HTTP-header-values-for-a-REST-app-tp22584486p22587756.html
Sent from the cxf-user mailing list archive at Nabble.com.