Package org.gatein.wci

Examples of org.gatein.wci.WebApp


     * @see org.gatein.wci.WebAppListener#onEvent(org.gatein.wci.WebAppEvent)
     */
    public void onEvent(WebAppEvent event) {
        if (event instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent lifeCycleEvent = (WebAppLifeCycleEvent) event;
            WebApp webApp = null;
            URL url = null;
            switch (lifeCycleEvent.getType()) {
                case WebAppLifeCycleEvent.ADDED:
                    webApp = event.getWebApp();
                    url = getGateinResourcesXml(webApp);
View Full Code Here


    }

    private Reader getJavascript(Module module, Locale locale) {
        if (module instanceof Module.Local) {
            Module.Local localModule = (Module.Local) module;
            final WebApp webApp = contexts.get(localModule.getContextPath());
            if (webApp != null) {
                ServletContext sc = webApp.getServletContext();
                return localModule.read(locale, sc, webApp.getClassLoader());
            }
        }
        return null;
    }
View Full Code Here

   private Reader getJavascript(Module module, Locale locale)
   {
      if (module instanceof Module.Local)
      {
         Module.Local localModule = (Module.Local)module;
         final WebApp webApp = contexts.get(localModule.getContextPath());
         if (webApp != null)
         {
            ServletContext sc = webApp.getServletContext();
            return localModule.read(locale, sc, webApp.getClassLoader());
         }
      }
      return null;
   }
View Full Code Here

      WebAppRegistry registry = new WebAppRegistry();
      if (container.addWebAppListener(registry))
      {
         try
         {
            WebApp app = registry.getWebApp("/rdapp");
            if (app != null)
            {
               NormalCallback cb1 = new NormalCallback(app.getServletContext(), app.getClassLoader());
               Exception ex = new Exception();
               ExceptionCallback cb2 = new ExceptionCallback(app.getServletContext(), ex, ex);
               Error err = new Error();
               ExceptionCallback cb3 = new ExceptionCallback(app.getServletContext(), err, err);
               RuntimeException rex = new RuntimeException();
               ExceptionCallback cb4 = new ExceptionCallback(app.getServletContext(), rex, rex);
               IOException ioe = new IOException();
               ExceptionCallback cb5 = new ExceptionCallback(app.getServletContext(), ioe, ioe);

               //
               ServletContextDispatcher dispatcher = new ServletContextDispatcher(req, resp, container);
               Throwable response = cb1.test(null, dispatcher);
               response = cb2.test(response, dispatcher);
View Full Code Here

   }

   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
   {
      WebApp app = registry.getWebApp("/servletlistenerapp");
      if (app == null)
      {
         throw new ServletException("Could not find the app to dispatch to");
      }

      //
      container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(ServletContext dsc, HttpServletRequest req, HttpServletResponse resp, Object handback) throws ServletException, IOException
         {
            return null;
View Full Code Here

   }

   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
   {
      WebApp app = registry.getWebApp("/crosscontextapp");
      if (app == null)
      {
         throw new ServletException("Could not find the app to dispatch to");
      }

      //
      HttpSession session = req.getSession(false);
      if (session != null)
      {
         throw new ServletException("Was not expecting a session to exist");
      }

      // Authenticate
      container.login(req, resp, new Credentials("foo", "bar"));

      //
      session = req.getSession();
      String id = session.getId();

      //
      String dispatchedId = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
         {
            if (dispatchedReq.getSession(false) != null)
            {
               throw new ServletException("Was not expecting a session to exist");
            }
            HttpSession dispatchedSession = dispatchedReq.getSession();
            dispatchedSession.setAttribute("payload", "foo");
            return dispatchedSession.getId();
         }
      }, null);

      //
      if (!id.equals(dispatchedId))
      {
         throw new ServletException("Was expecting session ids to be the same");
      }

      // Check we find the same value
      String payload = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
         {
            HttpSession dispatchedSession = dispatchedReq.getSession();
            return dispatchedSession.getAttribute("payload");
         }
      }, null);
      if (!"foo".equals(payload))
      {
         throw new ServletException("Was expecting a foo payload instead of " + payload);
      }

      // Now logout
      container.logout(req, resp);

      //
      payload = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
         {
            HttpSession dispatchedSession = dispatchedReq.getSession();
View Full Code Here

    public void onEvent(WebAppEvent webAppEvent) {
        if (webAppEvent instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent lfEvent = (WebAppLifeCycleEvent) webAppEvent;
            if (lfEvent.getType() == WebAppLifeCycleEvent.ADDED) {
                WebApp webApp = webAppEvent.getWebApp();
                ServletContext scontext = webApp.getServletContext();
                try {
                    final URL url = scontext.getResource("/WEB-INF/gadget.xml");
                    if (url != null) {
                        final RootContainer.PortalContainerPostInitTask task = new RootContainer.PortalContainerPostInitTask() {
                            public void execute(ServletContext context, PortalContainer portalContainer) {
View Full Code Here

    public void onEvent(WebAppEvent webAppEvent) {
        if (webAppEvent instanceof WebAppLifeCycleEvent) {
            WebAppLifeCycleEvent lfEvent = (WebAppLifeCycleEvent) webAppEvent;
            if (lfEvent.getType() == WebAppLifeCycleEvent.ADDED) {
                WebApp webApp = webAppEvent.getWebApp();
                ServletContext scontext = webApp.getServletContext();
                try {
                    final URL url = scontext.getResource("/WEB-INF/gadget.xml");
                    if (url != null) {
                        final RootContainer.PortalContainerPostInitTask task = new RootContainer.PortalContainerPostInitTask() {
                            public void execute(ServletContext context, PortalContainer portalContainer) {
View Full Code Here

            return false;
         }
         webAppListeners.add(listener);
         for (Object response : webAppMap.values())
         {
            WebApp webApp = (WebApp)response;
            WebAppLifeCycleEvent event = new WebAppLifeCycleEvent(webApp, WebAppLifeCycleEvent.ADDED);
            safeFireEvent(listener, event);
         }
         return true;
      }
View Full Code Here

            return false;
         }
         webAppListeners.add(listener);
         for (Object response : webAppMap.values())
         {
            WebApp webApp = (WebApp)response;
            WebAppLifeCycleEvent event = new WebAppLifeCycleEvent(webApp, WebAppLifeCycleEvent.ADDED);
            safeFireEvent(listener, event);
         }
         return true;
      }
View Full Code Here

TOP

Related Classes of org.gatein.wci.WebApp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.