[jsfunit-dev] Setting Accept-Language header with ClientFacade

Pieter Kuijpers pieter.kuijpers at luminis.nl
Thu Aug 16 15:20:33 EDT 2007


Hi Stan,

Since ClientFacade is just a facade in front of HttpUnit, I think  
providing a getWebConversation method is a good idea. As you say,  
this allows the developer to use the convenience methods of the  
facade, but gives the developer full access when needed.

Regards,
Pieter.

Op 16-aug-2007, om 15:52 heeft Stan Silvert het volgende geschreven:

> Hi Pieter,
>
> Thanks again for your feedback.
>
> The simplest way I can see for adding this functionality to the  
> ClientFacade would be to just provide access to the  
> WebConversation.  So you would say:
>
> ClientFacade client = new ClientFacade("/foo.jsf");
> client.getWebConversation().setHeaderField("Accept-Language", "es- 
> mx,es");
>
> I've been a little leery about adding more HttpUnit-specific stuff  
> to the ClientFacade.  But I think we have to give the developer  
> full access when needed.  So, right now I think that adding  
> getWebConversation() looks like the solution.
>
> Any thoughts?
>
> Stan
>
> pieter.kuijpers at luminis.nl wrote:
>> I'm testing a JSF application that has support for  
>> internationalization. Pages are rendered in the correct language  
>> based on the Accept-Language header in a request.
>> I can set the Accept-Language header in a unit test by invoking  
>> request.setHeaderField on a WebRequest that I have created through  
>> a WebConversation. I like the convenience of the ClientFacade  
>> though, and would like to use that instead of the  
>> WebConversationFactory / WebConversation.
>> When I use the ClientFacade, there is no Accept-Language header  
>> set in the WebRequest. This results in ServletRequest.getLocale  
>> returning the server default Locale as the preferred locale for  
>> the request. Since I need the tests to run correctly on servers  
>> with different default locales, this is undesirable for me.
>> Is there a way to set the Accept-Language header when using  
>> ClientFacade for setting up the WebConversation? It would be best  
>> to be able to set the Locale once for the entire conversation, so  
>> that the correct header is set in each WebRequest.
>> Regards,
>> Pieter Kuijpers
>> --------------------------------------------------------------------- 
>> ---
>> _______________________________________________
>> jsfunit-dev mailing list
>> jsfunit-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jsfunit-dev
>

--
  Pieter Kuijpers
Senior software engineer luminis®
-------------------------------------------------
06 174 185 34
pieter.kuijpers at luminis.nl
www.luminis.nl
-------------------------------------------------


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jsfunit-dev/attachments/20070816/58b81062/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: onbekend.jpg
Type: image/jpeg
Size: 1397 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/jsfunit-dev/attachments/20070816/58b81062/attachment.jpg 


More information about the jsfunit-dev mailing list