[MAGNOLIA-1654] Allow regular expression in virtual uris Created: 02/Aug/07  Updated: 23/Jan/13  Resolved: 06/Aug/07

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 3.1 M1
Fix Version/s: 3.1 M2

Type: Improvement Priority: Minor
Reporter: Fabrizio Giustina Assignee: Fabrizio Giustina
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

A nice addition to current virtual uri mappings would be the ability to use regular expression for the original uri and to use matches in the destination one.
For example:

fromURI=regexp:/products/([0-9A-Z]+)\.html
toURI=/product/detail.html?productId=$1



 Comments   
Comment by Fabrizio Giustina [ 02/Aug/07 ]

added to trunk. You need to use the "regexp:" prefix in fromURI to use this new features.
Unfortunately this is not really very useful because of MAGNOLIA-1655 (but you can happily use parameters in redirects)

Comment by Magnolia International [ 03/Aug/07 ]

Shouldn't this be solved by implementing another VirtualURIMapping and adding a class property in the configuration node instead?

Comment by Philipp Bracher [ 03/Aug/07 ]

It should. Fabrizio can you change that?

Comment by Fabrizio Giustina [ 03/Aug/07 ]

ok, I'll fix as suggested
(once more, I original implemented a RegExpVirtualUri class, but then decided that this way it could be easier for users. We already use prefixes in toURI for redirect: and forward:, having a regexp: prefix in the source uri looked more consistent to me...)

Comment by Magnolia International [ 03/Aug/07 ]

well, maybe we should rewrite these (redirect, forward) as well then

About the ease-of-use, we COULD introduce some sort of shortcut names for the provided implementations. otoh, just having the class name makes it obvious, and if you can read javadoc, you can find the existing implementations - or we could generate custom docs if we had too much time on our hands.

We've also been considering the idea of not having a default impl, thus adding the class property for all entries, making it more obvious that its how it works.

Comment by Fabrizio Giustina [ 06/Aug/07 ]

reworked as suggested. The "regexp:" suffix doesn't work anymore, you have to explicitly add a class property with the new implementation.

(PS. forward: and redirect: stay as is since they are managed externally)

Generated at Mon Feb 12 03:29:01 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.