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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java Servlet Question

  • 28-08-2012 11:31am
    #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,863 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