Marc Logemann wrote:
> Hi,
>
> in a webservice i need to get hold of an ServletContext because i need
> to load some resources for BIRT eclipse reporting.
> Is this possible somehow?
If you're creating your implementation object using Spring then the
easiest way is to implement the ServletContextAware interface and Spring
will inject it for you by calling setServletContext. Alternatively, you
can get a reference to the servlet context via the WebServiceContext
(this may only work during calls to your web service operations, if you
need access to the context before any of your WS methods have been
called, use ServletContextAware).
@Resource
private WebServiceContext ctx;
public String webServiceOperation(....) {
ServletContext sctx =
ctx.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
...
}
Ian
--
Ian Roberts | Department of Computer Science
[EMAIL PROTECTED] | University of Sheffield, UK