[wildfly-dev] Servlet Samples on Beta2 snapshot

Arun Gupta arun.gupta at gmail.com
Fri Nov 1 09:26:05 EDT 2013


>> 1). An HttpOnly cookie is set as:
>>
>> cookie = new Cookie("myHttpOnlyCookieKey", "myHttpOnlyCookieValue");
>> cookie.setHttpOnly(true);
>> cookie.setMaxAge(60);
>> response.addCookie(cookie);
>>
>> and
>>
>> document.write(document.cookie);
>>
>> displays the cookie and its value.
>
>
> This is a bug, I have fixed this in undertow upstream.

Filed https://issues.jboss.org/browse/UNDERTOW-120 for tracking purpose.

>>
>> 3). file-upload sample allows to upload a file and writes it to /tmp
>> directory as:
>>
>> for (Part part : request.getParts()) {
>> fileName = part.getSubmittedFileName();
>> part.write(fileName);
>> }
>>
>> part.write() is not throwing any exception but not even writing the file.
>
>
> Another bug, I have fixed in undertow upstream.

Filed https://issues.jboss.org/browse/UNDERTOW-121 for tracking.

>
> BTW, you should not really be doing:
>
> try (PrintWriter out = response.getWriter())
>
> There is no need for as it as the container will automatically close the
> response for you, and it breaks error page handling, e.g:
>
> try (PrintWriter out = response.getWriter()) {
>   throw new MyException();
> }
>
> Will never generate an error page, as the try block will close the writer
> which commits the response.

Agreed, this is going to be a small change but will be across all my tests now.

>
> Next release of Undertow should be soon, basically straight after the next
> XNIO beta release.

When will this be integrated in WildFly trunk ?

>> Adding a user in the default realm, as expected, did not pass
>> authentication for the secure page. How should the user be added such
>> that the credentials can be used in an application ?
>
>
> If you just do add-user.sh with no arguments and follow the prompts it will
> work.
>
> The correct command line is:
>
> ./bin/add-user.sh -g g1-u u1 -p p1 -r ApplicationRealm -up
> application-users.properties -gp application-roles.properties

Thanks for the complete command, that worked!

Just wondering what other values can be taken by the last two
arguments ? And why would they need a different value ?

Arun

http://blog.arungupta.me
http://twitter.com/arungupta


More information about the wildfly-dev mailing list