Package org.jboss.seam.contexts

Examples of org.jboss.seam.contexts.Context


      //org.jboss.seam.bpm.SeamVariableResolver jbpmVariableResolver = new org.jboss.seam.bpm.SeamVariableResolver();
     
      MockServletContext servletContext = new MockServletContext();
      ServletLifecycle.beginApplication(servletContext);
      MockExternalContext externalContext = new MockExternalContext(servletContext);
      Context appContext = new ApplicationContext( externalContext.getApplicationMap() );
      //appContext.set( Seam.getComponentName(Init.class), new Init() );
      installComponent(appContext, ConversationEntries.class);
      installComponent(appContext, Manager.class);
      installComponent(appContext, Session.class);
      installComponent(appContext, ServletContexts.class);
      installComponent(appContext, Parameters.class);
      appContext.set( Seam.getComponentName(Init.class), new Init() );
     
      installComponent(appContext, Bar.class);
      installComponent(appContext, Foo.class);
      appContext.set("otherFoo", new Foo());
     
      assert !Contexts.isEventContextActive();
      assert !Contexts.isSessionContextActive();
      assert !Contexts.isConversationContextActive();
      assert !Contexts.isApplicationContextActive();
View Full Code Here


      MockHttpSession session = new MockHttpSession(servletContext);
      MockHttpServletRequest request = new MockHttpServletRequest(session);
      ExternalContext externalContext = new MockExternalContext(servletContext, request);
      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) );
View Full Code Here

   public void testBijectionInterceptor() throws Exception
   {
      MockServletContext servletContext = new MockServletContext();
      ServletLifecycle.beginApplication(servletContext);
      MockExternalContext externalContext = new MockExternalContext(servletContext);
      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)
         );
      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)
         );

      FacesLifecycle.beginRequest(externalContext);
View Full Code Here

   public void testConversationInterceptor() throws Exception
   {
      MockServletContext servletContext = new MockServletContext();
      ServletLifecycle.beginApplication(servletContext);
      MockExternalContext externalContext = new MockExternalContext(servletContext);
      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)
         );
      appContext.set(
            Seam.getComponentName(PersistenceContexts.class) + ".component",
            new Component(PersistenceContexts.class, appContext)
         );
      appContext.set(
            Seam.getComponentName(Manager.class) + ".component",
            new Component(Manager.class, appContext)
         );
      FacesLifecycle.beginRequest( externalContext );
      Manager.instance().setCurrentConversationId("1");
View Full Code Here

   public void testConversationalInterceptor() throws Exception
   {
      MockServletContext servletContext = new MockServletContext();
      ServletLifecycle.beginApplication(servletContext);
      MockExternalContext externalContext = new MockExternalContext(servletContext);
      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)
         );
      appContext.set(
            Seam.getComponentName(Manager.class) + ".component",
            new Component(Manager.class, appContext)
         );
      appContext.set(
            Seam.getComponentName(FacesMessages.class) + ".component",
            new Component(FacesMessages.class, appContext)
         );
      appContext.set(
               Seam.getComponentName(Events.class) + ".component",
               new Component(Events.class, appContext)
            );
      FacesLifecycle.setPhaseId(PhaseId.INVOKE_APPLICATION);
      FacesLifecycle.beginRequest( externalContext );
View Full Code Here

      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)
         );
      appContext.set(
            Seam.getComponentName(Manager.class) + ".component",
            new Component(Manager.class, appContext)
         );
      appContext.set(
            Seam.getComponentName(FacesMessages.class) + ".component",
            new Component(FacesMessages.class, appContext)
         );
      appContext.set(
            Seam.getComponentName(Interpolator.class) + ".component",
            new Component(Interpolator.class, appContext)
         );
      FacesLifecycle.setPhaseId(PhaseId.INVOKE_APPLICATION);
      FacesLifecycle.beginRequest(externalContext);
View Full Code Here

   public void testRemoveInterceptor() throws Exception
   {
      MockServletContext servletContext = new MockServletContext();
      ServletLifecycle.beginApplication(servletContext);
      MockExternalContext externalContext = new MockExternalContext(servletContext);
      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)
         );
      appContext.set(
            Seam.getComponentName(Manager.class) + ".component",
            new Component(Manager.class, appContext)
         );

      FacesLifecycle.beginRequest( externalContext );
View Full Code Here

      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

  }

  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");
    }

    performPageActions(facesContext);

    if (facesContext.getResponseComplete()) {
View Full Code Here

*/
public abstract class DigestAuthenticator
{
   protected boolean validatePassword(String password)
   {
      Context ctx = Contexts.getSessionContext();
     
      DigestRequest digestRequest = (DigestRequest) ctx.get(DigestRequest.DIGEST_REQUEST);
      if (digestRequest == null)
      {
         throw new IllegalStateException("No digest request found in session scope");
      }
     
      // Remove the digest request from the session now
      ctx.remove(DigestRequest.DIGEST_REQUEST);
     
      // Calculate the expected digest
      String serverDigestMd5 = DigestUtils.generateDigest(
               digestRequest.isPasswordAlreadyEncoded(),
               Identity.instance().getUsername(), digestRequest.getRealm(),
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.