Examples of ExternalContext


Examples of javax.faces.context.ExternalContext

      appContext.set( Seam.getComponentName(clazz) + ".component", new Component(clazz) );
   }
  
   private MockFacesContext createFacesContext()
   {
      ExternalContext externalContext = new MockExternalContext();
      MockFacesContext facesContext = new MockFacesContext( externalContext, new MockApplication() );
      facesContext.setCurrent().createViewRoot();
      facesContext.getApplication().setStateManager( new SeamStateManager( facesContext.getApplication().getStateManager() ) );
     
      Context appContext = new ApplicationContext( externalContext.getApplicationMap() );
      installComponents(appContext);
      return facesContext;
   }
View Full Code Here

Examples of javax.faces.context.ExternalContext

         for (Map.Entry<String, String> param : params.entrySet())
         {
            request.getParameterMap().put(param.getKey(), new String[] { param.getValue() });
         }
      }
      ExternalContext extContext = new MockExternalContext(request);
      Application application = new MockApplication();
      application.addELResolver(new ImplicitObjectELResolver());
      FacesContext facesCtx = new MockFacesContext(extContext, application).setCurrent();
      assert FacesContext.getCurrentInstance() != null;
      return facesCtx;
View Full Code Here

Examples of javax.faces.context.ExternalContext

         int idx = Arrays.binarySearch(IMPLICIT_OBJECT_NAMES, prop);
         if (idx < 0) return null;
        
         FacesContext facesCtx = (FacesContext) elCtx.getContext(FacesContext.class);
         ExternalContext extCtx = facesCtx.getExternalContext();
        
         if (prop.equals(PARAM))
         {
            elCtx.setPropertyResolved(true);
            return extCtx.getRequestParameterMap();
         }

         throw new IllegalStateException("Programming error: list of possible conditions is incomplete");
      }
View Full Code Here

Examples of javax.faces.context.ExternalContext

   @Test
   public void testValidationInterceptor() throws Exception
   {
      MockServletContext servletContext = new MockServletContext();
      ServletLifecycle.beginApplication(servletContext);
      ExternalContext externalContext = new MockExternalContext(servletContext);
      new MockFacesContext( externalContext, new MockApplication() ).setCurrent().createViewRoot();
     
      Context appContext = new ApplicationContext( externalContext.getApplicationMap() );
      appContext.set( Seam.getComponentName(Init.class), new Init() );
      appContext.set(
            Seam.getComponentName(ConversationEntries.class) + ".component",
            new Component(ConversationEntries.class, appContext)
         );
View Full Code Here

Examples of javax.faces.context.ExternalContext

    public void testContexts() {
        MockServletContext servletContext = new MockServletContext();
        ServletLifecycle.beginApplication(servletContext);
        MockHttpSession session = new MockHttpSession(servletContext);
        MockHttpServletRequest request = new MockHttpServletRequest(session);
        final ExternalContext externalContext = new MockExternalContext(
                servletContext, request);
        final Map sessionAdaptor = new ServletRequestSessionMap(request);
        Map requestAdaptor = new ServletRequestMap(request);
        Context appContext = new ApplicationContext(externalContext
                .getApplicationMap());
        installComponent(appContext, ConversationEntries.class);
        installComponent(appContext, Manager.class);
        appContext.set(Seam.getComponentName(Init.class), new Init());
        FacesLifecycle.beginRequest(externalContext);
        Manager.instance().setLongRunningConversation(true);
        testContext(new ApplicationContext(externalContext.getApplicationMap()));
        testContext(new SessionContext(sessionAdaptor));
        testContext(new EventContext(requestAdaptor));
        testContext(new ServerConversationContext(sessionAdaptor, "1"));
        testEquivalence(new ContextCreator() {
            public Context createContext() {
                return new ServerConversationContext(sessionAdaptor, "1");
            }
        });
        testEquivalence(new ContextCreator() {
            public Context createContext() {
                return new SessionContext(sessionAdaptor);
            }
        });
        testEquivalence(new ContextCreator() {
            public Context createContext() {
                return new ApplicationContext(externalContext.getApplicationMap());
            }
        });
        testIsolation(new ServerConversationContext(sessionAdaptor, "1"),
                new ServerConversationContext(sessionAdaptor, "2"));
        // testIsolation( new WebSessionContext(externalContext), new
View Full Code Here

Examples of javax.faces.context.ExternalContext

   }

   public void gotoAuthorizationURL(OAuthServiceHandler service) throws IOException
   {
      setCurrentServiceHdl(service);
      ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
      externalContext.redirect(getAuthorizationURL());
   }
View Full Code Here

Examples of javax.faces.context.ExternalContext

     * @param name The name of the validator
     */
    public static ValidatorResources getValidatorResources()
    {
        final FacesContext context = FacesContext.getCurrentInstance();
        final ExternalContext external = context.getExternalContext();
        final Map applicationMap = external.getApplicationMap();
        ValidatorResources validatorResources = (ValidatorResources)applicationMap.get(VALIDATOR_RESOURCES_KEY);
        if (validatorResources == null)
        {
            final String rulesResource = RULES_LOCATION;
            final String validationResource = "/WEB-INF/validation.xml";
            final InputStream rulesInput = external.getResourceAsStream(rulesResource);
            if (rulesInput == null)
            {
                throw new JSFValidatorException("Could not find rules file '" + rulesResource + "'");
            }
            final InputStream validationInput = external.getResourceAsStream(validationResource);
            if (validationInput != null)
            {
                final InputStream[] inputs = new InputStream[] {rulesInput, validationInput};
                try
                {
View Full Code Here

Examples of javax.faces.context.ExternalContext

     */
    private Class getValidatorClass()
        throws ClassNotFoundException
    {
        final FacesContext context = FacesContext.getCurrentInstance();
        final ExternalContext external = context.getExternalContext();
        final Map applicationMap = external.getApplicationMap();
        final String validatorClassName = this.validatorAction.getClassname();
        Class validatorClass = (Class)applicationMap.get(validatorClassName);
        if (validatorClass == null)
        {
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
View Full Code Here

Examples of javax.faces.context.ExternalContext

        return map;
    }

    @SuppressWarnings("unchecked")
    private synchronized Map<Integer, RenderContext> getRenderContextMap() {
        ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
        Map<String, Object> sessionMap = externalContext.getSessionMap();
        Map<Integer, RenderContext> renderContextMap;
        if (sessionMap.containsKey(SESSION_KEY_PREFIX)) {
            renderContextMap = (Map<Integer, RenderContext>) sessionMap.get(SESSION_KEY_PREFIX);
        } else {
            renderContextMap = new ConcurrentHashMap<Integer, RenderContext>();
View Full Code Here

Examples of javax.faces.context.ExternalContext

        String conversationIdParam = Manager.instance().getConversationIdParameter();
        if (propagateConversationurl = url + "?"+conversationIdParam+"=" + org.jboss.seam.core.Conversation.instance().getId();

        if (getFragment() != null) url = url + "#" + fragment;
       
        ExternalContext ctx = FacesContext.getCurrentInstance().getExternalContext();
        try {
            log.debug("redirecting to URL: " + url);
            ctx.redirect(ctx.encodeResourceURL(url));
        } catch (IOException ioe) {
            throw new RedirectException(ioe);
        }
        FacesContext.getCurrentInstance().responseComplete();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.