Package com.caucho.server.webapp

Examples of com.caucho.server.webapp.WebApp


      sendError(res, out, res.SC_BAD_REQUEST, "Bad Request for PROPPATCH",
                "Bad Request: " + 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;
View Full Code Here


  @PostConstruct
  public void init()
    throws ConfigException
  {
    try {
      WebApp webApp = WebApp.getCurrent();

      _proxyServlet.init(webApp);

      if (webApp != null)
        webApp.addServlet(_servlet);
    }
    catch (ServletException ex) {
      throw ConfigException.create(ex);
    }
  }
View Full Code Here

    throws ConfigException
  {
    try {
      _proxyServlet.init();

      WebApp webApp = WebApp.getCurrent();

      if (webApp != null)
        webApp.addServlet(_servlet);
    }
    catch (ServletException ex) {
      throw ConfigException.create(ex);
    }
  }
View Full Code Here

      addHeader(stream, ws, "QUERY_STRING", "");

    String scriptPath = req.getServletPath();
    String pathInfo = req.getPathInfo();

    WebApp webApp = (WebApp) req.getServletContext();

    Path appDir = webApp.getAppDir();
    String realPath = webApp.getRealPath(scriptPath);

    if (! appDir.lookup(realPath).isFile() && pathInfo != null)
      scriptPath = scriptPath + pathInfo;

    /*
     * FastCGI (specifically quercus) uses the PATH_INFO and PATH_TRANSLATED
     * for the script path.
     */
    log.finer("STREAM file: " + webApp.getRealPath(scriptPath));

    addHeader(stream, ws, "PATH_INFO", req.getContextPath() + scriptPath);
    addHeader(stream, ws, "PATH_TRANSLATED", webApp.getRealPath(scriptPath));

    /* These are the values which would be sent to CGI.
    addHeader(stream, ws, "SCRIPT_NAME", req.getContextPath() + scriptPath);
    addHeader(stream, ws, "SCRIPT_FILENAME", app.getRealPath(scriptPath));

    if (pathInfo != null) {
      addHeader(stream, ws, "PATH_INFO", pathInfo);
      addHeader(stream, ws, "PATH_TRANSLATED", req.getRealPath(pathInfo));
    }
    else {
      addHeader(stream, ws, "PATH_INFO", "");
      addHeader(stream, ws, "PATH_TRANSLATED", "");
    }
    */

    int contentLength = req.getContentLength();
    if (contentLength < 0)
      addHeader(stream, ws, "CONTENT_LENGTH", "0");
    else
      addHeader(stream, ws, "CONTENT_LENGTH", String.valueOf(contentLength));

    ServletContext rootContext = webApp.getContext("/");

    if (rootContext != null)
      addHeader(stream, ws, "DOCUMENT_ROOT", rootContext.getRealPath("/"));

    CharBuffer cb = new CharBuffer();
View Full Code Here

  {
    super.init(conf);

    JspManager manager = new JspManager();

    WebApp webApp = (WebApp) getServletContext();

    manager.setXml(_isXml);
    manager.setLoadTldOnInit(_loadTldOnInit
           || webApp.createJsp().isLoadTldOnInit());
    manager.setPageCacheMax(_pageCacheMax);

    manager.initWebApp(webApp);
     
    setManager(manager);
View Full Code Here

    // default to true if ends with x
    if (_uri.endsWith("x"))
      _parseState.setXml(true);

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

    if (app != null && app.hasPre23Config()
  && _parseState.getELIgnoredDefault() == null
  && ! _parseState.isXml()) { // jsp/100a
      _parseState.setELIgnoredDefault(true);
    }

    JspConfig jspConfig = null;

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

    ArrayList<JspPropertyGroup> jspList = new ArrayList<JspPropertyGroup>();
    _jspPropertyGroup = null;

    if (_jspPropertyGroup == null) {
      _jspPropertyGroup = _jspCompiler.getJspPropertyGroup();

      if (_jspPropertyGroup != null) {
  jspList.add(_jspPropertyGroup);
      }
    }

    if (_jspPropertyGroup == null && app != null) {
      _jspPropertyGroup = app.getJsp();
     
      if (_jspPropertyGroup != null)
  jspList.add(_jspPropertyGroup);
    }

    if (_jspPropertyGroup == null) {
      _jspPropertyGroup = _jspCompiler.getJspPropertyGroup();
     
      if (_jspPropertyGroup != null)
  jspList.add(_jspPropertyGroup);
    }

    if (jspConfig != null) {
      jspList.addAll(jspConfig.findJspPropertyGroupList(_uri));

      if (_parseState.getELIgnoredDefault() == null)
  _parseState.setELIgnoredDefault(false);
    }

    JspResourceManager resourceManager = _jspCompiler.getResourceManager();
    if (resourceManager != null) {
    }
    else if (app != null)
      resourceManager = new AppResourceManager(app);
    else {
      resourceManager = new AppDirResourceManager(appDir);
    }

    TagFileManager tagFileManager = _jspCompiler.getTagFileManager();

    TaglibManager taglibManager = _jspCompiler.getTaglibManager();

    JspPageConfig pageConfig = new JspPageConfig();

    for (JspPropertyGroup jspPropertyGroup : jspList) {
      ArrayList<String> preludeList = jspPropertyGroup.getIncludePreludeList();
      for (int i = 0; preludeList != null && i < preludeList.size(); i++) {
        String prelude = preludeList.get(i);
        _preludeList.add(prelude);
      }

      ArrayList<String> codaList = jspPropertyGroup.getIncludeCodaList();
      for (int i = 0; codaList != null && i < codaList.size(); i++) {
        String coda = codaList.get(i);
        _codaList.add(coda);
      }

      _parseState.setJspPropertyGroup(jspPropertyGroup);
      _parseState.setSession(jspPropertyGroup.isSession());
      _parseState.setScriptingInvalid(jspPropertyGroup.isScriptingInvalid());

      if (jspPropertyGroup.isELIgnored() != null) {
  _parseState.setELIgnored(Boolean.TRUE.equals(jspPropertyGroup.isELIgnored()));
      }
     
      _parseState.setVelocityEnabled(jspPropertyGroup.isVelocityEnabled());
      _parseState.setPageEncoding(jspPropertyGroup.getPageEncoding());
     
      if (Boolean.TRUE.equals(jspPropertyGroup.isXml()))
  _parseState.setXml(true);
     
      if (Boolean.FALSE.equals(jspPropertyGroup.isXml())) {
  _parseState.setXml(false);
  _parseState.setForbidXml(true);
      }

      if (jspPropertyGroup.getPageEncoding() != null) {
  try {
    _parseState.setPageEncoding(jspPropertyGroup.getPageEncoding());
  } catch (JspParseException e) {
  }
      }

      pageConfig.setStaticEncoding(jspPropertyGroup.isStaticEncoding());

      _parseState.setRecycleTags(jspPropertyGroup.isRecycleTags());
     
      _parseState.setTrimWhitespace(jspPropertyGroup.isTrimDirectiveWhitespaces());
      _parseState.setDeferredSyntaxAllowedAsLiteral(jspPropertyGroup.isDeferredSyntaxAllowedAsLiteral());

      if (jspPropertyGroup.getTldFileSet() != null)
        taglibManager.setTldFileSet(jspPropertyGroup.getTldFileSet());
    }

    if (_jsfPropertyGroup == null)
      _jsfPropertyGroup = _jspCompiler.getJsfPropertyGroup();

    if (_jsfPropertyGroup == null && app != null)
       _jsfPropertyGroup = app.getJsf();

    _parseState.setResourceManager(resourceManager);
    LineMap lineMap = null;

    _tagManager = new ParseTagManager(resourceManager,
View Full Code Here

  xml.setNamespaceAware(true);
  xml.setDtdValidating(true);
  xml.parse(_jspPath);
      }
      else {
  WebApp app = _jspCompiler.getWebApp();

  // jsp/0135
  if (app != null && app.hasPre23Config()) {
    if (_parseState.getELIgnoredDefault() == null)
      _parseState.setELIgnoredDefault(true);
  }
 
  _parser.parse(_jspPath, _uri);
View Full Code Here

    if (_request.getMethod().equals("HEAD")) {
      isHead = true;
      _responseStream.setHead();
    }

    WebApp webApp = _request.getWebApp();

    int statusCode = res.getStatus();

    int majorCode = statusCode / 100;

    if (webApp != null) {
      if (majorCode == 5)
        webApp.addStatus500();
    }

    if (req != null) {
      HttpSession session = req.getMemorySession();
      if (session instanceof SessionImpl)
View Full Code Here

      _calendar.setGMTTime(date + 1000L * (long) maxAge);
      cb.append("; expires=");
      cb.append(_calendar.format("%a, %d-%b-%Y %H:%M:%S GMT"));
    }

    WebApp app = _request.getWebApp();
    if (app.getCookieHttpOnly() || app.getSessionManager().isCookieHttpOnly()) {
      cb.append("; HttpOnly");
    }

    return true;
  }
View Full Code Here

   */
  public FilterChain build(FilterChain next, Invocation invocation)
  {
    String uri = invocation.getContextURI();

    WebApp app = invocation.getWebApp();
    if (app == null)
      return next;

    String lower = uri.toLowerCase();

    if (lower.startsWith("/web-inf")
  || lower.startsWith("/meta-inf")) {
      return new ErrorFilterChain(HttpServletResponse.SC_NOT_FOUND);
    }

    ArrayList<AbstractConstraint> constraints;
    constraints = new ArrayList<AbstractConstraint>();
   
    HashMap<String,AbstractConstraint[]> methodMap;
    methodMap = new HashMap<String,AbstractConstraint[]>();

    loop:
    for (int i = 0; i < _constraints.size(); i++) {
      SecurityConstraint constraint = _constraints.get(i);

      if (constraint.isMatch(uri)) {
  AbstractConstraint absConstraint = constraint.getConstraint();

  if (absConstraint != null) {
    ArrayList<String> methods = constraint.getMethods(uri);

    for (int j = 0; methods != null && j < methods.size(); j++) {
      String method = methods.get(j);

      AbstractConstraint []methodList = methodMap.get(method);

      if (methodList == null)
        methodList = absConstraint.toArray();
      // server/12ba - the first constraint matches, following are
      // ignored
      /*
      else {
       
        AbstractConstraint []newMethods = absConstraint.toArray();
   
        AbstractConstraint []newList;
   
        newList = new AbstractConstraint[methodList.length
                 + newMethods.length];

        System.arraycopy(methodList, 0, newList, 0, methodList.length);
        System.arraycopy(newMethods, 0, newList,
             methodList.length, newMethods.length);

        methodList = newList;
      }
      */

      methodMap.put(method, methodList);
    }
         
    if (methods == null || methods.size() == 0) {
      AbstractConstraint []constArray = absConstraint.toArray();
      for (int k = 0; k < constArray.length; k++)
        constraints.add(constArray[k]);

      // server/12ba - the first constraint matches, following are
      // ignored

      if (! constraint.isFallthrough())
        break loop;
    }
  }
  else {
    // server/1233
   
    if (! constraint.isFallthrough())
      break loop;
  }
      }
    }

    if (uri.endsWith("/j_security_check")
  && app.getLogin() instanceof FormLogin) {
      RequestDispatcher disp = app.getNamedDispatcher("j_security_check");
      if (disp == null)
        throw new IllegalStateException(L.l("j_security_check is an undefined servlet"));

      next = new ForwardFilterChain(disp);
    }
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.