W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 2001

my PUT's are being scrambled, any suggestions?

From: Bob Schader <rschader@product-des.com>
Date: Sun, 25 Feb 2001 14:46:07 -0500
Message-ID: <3A9960FF.53380E22@product-des.com>
To: Jigsaw List <www-jigsaw@w3.org>
Intro to my problem:
I finally thought I found a way to monitor HTTP PUT uploads
by using the w3c client java library included with Winie and
also part of Jigsaw, so I could implement a pure java
upload app, as opposed to my current method of incorporating
libcurl and using native calls. I previously found the
standard HttpURLConnection classes in java inadaquate for this
purpose and had other problems trying to use the HttpClient
library from www.innovations.ch

After studying the source code to Winie's JW and JWPut classes,
and reading the Javadocs for the Jigsaw client library, I tried
to implement it, and thought I was doing pretty good at it,
until I decided to verify that my uploaded files were OK, which
I discovered they weren't. So, I tried backing up, removing
StreamMonitors, ByteCountInputStreams, etc, to see if those
items were causing the problems, which they weren't. I now have 
the following compacted code, that seems to be uploading files
with no errors, but the zip files I am uploading are being
corrupted. I am 99% certain it is not on the server side, as
I have never had any other problems uploading files using PUT.

Hopefully someone more versed in the client library code could
point out something I may have missed here:

 HttpCredential credential = null;
 HttpManager manager = HttpManager.getManager() ;
 org.w3c.www.protocol.http.Request request = manager.createRequest();
 request.setURL(new URL(CompleteURL));
 request.setValue("Content-Type", "application/octet-stream");
 request.setValue("Content-Length", String.valueOf(localFlen));
 Base64Encoder encoder = new Base64Encoder(AuthUser + ":" 
      + AuthPasswd);
 credential = HttpFactory.makeCredential("Basic");
 credential.setAuthParameter("cookie", encoder.processString());
 InputStream in = new FileInputStream(localFile);

 if(in != null) 
 if (request != null) {
   org.w3c.www.protocol.http.Reply reply =
 } else {
   System.out.println("request object is null!");
} catch (HttpException ex) {
} catch(FileNotFoundException fnfex) {
} catch (MalformedURLException mfuex) {
} catch (IOException ioex) {

Thanks in advance,
Bob Schader
Received on Sunday, 25 February 2001 14:46:58 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:37 UTC