Package com.caucho.server.webapp

Examples of com.caucho.server.webapp.WebApp


    _isLoadTldOnInit = isLoadOnInit;
  }

  public static long getCheckInterval()
  {
    WebApp webApp = WebApp.getCurrent();

    if (webApp == null)
      return -1;

    JspPropertyGroup jsp = webApp.getJsp();

    if (jsp != null)
      return jsp.getDependencyCheckInterval();
    else
      return -1;
View Full Code Here


  /**
   * Initialize the manager.
   */
  public void init()
  {
    WebApp app = getWebApp();

    app.getJspApplicationContext().setPageManager(this);

    if (_isLoadTldOnInit) {
      try {
        TldManager tld = TldManager.create(new AppResourceManager(app), app);

View Full Code Here

               ServletConfig config,
               ArrayList<PersistentDependency> dependList,
               boolean isGenerated)
    throws Exception
  {
    WebApp app = getWebApp();
    JspCompiler compiler = new JspCompiler();

    compiler.setWebApp(_webApp);
    compiler.setXml(_isXml);

    Page page = null;

    try {
      if (_precompile || _autoCompile)
        page = preload(className, app.getClassLoader(), app.getAppDir(),
                       config);
    } catch (Throwable e) {
      log.log(Level.WARNING, e.toString(), e);
    }
View Full Code Here

  public TaglibManager getTaglibManager()
    throws JspParseException, IOException
  {
    synchronized (this) {
      if (_taglibManager == null) {
  WebApp app = getWebApp();
 
  Path appDir = getAppDir();
  if (appDir == null && app != null)
    appDir = app.getAppDir();

  JspResourceManager resourceManager = getResourceManager();
  if (resourceManager != null) {
  }
  else if (app != null)
    resourceManager = new AppResourceManager(app);
  else {
    resourceManager = new AppDirResourceManager(appDir);
  }
 
  _taglibManager = new TaglibManager(resourceManager,
             app,
             _tagFileManager);
  _taglibManager.setWebApp(app);

  JspConfig jspConfig = null;

  if (app != null)
    jspConfig = (JspConfig) app.getExtension("jsp-config");

  if (jspConfig != null) {
    ArrayList<JspTaglib> tldMapList = jspConfig.getTaglibList();
    for (int i = 0; i < tldMapList.size(); i++) {
      JspTaglib taglib = tldMapList.get(i);

      _taglibManager.addLocationMap(taglib.getTaglibUri(),
            taglib.getTaglibLocation());
    }
  }

  if (app != null) {
    ArrayList<JspTaglib> taglibs = app.getTaglibList();
    for (int i = 0; taglibs != null && i < taglibs.size(); i++) {
      JspTaglib taglib = taglibs.get(i);

      _taglibManager.addLocationMap(taglib.getTaglibUri(),
            taglib.getTaglibLocation());
View Full Code Here

      while (i < args.length) {
  if (args[i].equals("-app-dir")) {
    Path appDir = Vfs.lookup(args[i + 1]);

    WebApp app = createWebApp(appDir);

    setWebApp(app);
    setAppDir(appDir);

    i += 2;
  }
  else if (args[i].equals("-class-dir") || args[i].equals("-d")) {
    setClassDirectory(Vfs.lookup(args[i + 1]));
    i += 2;
  }
  else if (args[i].equals("-compiler")) {
    JavacConfig.getLocalConfig().setCompiler(args[i + 1]);

    i += 2;
  }
  else if (args[i].equals("-conf")) {
    Path path = Vfs.lookup(args[i + 1]);

    new Config().configureBean(this, path);
    hasConf = true;

    i += 2;
  }
  else
    break;
      }

      WebApp app = getWebApp();
      if (app != null && ! hasConf) {
  Path appDir = app.getAppDir();

  DynamicClassLoader dynLoader = app.getEnvironmentClassLoader();
  dynLoader.addLoader(new CompilingLoader(dynLoader, appDir.lookup("WEB-INF/classes")));
  dynLoader.addLoader(new DirectoryLoader(dynLoader, appDir.lookup("WEB-INF/lib")));

  Path webXml = appDir.lookup("WEB-INF/web.xml");

  if (webXml.canRead()) {
    try {
      new Config().configureBean(app, webXml);
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
  }
      }

      Path appDir = null;

      if (app == null && getAppDir() != null) {
  app = createWebApp(null);

  app.setRootDirectory(getAppDir());
  setWebApp(app);
      }

      if (app != null) {
        app.setCompileContext(true);
       
  app.init();

  appDir = getWebApp().getAppDir();
  setClassLoader(getWebApp().getClassLoader());
      }
View Full Code Here

    @PostConstruct
    public void init()
      throws Exception
    {
      WebApp webApp = createWebApp(_rootDir);
      _program.configure(webApp);
      Config.init(webApp);

      webApp.init();
      webApp.start();
    }
View Full Code Here

  {
    if (request.getAttribute(LOGIN_CHECK) != null)
      return;
    request.setAttribute(LOGIN_CHECK, "login");

    WebApp app = _webApp;

    String jUseCookieAuth = (String) request.getParameter("j_use_cookie_auth");

    Authenticator auth = getAuthenticator();

    if (auth instanceof CookieAuthenticator
        && ((CookieAuthenticator) auth).isCookieSupported(jUseCookieAuth)) {
      CookieAuthenticator cookieAuth = (CookieAuthenticator) auth;

      generateCookie(user, cookieAuth, app, request, response);
    }

    String path = request.getServletPath();

    if (path == null)
      path = request.getPathInfo();
    else if (request.getPathInfo() != null)
      path = path + request.getPathInfo();

    if (path.equals("")) {
      // Forward?
      path = request.getContextPath() + "/";
      response.sendRedirect(response.encodeRedirectURL(path));
      return;
    }

    String uri = request.getRequestURI();

    if (path.endsWith("/j_security_check")) {
      RequestDispatcher disp;
      disp = app.getNamedDispatcher("j_security_check");

      if (disp == null)
        throw new ServletException(L.l("j_security_check servlet must be defined to use form-based login."));

      disp.forward(request, response);
View Full Code Here

      path = request.getContextPath() + "/";
      response.sendRedirect(response.encodeRedirectURL(path));
      return;
    }

    WebApp app = _webApp;

    String uri = request.getRequestURI();

    if (path.endsWith("/j_security_check")) {
      // server/12d8, server/12bs

      if (response instanceof CauchoResponse) {
        ((CauchoResponse) response).setNoCache(true);
      }
      else {
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
      }

      RequestDispatcher disp = app.getRequestDispatcher(_errorPage);
      disp.forward(request, response);
      /*
      //        && request.getAttribute(LOGIN_CHECK) == null) {
      request.setAttribute(LOGIN_CHECK, "login");

      RequestDispatcher disp;
      disp = app.getNamedDispatcher("j_security_check");

      if (disp == null)
        throw new ServletException(L.l("j_security_check servlet must be defined to use form-based login."));

      disp.forward(request, response);
      */
      return;
    }
    else if (uri.equals(_loginPage) || uri.equals(_errorPage)) {
      request.getRequestDispatcher(path).forward(request, response);
      return;
    }

    HttpSession session = request.getSession();

    session.putValue(LOGIN_SAVED_PATH, path);
    session.putValue(LOGIN_SAVED_QUERY, request.getQueryString());

    if (response instanceof CauchoResponse) {
      ((CauchoResponse) response).killCache();
      ((CauchoResponse) response).setNoCache(true);
    }
    else {
      response.setHeader("Cache-Control", "no-cache");
    }

    // In case where the authenticator is something like https:/
    if (! _loginPage.startsWith("/")) {
      response.sendRedirect(response.encodeRedirectURL(_loginPage));
      return;
    }

    // Forwards to the loginPage, never redirects according to the spec.
    request.setAttribute(LOGIN_CHECK, "login");
    //RequestDispatcher disp = app.getLoginDispatcher(loginPage);
    RequestDispatcher disp = app.getRequestDispatcher(_loginPage);
    disp.forward(request, response);

    if (log.isLoggable(Level.FINE))
      log.fine(this + " request '" + uri + "' has no authenticated user");
  }
View Full Code Here

  private Filter _filter;

  public RewriteFilterAdapter(Filter filter)
    throws ServletException
  {
    WebApp webApp = WebApp.getCurrent();
    FilterConfigImpl filterConfig = new FilterConfigImpl();
    filterConfig.setServletContext(webApp);

    filter.init(filterConfig);
View Full Code Here

      sendError(res, out, res.SC_BAD_REQUEST, "Bad Request for PROPFIND",
                String.valueOf(e));
      return;
    }

    WebApp app = (WebApp) getServletContext();
    Path appDir = app.getAppDir();

    String pathInfo = req.getPathInfo();
    String uriPwd = app.getContextPath() + req.getServletPath();
   
    if (pathInfo == null)
      pathInfo = "/";
    else
      uriPwd = uriPwd + pathInfo;

    if (_path.isDirectory(pathInfo, req, app) && ! uriPwd.endsWith("/"))
      uriPwd = uriPwd + "/";

    ServletContext rootApp = app.getContext("/");

    ArrayList<AttributeName> properties = handler.getProperties();
    boolean isPropname = handler.isPropname();

    if (properties.size() == 0)
View Full Code Here

TOP

Related Classes of com.caucho.server.webapp.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.