Direction.isOutbound when true?

Splash Forums Rewrite Users Direction.isOutbound when true?

This topic contains 2 replies, has 2 voices, and was last updated by  anderskristian 1 year, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26592

    anderskristian
    Participant

    I have made the demo sample ExampleConfigurationProvider

    Configuration res;
    res = ConfigurationBuilder.begin()
    .addRule().when(Direction.isInbound().and(Path.matches(“/pig.html”)))
    .perform(Forward.to(“/horse.html”))
    return res;
    ..
    And it works perfect when I enter pig.html I get the horse.html

    Direction.isOutbound
    Now I have tried almost everything like…
    .addRule().when(Direction.isOutbound())
    .perform(httpOperation()) // httpOperation is a local HttpOperation that print “hello”

    Issue: The rule is NEVER NEVER NEVER triggere ???
    Event when it is the only rule… If I add httpOperation() to any sample (using .and(…))
    the only event is InboundRewrite…

    I have searched the entire source code base, I see no test I understand..
    I would very much like a sample that presents the meaning of Direction.isOutbound 🙂

    #26598

    Inbound rewrites are applied when requests of a client hit the servlet engine. The inbound rewrite can then for example forward the request to another resource.

    Outbound rewrites process the URLs when they written to the response during page rendering. To be more accurate, they are processed when URLs are processed by HttpServletResponse.encodeURL().

    So if you have a raw URL like /faces/index.xhtml and you want to change it to /index, you typically have to do two things:

    1. You must make sure that requests to /index are forwarded to /faces/index.xhtml. This is inbound rewriting.

    2. Whenever a component like h:link renders /faces/index.xhtml to a HTML page, you have to modify it to /index. That is outbound rewriting.

    Hope this helps. 😉

    #26602

    anderskristian
    Participant

    Thanks a lot Christian..
    Yes I now understand that it is HttpServletResponse.encodeURL() that is intercepted an basis for Outbound
    I made a small JSP file and used statement:

    
    <a href="<%=response.encodeURL("index.html")%>">back</a>
    

    BINGO .. Outbound was triggered

    I must grant that I am not using HttpServletResponse.encodeURL() 😉

    /Anders

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

You must be logged in to reply to this topic.

Comments are closed.