Package org.apache.myfaces.trinidadinternal.config

Examples of org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl


    @SuppressWarnings("unchecked")
    public CacheRenderKit(FacesContext base)
    {
      _base = base;
      ExternalContext baseExternal = base.getExternalContext();
      GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();

      //This should be done only if beginRequest was not called on the configurator
      //before we retrieve the FacesContext.  If this is the case then we'll need to handle
      //cleanup on the release of the FacesContext.  Otherwise the endRequest should be
      //called by whatever did he origional beginRequest.
      if(!GlobalConfiguratorImpl.isRequestStarted(baseExternal))
      {
        Map<String, Object> requestMap = baseExternal.getRequestMap();
        requestMap.put(_CONFIG_IN_CONTEXT, Boolean.TRUE);
      }

      _external = new OverrideDispatch(config.getExternalContext(baseExternal));
      setCurrentInstance(this);
    }
View Full Code Here


    // Set a flag so that we can detect if the filter has been
    // properly installed.
    request.setAttribute(_FILTER_EXECUTED_KEY, Boolean.TRUE);

    ExternalContext externalContext = new ServletExternalContext(_servletContext, request, response);   
    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
    config.beginRequest(externalContext);
   
    //To maintain backward compatibilty, wrap the request at the filter level
    Map<String, String[]> addedParams = (Map<String, String[]>) externalContext.getRequestMap().
      get(FileUploadConfiguratorImpl._PARAMS);
   
    if(addedParams != null)
    {
      FileUploadConfiguratorImpl.apply(externalContext);
      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
    }
   
    try
    {
     
      _doFilterImpl(request, response, chain);
    }
    finally
    {
      config.endRequest(externalContext);
    }
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    public CacheRenderKit(FacesContext base)
    {
      _base = base;
      ExternalContext baseExternal = base.getExternalContext();
      GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();

      //This should be done only if beginRequest was not called on the configurator
      //before we retrieve the FacesContext.  If this is the case then we'll need to handle
      //cleanup on the release of the FacesContext.  Otherwise the endRequest should be
      //called by whatever did he origional beginRequest.
      if(!GlobalConfiguratorImpl.isRequestStarted(baseExternal))
      {
        Map<String, Object> requestMap = baseExternal.getRequestMap();
        requestMap.put(_CONFIG_IN_CONTEXT, Boolean.TRUE);
      }

      _external = new OverrideDispatch(config.getExternalContext(baseExternal));
      setCurrentInstance(this);
    }
View Full Code Here

    // Set a flag so that we can detect if the filter has been
    // properly installed.
    request.setAttribute(_FILTER_EXECUTED_KEY, Boolean.TRUE);

    ExternalContext externalContext = new ServletExternalContext(_servletContext, request, response);   
    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
    config.beginRequest(externalContext);
   
    //To maintain backward compatibilty, wrap the request at the filter level
    Map<String, String[]> addedParams = FileUploadConfiguratorImpl.getAddedParameters(externalContext);
   
    if(addedParams != null)
    {
      FileUploadConfiguratorImpl.apply(externalContext);
      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
    }

    try
    {
     
      _doFilterImpl(request, response, chain);
    }
    // For PPR errors, handle the request specially
    catch (Throwable t)
    {
      boolean isPartialRequest;
      if (addedParams != null)
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(addedParams);
      }
      else
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(externalContext);
      }

      if (isPartialRequest)
      {
        XmlHttpConfigurator.handleError(externalContext, t);
      }
      else
      {
        // For non-partial requests, just re-throw.  It is not
        // our responsibility to catch these
        if (t instanceof RuntimeException)
          throw ((RuntimeException) t);
        if (t instanceof Error)
          throw ((Error) t);
        if (t instanceof IOException)
          throw ((IOException) t);
        if (t instanceof ServletException)
          throw ((ServletException) t);

        // Should always be one of those four types to have
        // gotten here.
        _LOG.severe(t);
      }

    }
    finally
    {
      config.endRequest(externalContext);
    }
  }
View Full Code Here

    // provide a (Pseudo-)FacesContext for configuration tasks
    PseudoFacesContext facesContext = new PseudoFacesContext(externalContext);
    facesContext.setAsCurrentInstance();
   
    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
    config.beginRequest(externalContext);
   
    String noJavaScript = request.getParameter(XhtmlConstants.NON_JS_BROWSER);
       
    // Wrap the request only for Non-javaScript browsers
    if(noJavaScript != null &&
              XhtmlConstants.NON_JS_BROWSER_TRUE.equals(noJavaScript))
    {
      request = new BasicHTMLBrowserRequestWrapper((HttpServletRequest)request);
    }

    //To maintain backward compatibilty, wrap the request at the filter level
    Map<String, String[]> addedParams = FileUploadConfiguratorImpl.getAddedParameters(externalContext);
   
    if(addedParams != null)
    {
      FileUploadConfiguratorImpl.apply(externalContext);
      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
    }

    // release the PseudoFacesContext, since _doFilterImpl() has its own FacesContext
    facesContext.release();

    try
    {
      _doFilterImpl(request, response, chain);
    }
    // For PPR errors, handle the request specially
    catch (Throwable t)
    {
      boolean isPartialRequest;
      if (addedParams != null)
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(addedParams);
      }
      else
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(externalContext);
      }

      if (isPartialRequest)
      {
        XmlHttpConfigurator.handleError(externalContext, t);
      }
      else
      {
        // For non-partial requests, just re-throw.  It is not
        // our responsibility to catch these
        if (t instanceof RuntimeException)
          throw ((RuntimeException) t);
        if (t instanceof Error)
          throw ((Error) t);
        if (t instanceof IOException)
          throw ((IOException) t);
        if (t instanceof ServletException)
          throw ((ServletException) t);

        // Should always be one of those four types to have
        // gotten here.
        _LOG.severe(t);
      }

    }
    finally
    {
      config.endRequest(externalContext);
    }
  }
View Full Code Here

    // Set a flag so that we can detect if the filter has been
    // properly installed.
    request.setAttribute(_FILTER_EXECUTED_KEY, Boolean.TRUE);

    ExternalContext externalContext = new ServletExternalContext(_servletContext, request, response);   
    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
    config.beginRequest(externalContext);
   
    String noJavaScript = request.getParameter(TrinidadRenderingConstants.NON_JS_BROWSER);
       
    // Wrap the request only for Non-javaScript browsers
    if(noJavaScript != null &&
              TrinidadRenderingConstants.NON_JS_BROWSER_TRUE.equals(noJavaScript))
    {
      request = new BasicHTMLBrowserRequestWrapper((HttpServletRequest)request);
    }
   
    //To maintain backward compatibilty, wrap the request at the filter level
    Map<String, String[]> addedParams = FileUploadConfiguratorImpl.getAddedParameters(externalContext);
   
    if(addedParams != null)
    {
      FileUploadConfiguratorImpl.apply(externalContext);
      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
    }

    try
    {
      _doFilterImpl(request, response, chain);
    }
    // For PPR errors, handle the request specially
    catch (Throwable t)
    {
      boolean isPartialRequest;
      if (addedParams != null)
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(addedParams);
      }
      else
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(externalContext);
      }

      if (isPartialRequest)
      {
        XmlHttpConfigurator.handleError(externalContext, t);
      }
      else
      {
        // For non-partial requests, just re-throw.  It is not
        // our responsibility to catch these
        if (t instanceof RuntimeException)
          throw ((RuntimeException) t);
        if (t instanceof Error)
          throw ((Error) t);
        if (t instanceof IOException)
          throw ((IOException) t);
        if (t instanceof ServletException)
          throw ((ServletException) t);

        // Should always be one of those four types to have
        // gotten here.
        _LOG.severe(t);
      }

    }
    finally
    {
      config.endRequest(externalContext);
    }
  }
View Full Code Here

    // Set a flag so that we can detect if the filter has been
    // properly installed.
    request.setAttribute(_FILTER_EXECUTED_KEY, Boolean.TRUE);

    ExternalContext externalContext = new ServletExternalContext(_servletContext, request, response);   
    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
    config.beginRequest(externalContext);
   
    //To maintain backward compatibilty, wrap the request at the filter level
    Map<String, String[]> addedParams = FileUploadConfiguratorImpl.getAddedParameters(externalContext);
   
    boolean isPartialRequest;
    if(addedParams != null)
    {
      FileUploadConfiguratorImpl.apply(externalContext);
      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
      isPartialRequest = CoreRenderKit.isPartialRequest(addedParams);
    }
    else
    {
      // Only test for AJAX request, since file uploads *should* be
      // handled by the above test.  NOTE: this will not necessarily
      // work if someone is using Trinidad PPR with non-Trinidad
      // file upload!  I've no idea currently how to cleanly handle
      // that combination in JSF 1.1.  We don't want to ask if
      // its a partial request here, as this requires getting a
      // query parameter, but that could block setting
      // the character set later in the request in some app servers!
      isPartialRequest = CoreRenderKit.isAjaxRequest(externalContext);
      if (isPartialRequest)
      {
        request = XmlHttpConfigurator.getAjaxServletRequest(request);
      }
    }

    if (isPartialRequest)
    {
      XmlHttpConfigurator.beginRequest(externalContext);
      response = XmlHttpConfigurator.getWrappedServletResponse(response);
    }

    try
    {
     
      _doFilterImpl(request, response, chain);
    }
    catch (Throwable t)
    {
      if (isPartialRequest)
      {
        XmlHttpConfigurator.handleError(externalContext, t);
      }
      else
      {
        // For non-partial requests, just re-throw.  It is not
        // our responsibility to catch these
        if (t instanceof RuntimeException)
          throw ((RuntimeException) t);
        if (t instanceof Error)
          throw ((Error) t);
        if (t instanceof IOException)
          throw ((IOException) t);
        if (t instanceof ServletException)
          throw ((ServletException) t);

        // Should always be one of those four types to have
        // gotten here.
        _LOG.severe(t);
      }

    }
    finally
    {
      config.endRequest(externalContext);
    }
  }
View Full Code Here

    // Set a flag so that we can detect if the filter has been
    // properly installed.
    request.setAttribute(_FILTER_EXECUTED_KEY, Boolean.TRUE);

    ExternalContext externalContext = new ServletExternalContext(_servletContext, request, response);   
    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
    config.beginRequest(externalContext);
   
    String noJavaScript = request.getParameter(XhtmlConstants.NON_JS_BROWSER);
       
    // Wrap the request only for Non-javaScript browsers
    if(noJavaScript != null &&
              XhtmlConstants.NON_JS_BROWSER_TRUE.equals(noJavaScript))
    {
      request = new BasicHTMLBrowserRequestWrapper((HttpServletRequest)request);
    }
   
    //To maintain backward compatibilty, wrap the request at the filter level
    Map<String, String[]> addedParams = FileUploadConfiguratorImpl.getAddedParameters(externalContext);
   
    if(addedParams != null)
    {
      FileUploadConfiguratorImpl.apply(externalContext);
      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
    }

    try
    {
      _doFilterImpl(request, response, chain);
    }
    // For PPR errors, handle the request specially
    catch (Throwable t)
    {
      boolean isPartialRequest;
      if (addedParams != null)
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(addedParams);
      }
      else
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(externalContext);
      }

      if (isPartialRequest)
      {
        XmlHttpConfigurator.handleError(externalContext, t);
      }
      else
      {
        // For non-partial requests, just re-throw.  It is not
        // our responsibility to catch these
        if (t instanceof RuntimeException)
          throw ((RuntimeException) t);
        if (t instanceof Error)
          throw ((Error) t);
        if (t instanceof IOException)
          throw ((IOException) t);
        if (t instanceof ServletException)
          throw ((ServletException) t);

        // Should always be one of those four types to have
        // gotten here.
        _LOG.severe(t);
      }

    }
    finally
    {
      config.endRequest(externalContext);
    }
  }
View Full Code Here

    // Set a flag so that we can detect if the filter has been
    // properly installed.
    request.setAttribute(_FILTER_EXECUTED_KEY, Boolean.TRUE);

    ExternalContext externalContext = new ServletExternalContext(_servletContext, request, response);   
    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
    config.beginRequest(externalContext);
   
    //To maintain backward compatibilty, wrap the request at the filter level
    Map<String, String[]> addedParams = FileUploadConfiguratorImpl.getAddedParameters(externalContext);
   
    if(addedParams != null)
    {
      FileUploadConfiguratorImpl.apply(externalContext);
      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
    }

    try
    {
      _doFilterImpl(request, response, chain);
    }
    // For PPR errors, handle the request specially
    catch (Throwable t)
    {
      boolean isPartialRequest;
      if (addedParams != null)
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(addedParams);
      }
      else
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(externalContext);
      }

      if (isPartialRequest)
      {
        XmlHttpConfigurator.handleError(externalContext, t);
      }
      else
      {
        // For non-partial requests, just re-throw.  It is not
        // our responsibility to catch these
        if (t instanceof RuntimeException)
          throw ((RuntimeException) t);
        if (t instanceof Error)
          throw ((Error) t);
        if (t instanceof IOException)
          throw ((IOException) t);
        if (t instanceof ServletException)
          throw ((ServletException) t);

        // Should always be one of those four types to have
        // gotten here.
        _LOG.severe(t);
      }

    }
    finally
    {
      config.endRequest(externalContext);
    }
  }
View Full Code Here

    // provide a (Pseudo-)FacesContext for configuration tasks
    PseudoFacesContext facesContext = new PseudoFacesContext(externalContext);
    facesContext.setAsCurrentInstance();
   
    GlobalConfiguratorImpl config = GlobalConfiguratorImpl.getInstance();
    config.beginRequest(externalContext);
   
    String noJavaScript = request.getParameter(XhtmlConstants.NON_JS_BROWSER);
       
    // Wrap the request only for Non-javaScript browsers
    if(noJavaScript != null &&
              XhtmlConstants.NON_JS_BROWSER_TRUE.equals(noJavaScript))
    {
      request = new BasicHTMLBrowserRequestWrapper((HttpServletRequest)request);
    }

    //To maintain backward compatibilty, wrap the request at the filter level
    Map<String, String[]> addedParams = FileUploadConfiguratorImpl.getAddedParameters(externalContext);
   
    if(addedParams != null)
    {
      FileUploadConfiguratorImpl.apply(externalContext);
      request = new UploadRequestWrapper((HttpServletRequest)request, addedParams);
    }

    // release the PseudoFacesContext, since _doFilterImpl() has its own FacesContext
    facesContext.release();

    try
    {
      _doFilterImpl(request, response, chain);
    }
    // For PPR errors, handle the request specially
    catch (Throwable t)
    {
      boolean isPartialRequest;
      if (addedParams != null)
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(addedParams);
      }
      else
      {
        isPartialRequest = CoreRenderKit.isPartialRequest(externalContext);
      }

      if (isPartialRequest)
      {
        XmlHttpConfigurator.handleError(externalContext, t);
      }
      else
      {
        // For non-partial requests, just re-throw.  It is not
        // our responsibility to catch these
        if (t instanceof RuntimeException)
          throw ((RuntimeException) t);
        if (t instanceof Error)
          throw ((Error) t);
        if (t instanceof IOException)
          throw ((IOException) t);
        if (t instanceof ServletException)
          throw ((ServletException) t);

        // Should always be one of those four types to have
        // gotten here.
        _LOG.severe(t);
      }

    }
    finally
    {
      config.endRequest(externalContext);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl

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.