Make return value of HttpServletRequest.getServletPath/getRequestURI/getRequestURL configurable (DeploymentInfo.setPreservePathOnForward)

In  undertow

Overview

This feature is to support a backwards compatible behavior of HttpServletRequest.getServletPath in Undertow.

In an Struts2 application deployed to EAP6, this method returns the action name, but in EAP7 it returns the forwarded jsp name.

Undertow’s DeploymentInfo API was updated to support that behavior (via DeploymentInfo.setPreservePathOnForward) and now we need to make that behavior configurable in EAP7. Notice that, for consistency reasons, the returned value of HttpServletRequest.getRequestURI and HttpServletRequest.getRequestURL are also affected by the same configuration, making them return the URI/URL with the action name if DeploymentInfo.preservePathOnForward is set to true.

Issue Metadata

Issue

QE Contacts

Testing By

[X] Engineering

[ ] QE

Affected Projects or Components

  • WildFly, Undertow component

  • Undertow

Other Interested Projects

Requirements

This will be implemented as an additional attribute under the /subsystem=undertow/servlet-container=<name> management model address.

This will be a simple boolean attribute called preserve-path-on-forward that marks the path to be preserved or not. The default value must be false to keep backwards compatibility to Undertow’s previous versions and to keep compatibility with the default in the tech preview, i.e, in JBEAP-16448 PR

Hard Requirements

Nice-to-Have Requirements

Non-Requirements

Test Plan

A new test will be added to verify that HttpServletRequest.getServletPath, HttpServletRequest.getRequestURI, and HttpServletRequest.getRequestURL all return a preserved path on forward if preserve-path-on-forward is set to true.

Community Documentation

Update the WildFly documentation to document the new attribute, and the affected behavior.