Just to be sure, are you sure that your handler is only invoked for
incomming request? (I did this mistake and then run into an NPE as the
servlet request object is only available in the incomming flow, and I
tried to access it on the outgoing flow as well).
So this is my code which actually works for me:
if ( messageContext.getFLOW() == MessageContext.IN_FLOW ) {
// get servlet context, request object
final ServletContext servletContext = (ServletContext)
messageContext.getProperty(Constants.SERVLET_CONTEXT);
final HttpServletRequest request = (HttpServletRequest)
messageContext.getProperty(Constants.HTTP_SERVLET_REQUEST);
}
And they are both not null.
HTH
Carsten
heikki wrote:
> thanks for the tips, alas I'm still not getting the HttpServlet Request ..
>
> I tried, in the handler :
>
> 1. Deepal's tip :
>
> httpServletRequest = (HttpServletRequest) msgContext.getProperty(
> Constants.HTTP_SERVLET_REQUEST);
>
> 2. Robert's tip :
>
> httpServletRequest = (HttpServletRequest) msgContext.getOperationContext
> ().getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
>
> 3. those two combined :
>
> httpServletRequest = (HttpServletRequest) msgContext.getOperationContext
> ().getProperty(Constants.HTTP_SERVLET_REQUEST);
>
> In each case, I don't find the HttpServletContext, instead ending up with
> null.
>
> This being so, I do not fully understand this remark from Robert's post :
>
>
> "Its by design- you have to get the operation context from the outgoing
> MC and then get the incoming MC from that and look there for the servlet
> context and any other "incoming" info. "
>
> My handler is used to process incoming messages; how could I get things from
> outgoing MC at this stage ? Could you explain what is meant here?
>
> Does anyone have more advice on how I could obtain the HttpServletContext in
> a handler that operates on incoming messages? Surely this should be a quite
> easy task ..
>
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]