axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shantanu chawla <shantanuchawl...@gmail.com>
Subject Re: How to get hold of current servlet context and session in axis 1.2
Date Wed, 17 Aug 2005 19:50:37 GMT
it worked !
 Thanks
 Shantanu

 On 8/17/05, Javier Gonzalez <jagonzal@gmail.com> wrote: 
> 
> If I see it right, you are missing a step.
> 
> This instruction:
> (HttpSession)messageContext.getProperty( 
> HTTPConstants.MC_HTTP_SERVLETREQUEST);
> 
> will return a HttpServletRequest object, not a HttpSessionObject.
> 
> You need to do:
> HttpSession session =((HttpServletRequest)messageContext.getProperty(
> HTTPConstants.MC_HTTP_SERVLETREQUEST)).getSession();
> 
> On 8/17/05, shantanu chawla <shantanuchawla74@gmail.com> wrote:
> > my webservice running is axis1.2RC3 needs to access current servlet 
> session
> > and servletContext. I believe axis is running as a servlet so I can get 
> hold
> > of the session and servlet context.
> >
> > I am using this code:
> >
> >
> >
> > MessageContext messageContext =
> > MessageContext.getCurrentContext();
> >
> > HttpServlet servlet =
> > (HttpServlet)messageContext.getProperty(HTTPConstants.MC_HTTP_SERVLET);
> > ServletContext servletContext =
> > (ServletContext)servlet.getServletContext();
> >
> > HttpSession session
> > =(HttpSession)messageContext.getProperty(
> > HTTPConstants.MC_HTTP_SERVLETREQUEST);
> >
> > I am getting java.lang.ClassCastException on casting to HttpSession. I 
> am
> > doing the right thing
> >
> > Thanks
> >
> > Shantanu Chawla
> >
> >
> > --
> > Graduate Student
> > Department of Computer Science,
> > San Diego State University
> 
> 
> --
> Javier Gonzalez Nicolini
> 



-- 
Graduate Student 
Department of Computer Science,
San Diego State University

Mime
View raw message