Hi Greg,
i have updated (web) sources with the new version, but now i have a
few request for Query.java:

- there isn't a public method getMessage() that could be useful to
retrieve the text message of an error
- into the execute, there is a part that throw exception if status !=
OK, but i need to have the responseHeader filled before that,
otherwise i haven't data to retry to query with the calculated
authentication ... this is my new version of this block of code (feel
free to modify as needed, but tell me is you think is not good or if
you modify it in a different way):

            // Set the response info
            status = connection.getResponseCode();
            message = connection.getResponseMessage();

// TODO: original, delete it , now moved under ...
//            // If the response was anything other than 2xx, throw an exception
//            int statusPrefix = status / 100;
//            if (statusPrefix != 2) {
//                throw new QueryException(status, message);
//            }
//
            // Record the content length
            bytesExpected = connection.getContentLength();

            // NOTE Header indexes start at 1, not 0
            int i = 1;
            for (String key = connection.getHeaderFieldKey(i); key != null;
                key = connection.getHeaderFieldKey(++i)) {
                responseHeaders.add(key, connection.getHeaderField(i));
            }

            // If the response was anything other than 2xx, throw an exception
            int statusPrefix = status / 100;
            if (statusPrefix != 2) {
                throw new QueryException(status, message);
            }

- i defined some (http) constants at the begin of Query, thinking they
was useful also in other authentication types ... but no problem to
have them defined only in DigestAuthentication:

        public static final String HTTP_RESPONSE_AUTHENTICATE_HEADER_KEY  =
"WWW-Authenticate";
        public static final String HTTP_REPLY_AUTHENTICATE_HEADER_KEY     =
"Authorization";
        public static final String HTTP_RESPONSE_AUTHENTICATED_HEADER_KEY =
"Authentication-Info";
        public static final String HTTP_RESPONSE_MIME_TYPE_HEADER_KEY     =
"Content-Type";

- now that all is working, i have to do some more tests:
  -- reuse MessageDigest and other computational heavy components
  -- handle more queries to the same URL (digest authentication needs
some counters in queries after the first), to see if the reusing of
authentication data works good
  -- test long queries, to test the timeout of queries and the (user)
task cancel, but i have to do it from a JUnit test: someone has an
hints for this, or there is a sample in Pivot ? Thanks.

- then, I'm thinking to write a WebQueryTestClientDigest.README (put
in the same package as the class) with the commands needed to setup
the Server (Apache, and this week i hope also Tomcat) for tests. Is it
a right way ?

Thanks,
Sandro

Reply via email to