Reaching RequestContext from session?

Help
khandur
2009-05-06
2013-04-29
  • khandur
    khandur
    2009-05-06

    Hi people!

    I´m in a servlet, and I need to reach a instance of com.tonbeller.wcf.controller.RequestContext. How can I reach a instance of this object from servlet, using HttpSession?

    I´m tryng to make JPivot work with another chart´s component, so I need a RequestContext do reach the locale of my mondrianQuery.

    Thanks in advance!

     
    • Andreas Voss
      Andreas Voss
      2009-05-06

      The RequestContext is created and destroyed in every Request. Inside a Request you can access it as a thread local variable via

      RequestContext.instance()

      But since you write your own servlet, you have to create and destroy the context via:

      doGet(request, response) {
          RequestContext context = RequestContextFactoryFinder.createContext(request, response, true);
          try {
            // process request here
          } finally {
            context.invalidate();
          }
      }

      Regards,
      Andreas

       
    • khandur
      khandur
      2009-05-06

      Thanks a lot!!!