Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » ServletBridge returns multiple values for empty url parameters (?param=)
ServletBridge returns multiple values for empty url parameters (?param=) [message #1835909] Wed, 16 December 2020 10:18 Go to next message
Linuxhippy Mising name is currently offline Linuxhippy Mising nameFriend
Messages: 72
Registered: July 2009
Member
Hi,

While hunting down an application-bug, I found the equinox servlet bridge has rather weird behaviour when it comes to empty parameters, that differ from what "normal" servlet engines seem to do.

In case of an empty parameter (?param=), getParameter("param") returns null instead of an empty string. This is the result of getParameterValues("param") actually returns a two-entry array [null, ""] and getParameter simply returns the first parameter of that array.

The reason is:
- DispatchTarget.queryStringToParameterMap() does not handle the empty parameter and inserts null as value in the map
- later, DispatchTarget.getParameterMap() checks the parameters just parsed equal the parameters returned by currentRequest.getParameterMap() - and finds that they are not equal.
The "real" servlet-engine parsed "" for the empty parameter, so that value is added to the array.

To me, as someone looking at this code without in-depth knowledge, the code seems a bit unclear (the whole file contains two one-liner comments btw.):
- Why are query parameters parsed by the servlet bridge itself not delegated to the parent servlet engine?
- Why are later the parameters parsed by the servlet engine compared to the self-parsed parameters? Wouldn't it be sufficient to simply copy the map provided by the servlet-engine (currentRequest.getParameterMap())?

Thanks & best Regards, Clemens

Re: ServletBridge returns multiple values for empty url parameters (?param=) [message #1835918 is a reply to message #1835909] Wed, 16 December 2020 13:42 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
What version of Equinox are you using? This is bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=564747

This should be fixed in the 4.17 release of the org.eclipse.equinox.http.servlet bundle version 1.6.600:

https://search.maven.org/artifact/org.eclipse.platform/org.eclipse.equinox.http.servlet/1.6.600/jar
Re: ServletBridge returns multiple values for empty url parameters (?param=) [message #1836007 is a reply to message #1835918] Fri, 18 December 2020 07:56 Go to previous message
Linuxhippy Mising name is currently offline Linuxhippy Mising nameFriend
Messages: 72
Registered: July 2009
Member
Hi Thomas,

Thanks a lot for pointing me to the bug-report - indeed this seems to be the issue we've observed (we are using 1.6.300 currently).
Glad to know this has been already fixed.

Thanks again and best regards, Clemens
Previous Topic:how to Add local archive and install in eclipse by commands
Next Topic:Equinox 4.18 not found
Goto Forum:
  


Current Time: Sat Oct 05 04:13:14 GMT 2024

Powered by FUDForum. Page generated in 0.04241 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top