Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java Servlet Question

Options
  • 28-08-2012 12:31pm
    #1
    Registered Users Posts: 495 ✭✭


    I'm running a SOAP server in java on Google App Engine. According to the JAX-WS documentation, you can access the servlet context in a web service by including a WebServiceContext variable and annotating it with the @Resource annotation but that doesn't appear to work in the GAE server.

    The WebServiceContext is listed on the java class white page list - https://developers.google.com/appengine/docs/java/jrewhitelist - so I'm assuming it's possible. Has anyone done this successfully?
    @WebService
    public class MyWebService {
    
        @Resource
        private WebServiceContext wsContext;
    
        @WebMethod 
        public int setActive() {
    
            ServletContext servletContext = wsContext.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
            servletContext.setAttribute("active", Boolean.TRUE);
            return 0;
    
        }
    
    }
    


Comments

  • Moderators, Education Moderators Posts: 1,863 Mod ✭✭✭✭Slaanesh


    Do you need getters/setters for the annotated variable?


  • Registered Users Posts: 495 ✭✭tetsujin1979


    tried that, and also tried annotating the set function with the @Resource annotation, as was recommended on one stack overflow solutionm but still no joy

    I'm considering using the memcache api as an alternative.


Advertisement