[1.2.4] No addHeader in Response?

170 views
Skip to first unread message

guldner

unread,
May 25, 2012, 1:12:36 AM5/25/12
to play-fr...@googlegroups.com
Hi
I'm working on a module to provide NTLM authentication using waffle. Now I've hit a bit of a wall. Http.Response does not have an 'addHeader' method, only a setHeader and I want to set more than one WWW-Authenticate header.
I've got the NTLM/Negotiate authentication working, but I have to choose either NTLM or Negotiate, and would also like to be able to let users through to a login page that cannot use NTLM (or Negotiate).
Any ideas?

Christian Guldner

Ivan San José García

unread,
May 25, 2012, 4:24:58 AM5/25/12
to play-fr...@googlegroups.com
I think setHeader() method already do that. If the Header which you specified is not in the response, Play! will add it.

See source code of Play! for further information.

2012/5/25 guldner <gul...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/VpPgmbkRAlMJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

guldner

unread,
May 25, 2012, 7:54:39 AM5/25/12
to play-fr...@googlegroups.com
Right. But if a header is already present, setHeader will replace it. Not add another. And this is my problem.

Chr


On Friday, May 25, 2012 10:24:58 AM UTC+2, ivansjg wrote:
I think setHeader() method already do that. If the Header which you specified is not in the response, Play! will add it.

See source code of Play! for further information.

Ivan San José García

unread,
May 25, 2012, 9:06:57 AM5/25/12
to play-fr...@googlegroups.com
Ah, ok, now I understand your problem.

Try to put directly in response.headers. Something like this:

 String headerName = "WWW-Authenticate";
 Header h = new Header();
 h.name = headerName;
 h.values = new ArrayList<String>(2);
 h.values.add("NTLM");
 h.values.add("Negotiate");
 response.headers.put(headerName, h);

2012/5/25 guldner <gul...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/u1gmMjoKAgUJ.
Reply all
Reply to author
Forward
0 new messages