Package javax.enterprise.context

Examples of javax.enterprise.context.ContextNotActiveException


   private void assertActive()
   {
      if (!isActive())
      {
         throw new ContextNotActiveException(
                  "Context with scope annotation @ProjectScoped is not active with respect to the current directory.");
      }
   }
View Full Code Here


   private void assertActive()
   {
      if (!isActive())
      {
         throw new ContextNotActiveException(
                  "Context with scope annotation @CommandScoped is not active since no command is in execution.");
      }
   }
View Full Code Here

        return BeanManagerUtils.getContextualInstance(manager, RenderContext.class);
    }

    private void assertActive() {
        if (!isActive()) {
            throw new ContextNotActiveException(
                    "Seam context with scope annotation @RenderScoped is not active with respect to the current thread. "
                            + "This is probably caused by attempting to access the Flash before it was created or after it was destroyed.");
        }
    }
View Full Code Here

        return getViewRoot() != null;
    }

    private void assertActive() {
        if (!isActive()) {
            throw new ContextNotActiveException(
                    "Seam context with scope annotation @ViewScoped is not active with respect to the current thread");
        }
    }
View Full Code Here

    @Produces
    @RequestScoped
    public Flash getFlash() {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext == null) {
            throw new ContextNotActiveException("FacesContext is not active");
        }

        Flash ctx = facesContext.getExternalContext().getFlash();
        if (ctx == null) {
            throw new ContextNotActiveException("Flash is not active");
        }

        return ctx;
    }
View Full Code Here

    @Produces
    @RequestScoped
    public FacesContext getFacesContext() {
        FacesContext ctx = FacesContext.getCurrentInstance();
        if (ctx == null) {
            throw new ContextNotActiveException("FacesContext is not active");
        }
        return ctx;
    }
View Full Code Here

    }

    @Override
    public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
        if (!isActive()) {
            throw new ContextNotActiveException();
        }

        BeanStore beanStore = getBeanStore();
        if (beanStore == null) {
            return null;
View Full Code Here

        Context singleContext = singleContextMap.get(scopeType);
        if (singleContext != null)
        {
            if (!singleContext.isActive())
            {
                throw new ContextNotActiveException("WebBeans context with scope type annotation @"
                                                    + scopeType.getSimpleName()
                                                    + " does not exist within current thread");
            }
            return singleContext;
        }

        // the spec also allows for multiple contexts existing for the same scope type
        // but in this case only one must be active at a time (for the current thread)
        List<Context> others = contextMap.get(scopeType);
        Context found = null;

        if(others != null)
        {
            for(Context otherContext : others)
            {
                if(otherContext.isActive())
                {
                    if (found != null)
                    {
                        throw new IllegalStateException("More than one active context exists with scope type annotation @"
                                                        + scopeType.getSimpleName());
                    }
                   
                    found = otherContext;
                }
            }
        }
       
        if (found == null)
        {
            throw new ContextNotActiveException("WebBeans context with scope type annotation @"
                                                + scopeType.getSimpleName() + " does not exist within current thread");
        }
       
        return found;
    }
View Full Code Here

     */
    protected void checkActive()
    {
        if (!active)
        {
            throw new ContextNotActiveException("WebBeans context with scope annotation @" + getScope().getName() + " is not active with respect to the current thread");
        }       
    }
View Full Code Here

  public FacesContext getDelegate() {
    FacesContext facesContext = FacesContext.getCurrentInstance();

    if (facesContext == null) {
      // TODO Colocar a mensagem correta
      throw new ContextNotActiveException();
    }

    return facesContext;
  }
View Full Code Here

TOP

Related Classes of javax.enterprise.context.ContextNotActiveException

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.