[MAGNOLIA-5914] Update TemplatingFunctions to support querystrings in redirects Created: 10/Sep/14  Updated: 17/Dec/14  Resolved: 15/Sep/14

Status: Closed
Project: Magnolia
Component/s: templating
Affects Version/s: 5.3.2
Fix Version/s: 5.2.9, 5.3.4

Type: Improvement Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Christopher Zimmermann
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
is depended upon by MGNLSTK-1366 Allow query parameters to be used in ... Closed
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   

In order to allow STK redirects to specify querystrings it would be helpful to have a method to retrieve the querystring and fragment from a url.
For example, given http://url?a=1&b=2#c , the method should return ?a=1&b=2#c.

Additionally, contentByPath and nodeByPath must remove the querystring and fragment from url's before calling SessionUtil.getNode(), so that the calls succeed.



 Comments   
Comment by Christopher Zimmermann [ 10/Sep/14 ]

Add getQueryStringAndFragment to TemplatingFunctions. contentByPath and nodeByPath strip querystring and fragment before calling SeesionUtil.getNode().

Comment by Daniel Lipp [ 12/Sep/14 ]

TemplatingFunctions:

  • getQueryStringAndFragment: myString != null && !myString.isEmpty() should be simplified to StringUtils.isNotEmpty(myString)
  • contentByPath should delegate to nodeByPath so it doesn’t have to copy the conversion via URI and the catching of the exception - DRY
  • Tests
  • changes to nodeByPath and contentByPath have to be covered by unit-tests as well
  • the convention is to import org.hamcrest.core.IsEqual statically so we can write: assertThat(x, equalTo("")) instead of assertThat(x, IsEqual.equalTo(""))
  • all code should be formatted using our default - at least the new test method’s aren’t
Comment by Christopher Zimmermann [ 15/Sep/14 ]

Implemented review comments.

Generated at Mon Feb 12 04:09:35 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.