[jboss-jira] [JBoss JIRA] (WFLY-3467) Wildfly URI encoding (again..)

Bob Slydell (JIRA) issues at jboss.org
Sat Jun 7 05:42:15 EDT 2014


Bob Slydell created WFLY-3467:
---------------------------------

             Summary: Wildfly URI encoding (again..)
                 Key: WFLY-3467
                 URL: https://issues.jboss.org/browse/WFLY-3467
             Project: WildFly
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Web (Undertow)
    Affects Versions: 8.1.0.Final
         Environment: Linux CentOS
            Reporter: Bob Slydell
            Assignee: Stuart Douglas


I have a very simple Servlet

@WebServlet("/HelloServlet")
public class HelloServlet extends HttpServlet

with a doGet method that prints and returns the "foo" parameter:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = response.getWriter();
		String foo = request.getParameter("foo");
		out.println("Hello " + foo);
		System.out.println("Hello " + foo);
		out.close();
	}

When running jboss 7.1.1.Final this works fine. I can test with a simple curl script:

curl http://127.0.0.1:8080/hello-1/HelloServlet?foo=b$'\xc3\xa5'r

where  $'\xc3\xa5' is "aring" or "a with a ring", (å). I know the console can handle this, because echo $'\xc3\xa5' gives:

[slydell at localhost hello]$ echo $'\xc3\xa5'
å
[slydell at localhost hello]$ 

If I run the curl script on jboss 7.1.1.Final I get:

[slydell at localhost hello]$ curl http://127.0.0.1:8080/hello-1/HelloServlet?foo=b$'\xc3\xa5'r
Hello bår
[slydell at localhost hello]$

and the jboss console output says:
09:18:19,483 INFO  [stdout] (http--127.0.0.1-8080-1) Hello bår

I can change this output by adding 
JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.connector.URI_ENCODING=UTF-8"

to the standalone.conf. With that flag I get:

09:20:57,780 INFO  [stdout] (http--127.0.0.1-8080-1) Hello bår

But when I run the curl script on wildfly 8.1.0.Final I get different results. I know that the catalina flag has no effect on undertow, and I have also tried all the workarounds I've seen, e.g.

* implement a CharacterEncoding filter
* set encoding in jboss-web.xml
* set default-encoding in servlet-containter in the standalone.xml
* set encoding in the http-listener in the standalone.xml

None of these workarounds have any effect. I always get the same result:

09:22:42,330 INFO  [stdout] (default task-1) Hello bᅢᆬr
which does not look like anything I've seen in UTF-8 or ISO-8859-1.

If I could get the same output as I do in the jboss 7.1.1.Final (without the catalina flag) I would be very happy. The standard non-modified jboss 7.1.1 gave me this output:

09:31:11,723 INFO  [stdout] (http--127.0.0.1-8080-1) Hello bår

So my question is, how do I modify/configure wildfly so that I get the same output as I do in the standard wildfly 7.1.1.Final?  I have tried the known workarounds, and they did not change any output.



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)



More information about the jboss-jira mailing list