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

Stan Silvert ssilvert at redhat.com
Thu Aug 16 09:52:51 EDT 2007


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




More information about the jsfunit-dev mailing list