Package org.ocpsoft.rewrite.config

Examples of org.ocpsoft.rewrite.config.Operation


   {

      // create an Operation for executing this method
      Method method = context.getJavaMethod();
      El el = El.retrievalMethod(context.getJavaClass(), method.getName());
      Operation plainOperation = Invoke.binding(el);

      // let subsequent handlers enrich the operation
      context.put(Operation.class, plainOperation);
      chain.proceed();
      Operation enrichedOperation = (Operation) context.get(Operation.class);
      Assert.notNull(enrichedOperation, "Operation was removed from the context");

      // append this operation to the rule
      context.getRuleBuilder().perform(Operations.onInbound(enrichedOperation));
View Full Code Here


{
   @Test
   public void testBuildConfigurationMetadata()
   {
      Configuration config = ConfigurationBuilder.begin().addRule()
               .perform(new Operation() {
                  @Override
                  public void perform(Rewrite event, EvaluationContext context)
                  {}
               });
View Full Code Here

   @Test
   public void testBuildConfigurationMetadataOtherwise()
   {
      Configuration config = ConfigurationBuilder.begin().addRule()
               .perform(new Operation() {
                  @Override
                  public void perform(Rewrite event, EvaluationContext context)
                  {}
               })
               .otherwise(new Operation() {

                  @Override
                  public void perform(Rewrite event, EvaluationContext context)
                  {}
               });
View Full Code Here

               .addRule()
               .perform(Log.message(Level.INFO, "Just loggin somethin'."))

               .addRule()
               .when(Path.matches("/internalMetadata"))
               .perform(new Operation() {
                  @Override
                  public void perform(Rewrite event, EvaluationContext context)
                  {
                     throw new IllegalStateException("expected");
                  }
View Full Code Here

               /*
                * Perform an operation after restore view.
                */
               .addRule()
               .when(Path.matches("/empty.xhtml").and(DispatchType.isRequest()))
               .perform(PhaseOperation.enqueue(new Operation() {

                  @Override
                  public void perform(Rewrite event, EvaluationContext context)
                  {
                     if (PhaseId.RESTORE_VIEW.equals(FacesContext.getCurrentInstance().getCurrentPhaseId()))
                        SendStatus.code(203).perform(event, context);
                     else
                        SendStatus.code(503).perform(event, context);
                  }
               }).after(PhaseId.RESTORE_VIEW))

               /*
                * Perform before Render Response
                */
               .addRule()
               .when(Path.matches("/render_response").and(DispatchType.isRequest()))
               .perform(Forward.to("/empty.xhtml").and(PhaseOperation.enqueue(new Operation() {
                  @Override
                  public void perform(Rewrite event, EvaluationContext context)
                  {
                     if (PhaseId.RENDER_RESPONSE.equals(FacesContext.getCurrentInstance().getCurrentPhaseId()))
                        SendStatus.code(204).perform(event, context);
View Full Code Here

   @Override
   public void process(ClassContext context, IgnorePostback annotation, HandlerChain chain)
   {

      if (context instanceof MethodContext) {
         Operation operation = (Operation) context.get(Operation.class);
         if (operation != null) {
            // replace the operation with a wrapped one that ignores postbacks
            context.put(Operation.class, new IgnorePostbackOperation(operation));
         }
      }
View Full Code Here

      if (context instanceof MethodContext) {

         Method method = ((MethodContext) context).getJavaMethod();

         // locate the operation previously created by @RequestAction
         Operation operation = (Operation) context.get(Operation.class);
         if (operation != null) {

            PhaseOperation<?> deferred = PhaseOperation.enqueue(operation, 10);

            // configure the target phase
View Full Code Here

TOP

Related Classes of org.ocpsoft.rewrite.config.Operation

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.