You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by feh <ra...@berbee.com> on 2007/08/15 17:10:08 UTC
solution found
I did some digging, and I was able to get the ServletContext via:
MessageContext context = MessageContext.getCurrentMessageContext();
ServletContext servletContext =
(ServletContext)context.getProperty("transport.http.servletContext");
feh 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#a12163891
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: solution found
Posted by Deepal jayasinghe <de...@gmail.com>.
Have a look at
http://wso2.org/library/480
Thanks
Deepal
> I did some digging, and I was able to get the ServletContext via:
>
> MessageContext context = MessageContext.getCurrentMessageContext();
> ServletContext servletContext =
> (ServletContext)context.getProperty("transport.http.servletContext");
>
>
>
> feh 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
>>>
>>>
>>>
>> Than
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org