You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Roland Weber <RO...@de.ibm.com> on 2005/02/09 09:28:41 UTC
RE: JavaScript Use Case (was: HLCA: collect uses cases?)
Hi Steve,
Steve Johnson <sj...@mercury.com> wrote on 09.02.2005 00:24:13:
> Is there a javascript library written in java that could
> be linked in and used internally with auto-redirect, or
> called externally for manual 302 and page link processing?
There are JavaScript libraries written in Java. I've found
FESI: http://www.lugrin.ch/fesi/index.html
Rhino: http://www.mozilla.org/rhino/
We don't want to get into content handling with HttpClient,
so it would have to be the external link processing for you.
In most cases, the effort to set up a full JavaScript+DOM
environment as it is expected by JavaScript in a browser is
way overblown. You'd have to parse the HTML and generate the
events that are processed by the JavaScript handlers. For
most users targetting a specific site, it will be easier
to text-search the document in order to extract redirect URLs.
Your other mail about cookies generated on the client side
with JavaScript leads me to believe you're not one of these
"most users". I suppose the site does that intentionally
to prevent downloads from automated scripts.
> or something similar to what mozilla is doing for
> multi link requests that generate from a single
> request like allmusic.com?
A browser is a way, WAY bigger component than an HTTP library.
If you have to implement a browser, you can use HttpClient.
But HttpClient itself will never evolve near anything as
complex as a browser. Have you considered using a real browser
with a scripting interface?
I will include content-level redirect handling as a use case,
though only to point out that it is not in the scope of the
HttpClient. And to have a place where we can write down the
suggestions for applications to handle the non-HTTP redirects
themselves, in easy cases.
Thanks a lot for your input,
Roland