Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Java Servlet Question

  • 28-08-2012 12:31PM
    #1
    Registered Users, Registered Users 2 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,699 Mod ✭✭✭✭Slaanesh


    Do you need getters/setters for the annotated variable?


  • Registered Users, Registered Users 2 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