You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tapdur <ta...@gmail.com> on 2010/03/01 19:03:11 UTC

restlet header

Hi

i am trying to get a specific application header in my http request over
restlet and it always null why ?

here is the client request :
GET http://127.0.0.1/greeting HTTP/1.0
Accept: xml/application
IGC-E164: 3370301169
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 127.0.0.1


here is my log trace : Logger.process : 59eacefd-b77f-4b33-be04-22d0978587ce
>>> (route1) from(http://127.0.0.1:80/greeting) --> ref:greeting <<<
Pattern:InOut, Headers:{org.restlet.startTime=1267465996121,
org.restlet.http.headers=[Accept: xml/application, IGC-E164: 3370301169,
User-Agent: Jakarta Commons-HttpClient/3.1, Host: 127.0.0.1],
CamelHttpMethod=GET, CamelHttpUri=http://127.0.0.1/greeting,
org.restlet.http.version=HTTP/1.0}, BodyType:null, Body:null


And i want to get the IGC-E164 header attribute


here are the  code wich always failed

1 / 
    	Map<String, Object> hdrs = (HashMap<String, Object>)
exchange.getIn().getHeaders();
    	Map<String, Object> httpHeaders = (HashMap<String, Object>)
hdrs.get("org.restlet.http.headers");
    	String e164 = (String ) httpHeaders.get("IGC-E164");



2/ String e164 = (String ) exchange.getIn().getHeader("IGC-E164");

It is not very clear in the documentation, what i have missed ?

Thk

Bruno



-- 
View this message in context: http://old.nabble.com/restlet-header-tp27746948p27746948.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: restlet header

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Take a look at some of the unit tests in camel-restlet. I wonder if
any of those shows how to use headers?

And try with a simple header without using dots (generally a bad think
to do as keys).


On Mon, Mar 1, 2010 at 7:03 PM, Tapdur <ta...@gmail.com> wrote:
>
> Hi
>
> i am trying to get a specific application header in my http request over
> restlet and it always null why ?
>
> here is the client request :
> GET http://127.0.0.1/greeting HTTP/1.0
> Accept: xml/application
> IGC-E164: 3370301169
> User-Agent: Jakarta Commons-HttpClient/3.1
> Host: 127.0.0.1
>
>
> here is my log trace : Logger.process : 59eacefd-b77f-4b33-be04-22d0978587ce
>>>> (route1) from(http://127.0.0.1:80/greeting) --> ref:greeting <<<
> Pattern:InOut, Headers:{org.restlet.startTime=1267465996121,
> org.restlet.http.headers=[Accept: xml/application, IGC-E164: 3370301169,
> User-Agent: Jakarta Commons-HttpClient/3.1, Host: 127.0.0.1],
> CamelHttpMethod=GET, CamelHttpUri=http://127.0.0.1/greeting,
> org.restlet.http.version=HTTP/1.0}, BodyType:null, Body:null
>
>
> And i want to get the IGC-E164 header attribute
>
>
> here are the  code wich always failed
>
> 1 /
>        Map<String, Object> hdrs = (HashMap<String, Object>)
> exchange.getIn().getHeaders();
>        Map<String, Object> httpHeaders = (HashMap<String, Object>)
> hdrs.get("org.restlet.http.headers");
>        String e164 = (String ) httpHeaders.get("IGC-E164");
>
>
>
> 2/ String e164 = (String ) exchange.getIn().getHeader("IGC-E164");
>
> It is not very clear in the documentation, what i have missed ?
>
> Thk
>
> Bruno
>
>
>
> --
> View this message in context: http://old.nabble.com/restlet-header-tp27746948p27746948.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus