Outbound URL rewriting issue

Splash Forums PrettyFaces Users Outbound URL rewriting issue

This topic contains 6 replies, has 3 voices, and was last updated by  Zhomart 6 years ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17926

    Zhomart
    Participant

    Hi guys,

    I am curious, why if I have several <url-mapping>’s with different id, but mapped to the same view-id, all the <h:link>’s with outcome with any of this url-mapping ID’s would result in anchor that is referencing to the FIRST url-mapping?

    Example:

    <url-mapping id=”id1″>

    <pattern value=”/page1″ />

    <view-id>/page</view-id>

    </url-mapping>

    <url-mapping id=”id2″>

    <pattern value=”/page2″ />

    <view-id>/page</view-id>

    </url-mapping>

    and

    <h:link outcome=”pretty:id2″ value=”link” /> would result in “/page1”!!! WHY?

    #20926

    Hey there,

    the problem is that there is now way for us to find out what mapping this h:link is referring to. I think in most cases there is only one PrettyFaces mapping for a view. So the outbound rewriting works well in nearly all cases.

    If you want more control over the link generated, I suggest to take a look at the pretty:link component:

    http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/components.html#components.prettylink

    #20927

    Correct. In order to integrate with the JSF navigation system, PrettyFaces must replace the “pretty:id2” value with “/page” before the link is rendered. After the link is rendered, PrettyFaces then attempts to perform outbound rewriting on “/link”, for which it finds mapping “id1”

    However, we could actually do something a bit tricky here, and try to “embed” some metadata into the view-id if outbound rewriting is enabled, something like:

    “/view{com.ocpsoft.mappingid.rewrite=id2}”

    This would then be removed by prettyfaces when the outbound rewrite occurs in PrettyFacesWrappedResponse, resulting in:

    “/page2”

    However, I’m not really sure how safe this would be, since it is quite hack-ish.

    Thoughts?

    ~Lincoln

    #20928

    Actually, this would also solve the dynaview incompatibility here as well.

    #20929

    Interesting idea. Theoretically this would be possible. But I think we should use the query-parameter-like syntax that is already used in JSF when returning something like /view?faces-redirect=true&includeViewParams=true.

    So we could use something like this: /view?com.ocpsoft.mappingid=srcMappingId.

    #20930

    I’ll take a stab at that tomorrow. I think it’s good!

    #20931

    Zhomart
    Participant

    Thx guys for the responses,

    It was friday evening after tough week =)

    my bad, I shouldn’t make one view to be responsible for several pages…

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

You must be logged in to reply to this topic.

Comments are closed.