Package org.jboss.seam.contexts

Examples of org.jboss.seam.contexts.Context


         throws ServletException, IOException
   {
      // Force session creation
      httpRequest.getSession();

      Context ctx = new SessionContext(new ServletRequestSessionMap(httpRequest));

      // Only reauthenticate if username doesn't match Identity.username
      // and user isn't authenticated
      Credentials credentials = (Credentials) ctx.get(Credentials.class);
      Identity identity = (Identity) ctx.get(Identity.class);

      if (identity.isLoggedIn())
      {
         throw new RuntimeException("User is already logged in.");
      }

      credentials.setPassword("");
      authenticate(httpRequest, user);
      RelayStates relayStates = (RelayStates) ctx.get(RelayStates.class);
      String relayState = httpRequest.getParameter("RelayState");
      if (relayState == null)
      {
         throw new RuntimeException("RelayState parameter is missing");
      }
View Full Code Here


   }

   private void installComponents(Init init)
   {
      log.debug("Installing components...");
      Context context = Contexts.getApplicationContext();

      DependencyManager manager = new DependencyManager(componentDescriptors);

      Set<ComponentDescriptor> installable = manager.installedSet();     
      for (ComponentDescriptor componentDescriptor: installable)
      {
          String compName = componentDescriptor.getName() + COMPONENT_SUFFIX;

          if ( !context.isSet(compName) )
          {
              addComponent(componentDescriptor, context);

              if ( componentDescriptor.isAutoCreate() )
              {
View Full Code Here

      DataBinder wrapper = createWrapper( dataModelGetter.getAnnotation() );
      Object list = dataModelGetter.get(bean);
      String name = dataModelGetter.getName();
      Annotation dataModelAnn = dataModelGetter.getAnnotation();
      ScopeType scope = wrapper.getVariableScope(dataModelAnn);     
      Context context = getOutScope(scope, this).getContext();
      Object existingDataModel = context.get(name);
     
      boolean dirty = existingDataModel == null ||
            wrapper.isDirty(dataModelAnn, existingDataModel, list);
      boolean reoutject = existingDataModel!=null && scope==PAGE;
     
      if (dirty)
      {
         if ( list!=null )
         {
            context.set( name, wrapper.wrap(dataModelAnn, list) );
         }
         else
         {
            context.remove(name);
         }
      }
      else if (reoutject)
      {
         context.set(name, existingDataModel);
      }
        
   }
View Full Code Here

   protected void beforeRenderResponse(FacesContext facesContext)
   { 
     
      if ( Contexts.isPageContextActive() )
      {
         Context pageContext = Contexts.getPageContext();
         //after every time that the view may have changed,
         //we need to flush the page context, since the
         //attribute map is being discarder
         pageContext.flush();
         //force refresh of the conversation lists (they are kept in PAGE context)
         pageContext.remove(Seam.getComponentName(Switcher.class));
         pageContext.remove("org.jboss.seam.core.conversationList");
         pageContext.remove("org.jboss.seam.core.conversationStack");
      }
     
      preRenderPage(facesContext);
     
      if ( facesContext.getResponseComplete() )
View Full Code Here

   }

   private void installComponents(Init init)
   {
      log.info("Installing components...");
      Context context = Contexts.getApplicationContext();

      DependencyManager manager = new DependencyManager(componentDescriptors);

      Set<ComponentDescriptor> installable = manager.installedSet();     
      for (ComponentDescriptor componentDescriptor: installable)
      {
          String compName = componentDescriptor.getName() + COMPONENT_SUFFIX;

          if ( !context.isSet(compName) )
          {
              addComponent(componentDescriptor, context);

              if ( componentDescriptor.isAutoCreate() )
              {
View Full Code Here

      DataBinder wrapper = createWrapper( dataModelGetter.getAnnotation() );
      Object list = dataModelGetter.get(bean);
      String name = dataModelGetter.getName();
      Annotation dataModelAnn = dataModelGetter.getAnnotation();
      ScopeType scope = wrapper.getVariableScope(dataModelAnn);     
      Context context = getOutScope(scope, this).getContext();
      Object existingDataModel = context.get(name);
     
      boolean dirty = existingDataModel == null ||
            wrapper.isDirty(dataModelAnn, existingDataModel, list);
      boolean reoutject = existingDataModel!=null && scope==PAGE;
     
      if (dirty)
      {
         if ( list!=null )
         {
            context.set( name, wrapper.wrap(dataModelAnn, list) );
         }
         else
         {
            context.remove(name);
         }
      }
      else if (reoutject)
      {
         context.set(name, existingDataModel);
      }
        
   }
View Full Code Here

     * We intercept here and redirect the user in case of inconsistencies.
     */
    public void beforePhase(PhaseEvent arg0) {

        FacesContext context = arg0.getFacesContext();
        Context session = Contexts.getSessionContext();
        if (session == null) {
            return;
        }

        PlanetsUserManager userManager = PlanetsUserManager.createUserManager();
View Full Code Here

            log.debug("Couldn't get SessionID");
        }

        try {
            log.debug("Ending Session "+id);
            Context session = Contexts.getSessionContext();
            if (loadPlan != null) {
                loadPlan.unlockProject();
            }

            session.remove("user");
            session.remove("selectedPlan");
            session.set("changed", "");
            org.jboss.seam.web.Session.instance().invalidate();
        } catch (RuntimeException e) {
            return "login";
        }
        return null;
View Full Code Here

      MockHttpSession session = new MockHttpSession(servletContext);
      MockHttpServletRequest request = new MockHttpServletRequest(session);
      ExternalContext externalContext = new MockExternalContext(servletContext, request);
      ContextAdaptor sessionAdaptor = new ServletSessionImpl(session);
      ContextAdaptor requestAdaptor = new ServletRequestImpl(request);
      Context appContext = new FacesApplicationContext(externalContext);
      appContext.set(
            Seam.getComponentName(ConversationEntries.class) + ".component",
            new Component(ConversationEntries.class, appContext)
         );
      appContext.set(
            Seam.getComponentName(Manager.class) + ".component",
            new Component(Manager.class)
         );
      appContext.set( Seam.getComponentName(Init.class), new Init() );
      Lifecycle.beginRequest(externalContext);
      Manager.instance().setLongRunningConversation(true);
      testContext( new FacesApplicationContext(externalContext) );
      testContext( new WebSessionContext(sessionAdaptor) );
      testContext( new WebRequestContext(requestAdaptor) );
View Full Code Here

   @Test
   public void testBijectionInterceptor() throws Exception
   {
      MockServletContext servletContext = new MockServletContext();
      MockExternalContext externalContext = new MockExternalContext(servletContext);
      Context appContext = new FacesApplicationContext(externalContext);
      appContext.set( Seam.getComponentName(Init.class), new Init() );
      appContext.set(
            Seam.getComponentName(ConversationEntries.class) + ".component",
            new Component(ConversationEntries.class, appContext)
         );
      appContext.set(
            Seam.getComponentName(Manager.class) + ".component",
            new Component(Manager.class, appContext)
         );
      appContext.set(
            Seam.getComponentName(Foo.class) + ".component",
            new Component(Foo.class, appContext)
         );
      appContext.set(
            Seam.getComponentName(Factory.class) + ".component",
            new Component(Factory.class, appContext)
         );

      Lifecycle.beginRequest( externalContext );
View Full Code Here

TOP

Related Classes of org.jboss.seam.contexts.Context

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.