Main > Internet > HTTP >

HTTPClient 0.3-3

HTTPClient 0.3-3

Sponsored Links

HTTPClient 0.3-3 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.52 MB
Platform: Any Platform
License: LGPL (GNU Lesser General Public License)
Price:
Downloads: 1508
Date added: 2005-09-27
Publisher: Ronald Tschalär

HTTPClient 0.3-3 description

This package provides a complete http client library. It currently implements most of the relevant parts of the HTTP/1.0 and HTTP/1.1 protocols, including the request methods HEAD, GET, POST and PUT, and automatic handling of authorization, redirection requests, and cookies.

Furthermore the included Codecs class contains coders and decoders for the base64, quoted-printable, URL-encoding, chunked and the multipart/form-data encodings. The whole thing is free, and licenced under the GNU Lesser General Public License (LGPL) (note that this is not the same as the GPL).

Following are the kits and documentation for the HTTPClient Version 0.3-3. If you have any problems, bugs, suggestions, comments, etc. see the info on debugging and reporting problems. An older version of these pages are also available in Japanese, thanks to the kindly efforts of Yuji Kumasaka.

Using the HTTPClient should be quite simple. First add the import statement import HTTPClient.*; to your file(s). Next you create an instance of HTTPConnection (youll need one for every server you wish to talk to). Requests can then be sent using one of the methods Head(), Get(), Post(), etc in HTTPConnection.

These methods all return an instance of HTTPResponse which has methods for accessing the response headers (getHeader(), getHeaderAsInt(), etc), various response info (getStatusCode(), getReasonLine(), etc), the response data (getData(), getText(), and getInputStream()) and any trailers that might have been sent (getTrailer(), getTrailerAsInt(), etc). Following are some examples to get started.
To retrieve files from the URL "http://www.myaddr.net/my/file" you can use something like the following:
try
{
HTTPConnection con = new HTTPConnection("www.myaddr.net");
HTTPResponse rsp = con.Get("/my/file");
if (rsp.getStatusCode() >= 300)
{
System.err.println("Received Error: "+rsp.getReasonLine());
System.err.println(rsp.getText());
}
else
data = rsp.getData();

rsp = con.Get("/another_file");
if (rsp.getStatusCode() >= 300)
{
System.err.println("Received Error: "+rsp.getReasonLine());
System.err.println(rsp.getText());
}
else
other_data = rsp.getData();
}
catch (IOException ioe)
{
System.err.println(ioe.toString());
}
catch (ParseException pe)
{
System.err.println("Error parsing Content-Type: " + pe.toString());
}
catch (ModuleException me)
{
System.err.println("Error handling request: " + me.getMessage());
}

This will get the files "/my/file" and "/another_file" and put their contents into byte[]s accessible via getData(). Note that you need to only create a new HTTPConnection when sending a request to a new server (different protocol, host or port); although you may create a new HTTPConnection for every request to the same server this not recommended, as various information about the server is cached after the first request (to optimize subsequent requests) and persistent connections are used whenever possible (see also Advanced Info).

To POST form data from an applet back to your server you could use something like this (assuming you have two fields called name and e-mail, whose contents are stored in the variables name and email):
try
{
NVPair form_data[] = new NVPair[2];
form_data[0] = new NVPair("name", name);
form_data[1] = new NVPair("e-mail", email);

// note the convenience constructor for applets
HTTPConnection con = new HTTPConnection(this);
HTTPResponse rsp = con.Post("/cgi-bin/my_script", form_data);
if (rsp.getStatusCode() >= 300)
{
System.err.println("Received Error: "+rsp.getReasonLine());
System.err.println(rsp.getText());
}
else
stream = rsp.getInputStream();
}
catch (IOException ioe)
{
System.err.println(ioe.toString());
}
catch (ModuleException me)
{
System.err.println("Error handling request: " + me.getMessage());
}

Here the response data is read at leisure via an InputStream instead of all at once into a byte[].

As another example, if you want to upload a document to a URL (and the server supports http PUT) you could do something like the following:
try
{
URL url = new URL("http://www.mydomain.us/test/my_file");

HTTPConnection con = new HTTPConnection(url);
HTTPResponse rsp = con.Put(url.getFile(), "Hello World");
if (rsp.getStatusCode() >= 300)
{
System.err.println("Received Error: "+rsp.getReasonLine());
System.err.println(rsp.getText());
}
else
text = rsp.getText();
}
catch (IOException ioe)
{
System.err.println(ioe.toString());
}
catch (ModuleException me)
{
System.err.println("Error handling request: " + me.getMessage());
}

HTTPClient 0.3-3 Screenshot

Advertisements

HTTPClient 0.3-3 Keywords

Bookmark HTTPClient 0.3-3

Hyperlink code:
Link for forum:

HTTPClient 0.3-3 Copyright

WareSeeker periodically updates pricing and software information of HTTPClient 0.3-3 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of HTTPClient 0.3-3 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Provides features not found in the Sun HttpURLConnection implementation: NTLM V2 support, pipelining, single sign-on, Apache Axis/Axis2 support, WebDAV support, many different timeout options, tracing, source code availability, and quick support. Completely plug-compatible with HttpURLConnection. Free Download
Conduit project is a synchronization application for GNOME. Free Download
HTTP::DAV is a WebDAV client library for Perl5. Free Download
GPM client library (libgpm) package is an stand-alone version of GPMs client library. Free Download
REMITT is Electronic Medical Information Translation and Transmission. Free Download
Splashy is a boot splash program that doesnt require patching the Linux kernel. Free Download
pita is client-server music player. Free Download
FlightFeathers goal is social networking for everyone. Free Download