Package org.apache.myfaces.trinidad.util

Examples of org.apache.myfaces.trinidad.util.RequestStateMap


  @Override
  public void beginRequest(ExternalContext ec)
  {
    // asserts for debug which disappear in production
    assert ec != null;
    RequestStateMap state = RequestStateMap.getInstance(ec);
    RequestType requestType = (RequestType) state.get(_REQUEST_TYPE);

    // Do per-virtual request stuff
    if (requestType == null)
    {
      // RequestType may change in a portal environment. Make sure it's set up to enforce the
      // contracts
      requestType = ExternalContextUtils.getRequestType(ec);
      RequestStateMap.getInstance(ec).put(_REQUEST_TYPE, requestType);

      // By contract, Configurators beginRequest is only called once per physical request.
      // The globalConfigurator may be called multiple times, however, so we need to enforce
      // the contract.
      if (!_isDisabled(ec))
      {
        // If this hasn't been initialized then please initialize
        if (!_initialized)
        {
          init(ec);
        }

        _attachRequestContext(ec);

        if (state.get(_IN_REQUEST) == null)
        {
          _startConfiguratorServiceRequest(ec);
        }
      }
      else
View Full Code Here


   * @see org.apache.myfaces.trinidad.config.Configurator#endRequest(javax.faces.context.ExternalContext)
   */
  @Override
  public void endRequest(ExternalContext ec)
  {
    RequestStateMap state = RequestStateMap.getInstance(ec);

    // do per virtual-request stuff
    if (state.get(_REQUEST_TYPE) != null)
    {
      if (!_isDisabled(ec))
      {
        try
        {
          //Only end services at the end of a writable response.  This will
          //generally be RENDER, RESOURCE, and SERVLET.
          if (ExternalContextUtils.isResponseWritable(ec))
          {
            _endConfiguratorServiceRequest(ec);
          }
        }
        finally
        {
          state.saveState(ec);
          _releaseRequestContext(ec);
        }
      }
      state.remove(_REQUEST_TYPE);
    }
  }
View Full Code Here

   * @return a decorated ExternalContext object
   */
  @Override
  public ExternalContext getExternalContext(ExternalContext ec)
  {
    RequestStateMap state = RequestStateMap.getInstance(ec);
    RequestType type = (RequestType) state.get(_REQUEST_TYPE);

    if (type == null)
    {
      beginRequest(ec);
      type = (RequestType) state.get(_REQUEST_TYPE);
    }
    else if (!ExternalContextUtils.getRequestType(ec).equals(type))
    {
      throw new IllegalStateException("The expected request type is not the same as the current request type.");
    }
View Full Code Here

  @Override
  public void beginRequest(ExternalContext ec)
  {
    // asserts for debug which disappear in production
    assert ec != null;
    RequestStateMap state = RequestStateMap.getInstance(ec);
    RequestType requestType = (RequestType) state.get(_REQUEST_TYPE);

    // Do per-virtual request stuff
    if (requestType == null)
    {
      // RequestType may change in a portal environment. Make sure it's set up to enforce the
      // contracts
      requestType = ExternalContextUtils.getRequestType(ec);
      RequestStateMap.getInstance(ec).put(_REQUEST_TYPE, requestType);

      // By contract, Configurators beginRequest is only called once per physical request.
      // The globalConfigurator may be called multiple times, however, so we need to enforce
      // the contract.
      if (!_isDisabled(ec))
      {
        // If this hasn't been initialized then please initialize
        if (!_initialized)
        {
          init(ec);
        }

        _attachRequestContext(ec);

        if (state.get(_IN_REQUEST) == null)
        {
          _startConfiguratorServiceRequest(ec);
        }
      }
      else
View Full Code Here

   * @see org.apache.myfaces.trinidad.config.Configurator#endRequest(javax.faces.context.ExternalContext)
   */
  @Override
  public void endRequest(ExternalContext ec)
  {
    RequestStateMap state = RequestStateMap.getInstance(ec);

    // do per virtual-request stuff
    if (state.get(_REQUEST_TYPE) != null)
    {
      if (!_isDisabled(ec))
      {
        try
        {
          //Only end services at the end of a writable response.  This will
          //generally be RENDER, RESOURCE, and SERVLET.
          if (ExternalContextUtils.isResponseWritable(ec))
          {
            _endConfiguratorServiceRequest(ec);
          }
        }
        finally
        {
          state.saveState(ec);
          _releaseRequestContext(ec);
        }
      }
      state.remove(_REQUEST_TYPE);
    }
  }
View Full Code Here

   * @return a decorated ExternalContext object
   */
  @Override
  public ExternalContext getExternalContext(ExternalContext ec)
  {
    RequestStateMap state = RequestStateMap.getInstance(ec);
    RequestType type = (RequestType) state.get(_REQUEST_TYPE);

    if (type == null)
    {
      beginRequest(ec);
      type = (RequestType) state.get(_REQUEST_TYPE);
    }
    else if (!ExternalContextUtils.getRequestType(ec).equals(type))
    {
      throw new IllegalStateException("The expected request type is not the same as the current request type.");
    }
View Full Code Here

  @Override
  public void beginRequest(ExternalContext ec)
  {
    // asserts for debug which disappear in production
    assert ec != null;
    RequestStateMap state = RequestStateMap.getInstance(ec);
    RequestType requestType = (RequestType) state.get(_REQUEST_TYPE);

    // Do per-virtual request stuff
    if (requestType == null)
    {
      // RequestType may change in a portal environment. Make sure it's set up to enforce the
      // contracts
      requestType = ExternalContextUtils.getRequestType(ec);
      RequestStateMap.getInstance(ec).put(_REQUEST_TYPE, requestType);

      // By contract, Configurators beginRequest is only called once per physical request.
      // The globalConfigurator may be called multiple times, however, so we need to enforce
      // the contract.
      if (!_isDisabled(ec))
      {
        // If this hasn't been initialized then please initialize
        if (!_initialized.get())
        {
          init(ec);
        }

        _attachRequestContext(ec);

        if (state.get(_IN_REQUEST) == null)
        {
          _startConfiguratorServiceRequest(ec);
        }
      }
      else
View Full Code Here

   * @see org.apache.myfaces.trinidad.config.Configurator#endRequest(javax.faces.context.ExternalContext)
   */
  @Override
  public void endRequest(ExternalContext ec)
  {
    RequestStateMap state = RequestStateMap.getInstance(ec);

    // do per virtual-request stuff
    if (state.get(_REQUEST_TYPE) != null)
    {
      if (!_isDisabled(ec))
      {
        try
        {
          //Only end services at the end of a writable response.  This will
          //generally be RENDER, RESOURCE, and SERVLET.
          if (ExternalContextUtils.isResponseWritable(ec))
          {
            _endConfiguratorServiceRequest(ec);
          }
        }
        finally
        {
          state.saveState(ec);
          _releaseRequestContext(ec);
        }
      }
      state.remove(_REQUEST_TYPE);
    }
  }
View Full Code Here

   * @return a decorated ExternalContext object
   */
  @Override
  public ExternalContext getExternalContext(ExternalContext ec)
  {
    RequestStateMap state = RequestStateMap.getInstance(ec);
    RequestType type = (RequestType) state.get(_REQUEST_TYPE);

    if (type == null)
    {
      beginRequest(ec);
      type = (RequestType) state.get(_REQUEST_TYPE);
    }
    else if (!ExternalContextUtils.getRequestType(ec).equals(type))
    {
      throw new IllegalStateException("The expected request type is not the same as the current request type.");
    }
View Full Code Here

  @Override
  public void beginRequest(ExternalContext ec)
  {
    // asserts for debug which disappear in production
    assert ec != null;
    RequestStateMap state = RequestStateMap.getInstance(ec);
    RequestType requestType = (RequestType) state.get(_REQUEST_TYPE);

    // Do per-virtual request stuff
    if (requestType == null)
    {
      // RequestType may change in a portal environment. Make sure it's set up to enforce the
      // contracts
      requestType = ExternalContextUtils.getRequestType(ec);
      RequestStateMap.getInstance(ec).put(_REQUEST_TYPE, requestType);

      // By contract, Configurators beginRequest is only called once per physical request.
      // The globalConfigurator may be called multiple times, however, so we need to enforce
      // the contract.
      if (!_isDisabled(ec))
      {
        // If this hasn't been initialized then please initialize
        if (!_initialized)
        {
          init(ec);
        }

        _attachRequestContext(ec);

        if (state.get(_IN_REQUEST) == null)
        {
          _startConfiguratorServiceRequest(ec);
        }
      }
      else
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.util.RequestStateMap

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.