Dynaview ID using Rewrite

Splash Forums Rewrite Users Dynaview ID using Rewrite

This topic contains 3 replies, has 2 voices, and was last updated by  Lincoln Baxter III 3 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #24208

    marciodel
    Participant

    Hello,

    I would like to know if it is possible to create a Rule that do the same as a Dynaview Rule in Prettyfaces.

    Thanks in advance,
    Marcio Alves

    #24212

    Hi Marciodel,

    Yes, you can do this with a Rule configuration, but it would require some creativity 🙂

    Basically you’d need to re-implement dyna-view using Rewrite rules; nothing should stop you from doing that, but there is nothing out-of-box that you can use today.

    You can, however, continue to use PrettyFaces configuration with Rewrite, so you still have that option.

    We could think about implementing DynaView in Rewrite. Would you like to assist or perhaps contribute the code for this? We could release it in the next version of Rewrite.

    ~Lincoln

    #24224

    marciodel
    Participant

    Hi Lincoln,

    If I correctly undesrtood, I need to create a custom Rule that accepts an EL value expression in the “to()” field.
    Is this correct?

    Thanks,
    MarcioDEL

    #24225

    Hmmm, well. You probably don’t need to create a custom Rule. You could, but you can probably achieve the same result simply by combining a few rules and EL methods. Depending on the scope of your bean, you may not even need to use EL at all, and you could possibly just inject it into the configuration directly.

    For that you will need to include the rewrite-integration-cdi.

    
    @Inject ViewBean bean;
    
    .addRule()
    .when(Direction.isInbound().and(Path.matches("/blah")))
    .perform(new HttpOperation() {
       public void performHttp(HttpServletRewrite event, EvaluationContext context) {
          Forward.to(bean.getView()).perform(event, context);
       }
    }
    )

    Does that make sense?

    Otherwise, you can implement something like this (using FacesContext instead of PrettyContext):

    https://github.com/ocpsoft/rewrite/blob/master/config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/config/dynaview/DynaviewEngine.java#L93

    If you wanted to convert this to a rule, we could probably add it to the Rewrite Integration-Faces module.

    Cheers,
    Lincoln

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Comments are closed.