[MAGNOLIA-3814] MgnlContext.getAggregationState().getOriginalBrowserURL() returns path to template not requested URL Created: 30/Aug/11  Updated: 13/Mar/12  Resolved: 21/Sep/11

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.4.2
Fix Version/s: 4.5

Type: Bug Priority: Neutral
Reporter: Thomas Martin Assignee: Tobias Mattsson
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
duplicate
duplicates MAGNOLIA-3203 aggregation state: original uri reset... Closed
relation
is related to MAGNOLIA-3204 aggregation state loses all informati... 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)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

When calling MgnlContext.getAggregationState().getOriginalBrowserURL() the path to the template is returned.

Example:
Calling "http://localhost:8080/site/index.html" - inside a simple jsp template printing "MgnlContext.getAggregationState().getOriginalBrowserURL()" returns "http://localhost:8080/site/templates/pages/main.jsp".

Same applies to "MgnlContext.getAggregationState().getExtension()" - return "jsp" instead of "html", "MgnlContext.getAggregationState().getOriginalBrowserURI()" etc.



 Comments   
Comment by Magnolia International [ 30/Aug/11 ]

Also see http://forum.magnolia-cms.com/forum/thread.html?threadId=78eb9d11-913f-4069-81e3-4fcc25e12abb&page=1

Comment by Tobias Mattsson [ 30/Aug/11 ]

ContextFilter should check for the request attributes set on forward and use them if set instead of using the path properties on the request object.

Here's what the spec says:

SRV.8.4.2 Forwarded Request Parameters

Except for servlets obtained by using the getNamedDispatcher method, a servlet that has been invoked by another servlet using the forward method of RequestDispatcher has access to the path of the original request.

The following request attributes must be set:
javax.servlet.forward.request_uri
javax.servlet.forward.context_path
javax.servlet.forward.servlet_path
javax.servlet.forward.path_info
javax.servlet.forward.query_string

The values of these attributes must be equal to the return values of the HttpServletRequest methods getRequestURI, getContextPath, getServletPath, getPathInfo, getQueryString respectively, invoked on the request object passed to the first servlet object in the call chain that received the request from the client.

These attributes are accessible from the forwarded servlet via the getAttribute method on the request object. Note that these attributes must always reflect the information in the original request even under the situation that multiple forwards and subsequent includes are called.

If the forwarded servlet was obtained by using the getNamedDispatcher method, these attributes must not be set.

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