You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by raja <ra...@meru.co.in> on 2017/05/17 09:55:10 UTC
Servlet Session Handling
hi all,
Is there any way to get/set session attribute(Session Handling) in camel
Servlet?
--
View this message in context: http://camel.465427.n5.nabble.com/Servlet-Session-Handling-tp5799692.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Servlet Session Handling
Posted by raja <ra...@meru.co.in>.
In the previous post I told about a Problem getting HttpSession after
JDBCComponent.
A little hack solve the Issue but I don't know its right way or not.
The HttpRequest is kept in one of the header named
"CamelHttpServletRequest".So after the JDBCComponent I try to get the
HttpSession from the Header.
Modified Code:
<route>
<from uri="servlet:login?httpMethodRestrict=POST"/>
<to uri="bean:sessionProcessor"/>
<setBody>JDBC_QUERY</setBody>
<to uri="jdbc:ds"/>
<to uri="bean:sessionProcessor1"/>
</route>
sessionProcessor:
HttpSession
session=exchange.getIn(HttpMessage.class).getRequest().getSession();
sessionProcessor1:
HttpServletRequest
req=(HttpServletRequest)exchange.getIn().getHeader("CamelHttpServletRequest");
HttpSession session=req.getSession();
--
View this message in context: http://camel.465427.n5.nabble.com/Servlet-Session-Handling-tp5799692p5799770.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Servlet Session Handling
Posted by raja <ra...@meru.co.in>.
Thank u bro,
It works Fine.
--
View this message in context: http://camel.465427.n5.nabble.com/Servlet-Session-Handling-tp5799692p5799765.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Servlet Session Handling
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah you can get that via HttpMessage which is the message
implementation when using camel-servlet.
HttpMessage hm = exchange.getIn(HttpMessage.class);
HttpSession = hm.getRequest().getSession();
On Wed, May 17, 2017 at 11:55 AM, raja <ra...@meru.co.in> wrote:
> hi all,
> Is there any way to get/set session attribute(Session Handling) in camel
> Servlet?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Servlet-Session-Handling-tp5799692.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2