Issue 1:
Frans Flippo opened SPR-9098 and commented

Say I have a Controller with the following request mapping:

@RequestMapping(value = "/{group}/{identifier}", method = RequestMethod.GET)

Current behavior:

If one of the PathVariable components (e.g. "identifier" in the above example) contains a URL encoded slash (%2F), the handler is NOT invoked for that request, e.g.

http://myhost/myservlet/group/a%2Fb

Expected behavior:

If one of the PathVariable comonents (e.g. "identifier" in the above example) contains a URL encoded slash (%2F), the handler is invoked for that request and the URL decoded value is assigned to the path variable, e.g.

http://myhost/myservlet/group/a%2Fb

calls the handler method above with group="group" and identifier="a/b"

This is supported by the RFC which assigns special meaning to the slash character and states a slash and a URL encoded slash are NOT the same character:

RFC 3986 says (section 2.2) :

The purpose of reserved characters is to provide a set of delimiting

characters that are distinguishable from other data within a URI.

URIs that differ in the replacement of a reserved character with its

corresponding percent-encoded octet are not equivalent. Percent-

encoding a reserved character, or decoding a percent-encoded octet

that corresponds to a reserved character, will change how the URI is

interpreted by most applications. Thus, characters in the reserved

set are protected from normalization and are therefore safe to be

used by scheme-specific and producer-specific algorithms for

delimiting data subcomponents within a URI.

The actual URL decoding happens in UrlPathHelper.getLookupPathForRequest which eventually calls getRequestUri which calls decodeAndCleanUriString. This is basically too early. First the handler should be chosen and the PathVariables assigned. Then URL decoding should happen on each of the path variables' values.

If desired I can write a unit test or include a sample Controller to reproduce the above.

Note: Tomcat MUST be started with the -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true option or the request will never even land at the Spring DispatcherServlet.

Affects: 3.1 GA

Issue Links:

#11616 Decode URI template variables if the AbstractHandlerMethodMapping.setUrlDecode() property is set to false ("is duplicated by")

Referenced from: commits 57307a0

1 votes, 3 watchers

Issue 2:
Roman Borisov opened SPR-4250 and commented

If I create abstract beans with similar IDs in different context files, the framework uses abstract bean from last loaded file.

I thought, the framework will throw the exception at startup.

Example:

file beans1.xml

<beans>

<bean id="abstractNamedBean" abstract="true">

<property name="name" value="Pol"/>

</bean>

</beans>

file beans2.xml

<beans>

<bean id="abstractNamedBean" abstract="true">

<property name="name" value="Scott"/>

</bean>

</beans>

file beans3.xml

<beans>

<import resource="beans1.xml"/>

<import resource="beans2.xml"/>

<!---- this bean wiil be the child of "abstractNamedBean" from beans2.xml

and no error would be reported -->

<bean id="concreteNamedBean" class="Class1" parent="abstractNamedBean">

</bean>

</beans>

Affects: 2.0.7