0 Replies Latest reply on Jul 28, 2016 4:14 AM by Colin PUY

    servletRequest.getAttribute("javax.servlet.forward.query_string") returns null when query string is empty

    Colin PUY Newbie

      Hi all,

       

      We are unable to deploy our application in Wildfly due to a NPE in a framework we use (restlet, see NullPointerException on forwarded request with Wildfly 9.0.2 · Issue #1225 · restlet/restlet-framework-java · GitHub)

       

      This is due to the fact that, on forwarded request with no query string, servletRequest.getAttribute("javax.servlet.forward.query_string") returns null. (please note that the attribute is there but the value is null)

      In ServletRequest javadoc (ServletRequest (Java EE 6 )) it is said "Returns the value of the named attribute as an Object, or null if no attribute of the given name exists. "

       

      It looks to me as an undertow's bug since, IMHO servletRequest.getAttribute("javax.servlet.forward.query_string") should return an empty string when query string is empty.

      Indeed, in my understanding, servletRequest.getAttribute(attributeName) should return  null only when attributeName does not exists and, in this case, 'javax.servlet.forward.query_string' exists but its value is null.

       

      Any opinion on that issue ?

      Thanks.

       

      Colin