1 Reply Latest reply on Sep 24, 2010 4:10 AM by Neil Richardson

    Get context root when i have no servlet context

    Ronaldo Campos Newbie

      Hi,


      I have something like this:


      
      @Startup
      @Name("controleLockManager")
      @Scope(ScopeType.APPLICATION)
      public class ControleLockManager {
           
           @Logger
           Log log;
           
           @Create
           @Destroy
           public void limpaRegistrosLock(){
               //ServletContexts.getInstance().getRequest().getContextPath();
           }
           
      }
      
      



      At this point I need to get my context path (like /myApp). The comented line throws NullPointerException, becouse I am not in a request. Is there any other way to get my contextPath?