[jboss-dev-forums] [JBoss AS7 Development] - Re: Load on startup is ignored - JaxWS webservice is always initialized first
Jim Ma
do-not-reply at jboss.com
Wed Jul 27 02:32:54 EDT 2011
Jim Ma [http://community.jboss.org/people/jim.ma] created the discussion
"Re: Load on startup is ignored - JaxWS webservice is always initialized first"
To view the discussion, visit: http://community.jboss.org/message/617795#617795
--------------------------------------------------------------
If you do not have to call the custom initialization before the webservice constructor , this could help:
* call custom environment initialization in a ServletContextListener
* Get servletContext from injected webServiceContext like:
> @WebService
> public class HelloServletImpl implements HelloServlet {
> @Resource
> public WebServiceContext wsContext;
>
> public HelloServletImpl() {
> System.out.println("HelloServlet is instantiated!");
> }
>
> @Override
> public String newOperation(final String in) {
> // TODO Auto-generated method stub
> ServletContext servletContext =
> (ServletContext) wsContext.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
> System.out.println(servletContext.getAttribute("TEST"));
> return (String)servletContext.getAttribute("TEST");
> }
>
>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/617795#617795]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20110727/06e0bc0e/attachment.html
More information about the jboss-dev-forums
mailing list