handling HTTP redirects
Laurent Bourgès
Laurent.Bourges at obspm.fr
Thu Jun 5 02:21:19 PDT 2008
Hi all,
I just want to inform you about technical details.
A reference implementation of HTTP 1.1 is available for the java
environment thanks to apache.org (so, open source) :
Apache commons Http Client 3.1
http://hc.apache.org/httpclient-3.x/
(in near future : Http Client 4.0 will be released as a release
candidate ...)
This library is able to handle properly (tested in several projects) :
- cookies for session management (authentication)
- HTTP follow redirect (302) ...
- supports all HTTP methods (GET, POST, DELETE, HEAD...)
- Http headers are easy parsed and built
From apache docs :
Features
* Standards based, pure Java, implementation of HTTP versions
1.0 and 1.1
* Full implementation of all HTTP methods (GET, POST, PUT,
DELETE, HEAD, OPTIONS, and TRACE) in an extensible OO framework.
* Supports encryption with HTTPS (HTTP over SSL) protocol.
* Granular non-standards configuration and tracking.
* Transparent connections through HTTP proxies.
* Tunneled HTTPS connections through HTTP proxies, via the
CONNECT method.
* Transparent connections through SOCKS proxies (version 4 & 5)
using native Java socket support.
* Authentication using Basic, Digest and the encrypting NTLM (NT
Lan Manager) methods.
* Plug-in mechanism for custom authentication methods.
* Multi-Part form POST for uploading large files.
* Pluggable secure sockets implementations, making it easier to
use third party solutions
* Connection management support for use in multi-threaded
applications. Supports setting the maximum total connections as well
as the maximum connections per host. Detects and closes stale
connections.
* Automatic Cookie handling for reading Set-Cookie: headers from
the server and sending them back out in a Cookie: header when
appropriate.
* Plug-in mechanism for custom cookie policies.
* Request output streams to avoid buffering any content body by
streaming directly to the socket to the server.
* Response input streams to efficiently read the response body
by streaming directly from the socket to the server.
* Persistent connections using KeepAlive in HTTP/1.0 and
persistance in HTTP/1.1
* Direct access to the response code and headers sent by the
server.
* The ability to set connection timeouts.
* HttpMethods implement the Command Pattern to allow for
parallel requests and efficient re-use of connections.
* Source code is freely available under the Apache Software
License.
Standards Compliance
HttpClient implements the following specifications endorsed by the
Internet Engineering Task Force (IETF) and the internet at large:
* RFC1945 Hypertext Transfer Protocol -- HTTP/1.0
* RFC2616 Hypertext Transfer Protocol -- HTTP/1.1
* RFC2617 HTTP Authentication: Basic and Digest Access
Authentication
* RFC2109 HTTP State Management Mechanism (Cookies)
* RFC2396 Uniform Resource Identifiers (URI): Generic Syntax
* RFC1867 Form-based File Upload in HTML
Enjoy,
Good morning or afternoon,
Laurent
Le 4 juin 08 à 19:49, Roy Williams a écrit :
> Sebastien
>
> Of course the Vizier people can use redirects if they want, it is
> quite legal. It is also legal to make a cone search which never
> returns more than three sources, or one that returns an error for
> every possible request.
>
> I have done a rough timing test of Vizier cone searches, and I find
> that the redirect costs about 0.5 seconds per cone search. In other
> words, a Vizier service will be quite a bit faster if you simply
> replace up front the string "vizier" with "webviz" in all the
> accessURLs that you get from the registry. Since Vim runs hundreds
> of cone searches at a time, this is what I have chosen to do, to
> save a few minutes of my customer's valuable time.
>
> Roy
>
> --
>
> California Institute of Technology
> 626 395 3670
>
------------------------------------------------------------------------
-
Laurent Bourgès, engineer
EURO-VO-DCA Project
LUTh, Observatoire de Paris-Meudon
5 place Jules Janssen
F-92 195 Meudon Cedex
Tel : 01 45 07 74 25
Email: Laurent.Bourges at obspm.fr
------------------------------------------------------------------------
-
More information about the dal
mailing list