-
Bug
-
Resolution: Done
-
Major
-
2.2.3.Final
-
None
When using the rewrite() handler with a query string like so:
regex('^/jobs/([^/]+)/?(.*)$') -> rewrite('/jobseekers/home.cfm?joblocation=${1}');
the RelativePathAttribute mishandles the ? and leaves it in the query string which causes the final URL inside the exchange to have two question marks.
/jobseekers/home.cfm??joblocation=atlanta
The work around for now is to set the query string via a separate handler
regex('^/jobs/([^/]+)/?(.*)$') -> { rewrite('/jobseekers/home.cfm'); set(attribute='%{QUERY_STRING}', value='joblocation=${1}') }
On a related note, the QueryStringAttribute has a similar inconsistency where it includes the ? when reading the query string, but will not remove an incoming ? when writing the attribute. I would recommend having the ? cleaned off when writing for consistency between reading and writing the attribute.
In actuality, both of the issues above can be solved in one go if the HTTPServerExchange simply removes any leading ? from the start of a query string in the setQueryString() method since both the RelativePathAttribute and the QueryStringAttribute are calling that method to set their query string.
- relates to
-
UNDERTOW-1070 rewrite handler produces invalid URLs when used with query part
- Resolved