W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > October 2007

RE: [Fwd: How to change the request headers in the Preprocessor class]

From: Abel Rionda <abel.rionda@fundacionctic.org>
Date: Mon, 8 Oct 2007 16:12:25 +0200
Message-ID: <09700B613C4DD84FA9F2FEA5218828190272112D@ayalga.fundacionctic.org>
To: "Dominique Hazael-Massieux" <dom@w3.org>, "public-mobileok-checker" <public-mobileok-checker@w3.org>
Cc: <ggarciab@itdeusto.com>

Hi Guido,

Currently, there is not possible to define additional headers
from the public interface. This is because we are checking mobile ok basic
tests and this spec specifies the HTTP Request headers to request a page.

However is very simple to add this feature: In the top parent class HTTPResource there are two constructors (one with only URI as an argument and another one with the URI and a map with the additional headers).
	
	HTTPResource(final URI uri)
	HTTPResource(final URI uri, final Map<String, String> 	additionalRequestHeaders)
 
Now you only have to modify the HTTPResource hierarchy to include new constructor.
One reason for no including additional headers in the public interface of the library (i.e Tester class) is the mobile ok requirements itself. In this way, we can ensure that every request is made under mobile ok requirements.

> By the way, is there any reason to make this Preprocessor class final ?

Now I am not sure about the reason. I did not notice that the Preprocessor
was final until you mentioned :).


Abel.


-----Mensaje original-----
De: public-mobileok-checker-request@w3.org [mailto:public-mobileok-checker-request@w3.org] En nombre de Dominique Hazael-Massieux
Enviado el: lunes, 08 de octubre de 2007 14:13
Para: public-mobileok-checker
CC: ggarciab@itdeusto.com
Asunto: [Fwd: How to change the request headers in the Preprocessor class]


-------- Message transféré --------
> De: Guido García Bernardo <ggarciab@itdeusto.com>
> À: public-mobileok-checker-request@w3.org
> Sujet: How to change the request headers in the Preprocessor class
> Date: Mon, 08 Oct 2007 09:56:35 +0000
> 
> Hello,
> 
> Could it be possible to allow the user to change the request headers in 
> the Preprocessor class ?
> 
> Now there is a method:
> 
> void preprocess() throws TestException {
>     final URI baseUri = results.getURI();
>     try {
>         final HTTPXHTMLResource resource = new HTTPXHTMLResource(baseUri);
>     ...
> }
> 
> And it would be great to add the following one (or to add the 
> additionalRequestHeaders to the constructor) :
> 
> void preprocess(final Map<String, String> additionalRequestHeaders) 
> throws TestException {
>     final URI baseUri = results.getURI();
>     try {
>         final HTTPXHTMLResource resource = new 
> HTTPXHTMLResource(baseUri, additionalRequestHeaders);
>     ...
> }
> 
> I am working on a crawler based on mobileok, and that might help us a 
> lot to change some headers (User-Agent, Accept-Language ...).  It could 
> be useful in other use cases, too.
> 
> By the way, is there any reason to make this Preprocessor class final ?
> Thank you,
> Guido García Bernardo
Received on Monday, 8 October 2007 14:11:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:13:04 GMT