Hi Matteo,
Thanks for your interest! See below for some answers.
On 01/10/2011 05:21 PM, Matteo Bertamini wrote:
> Hello,
> I'm trying to work with the last code of Mobile Checker (updated through
> CVS) and I'm trying to learn how to use it by following the dev guide.
The dev guide is quite outdated and hasn't been updated to account for changes made between v1.0 and v1.1, and the most impacted section is section 5... Any help to update the guide would be most appreciated!
The CVS description for the project contains a note to warn people against that, but it can easily be missed, for sure:
http://dev.w3.org/cvsweb/2007/mobileok-ref/
"NB: User/Developer guides at the root folder are currently out of date."
> In an example about setting optional headers (sect. 5.2) there's a
> snippet that does not work with my code. In particular:
> ------------------------------------------------------------------
> Map<String,Object> configMap = new HashMap<String,Object>();
> configMap.put(TesterConfiguration.HTTP_REQUEST_HEADER_OVERRIDES_KEY,
> myAdditionalHeaders);
> ------------------------------------------------------------------
>
> can't work because the variable (or constant)
> TesterConfiguration.HTTP_REQUEST_HEADER_OVERRIDES_KEY does not exist.
> The online javadoc says the same thing: that variable does not exist.
The online Javadoc should be accurate. It contains a few hints to extend the mobileOK Checker to your liking:
http://dev.w3.org/2007/mobileok-ref/docs/org/w3c/mwi/mobileok/basic/package-summary.html#package_description
See in particular sub-section "Changing the HTTP headers sent in HTTP requests". In your case, if you want to add more HTTP headers, you should use HttpResourceRetriever.CONFIG_HTTP_ADDITIONAL_HEADERS:
http://dev.w3.org/2007/mobileok-ref/docs/org/w3c/mwi/mobileok/basic/HttpResourceRetriever.html#CONFIG_HTTP_ADDITIONAL_HEADERS
> And the following:
> ------------------------------------------------------------------
> TesterConfiguration config = new TesterConfiguration(configMap);
> ------------------------------------------------------------------
>
> does not work as well, because a constructor with that kind of parameter
> does not exist!
>
> So, what's wrong? Where can I find updated information about this?
See above, the Javadoc should be accurate.
For the TesterConfiguration class:
http://dev.w3.org/2007/mobileok-ref/docs/org/w3c/mwi/mobileok/basic/TesterConfiguration.html
The TesterConfiguration has been generalized and now expects more parameters. You may check the MobileOKConfiguration for an example of usage (this class generates the appropriate TesterConfiguration for mobileOK tests).
Thanks,
Francois.