Hi Amila,
I could not find anywhere in the code that sets the property of
MC_HTTP_SERVLET.
But there is this MC_HTTP_SERVLETCONTEXT, which is set in
org.apache.axis2.deployment.WarBasedAxisConfigurator.setConfigContext(ConfigurationContext
configContext)
public void setConfigContext(ConfigurationContext configContext) {
super.setConfigContext(configContext);
// setting ServletContext into configctx
configContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT,
config.getServletContext());
// setting ServletContext into configctx
configContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT,
config.getServletContext());
Parameter servletConfigParam = new Parameter();
servletConfigParam.setName(HTTPConstants.HTTP_SERVLETCONFIG);
servletConfigParam.setValue(config);
try {
configContext.getAxisConfiguration
().addParameter(servletConfigParam);
} catch (AxisFault axisFault) {
log.error(axisFault.getMessage(), axisFault);
}
}
(Though it is set twice there by mistake. May be it was meant for something
else.)
Upul
On 8/17/07, Amila Suriarachchi <[EMAIL PROTECTED]> wrote:
>
> Are you running on Tomcat?
> To use this attribute you should deploy the Axis2 war distribution.
>
> Amila.
>
> On 8/15/07, feh < [EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > Raghu Upadhyayula wrote:
> > >
> > > Hi Feh,
> > >
> > > You can get the ServletContext as follows (In Axis 1.3). Which
> > > Axis version are you using?
> > > For Axis 1.3
> > > MessageContext context = MessageContext.getCurrentContext ();
> > > HttpServlet servlet =
> > > (HttpServlet)context.getProperty(HTTPConstants.MC_HTTP_SERVLET);
> > > ServletContext servletContext = servlet.getServletContext();
> > >
> > > For Axis2 1.2
> > > MessageContext context =
> > > MessageContext.getCurrentMessageContext();
> > > HttpServlet servlet =
> > > (HttpServlet)context.getProperty(HTTPConstants.MC_HTTP_SERVLET);
> > > ServletContext servletContext = servlet.getServletContext();
> > >
> > > Thanks
> > > Raghu
> > >
> > >
> >
> > Thanks Raghu.
> >
> > I'm using Axis2...I gave the code above a try, and while I am able to
> > get
> > the MessageContext, when I try to get the MC_HTTP_SERVLET property, the
> > return value is null.
> >
> > Any guesses as to why?
> >
> > --
> > View this message in context:
> > http://www.nabble.com/access-to-ServletConfig-from-service-class-tf4269706.html#a12163073
> >
> > Sent from the Axis - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.