- From: Benoit Mahe <Benoit.Mahe@sophia.inria.fr>
- Date: Wed, 16 Aug 2000 18:23:26 +0200
- To: Eamon Dalton <edalton@wilde.cs.tcd.ie>
- CC: www-jigsaw@w3.org
Sometimes Jigsaw needs to reset some streams and PipedInputStream does not support mark/reset, that the reason why this exception occured. Regards, Benoit. Eamon Dalton wrote: > > Hi, > > I'm currently running Jigsaw in proxy configuration with a filter that I > have developed. The filter currently monitors all http requests and > associated replies from my browser so that performance can be analysed as > is percieved from an end user prespective, logged to a database and are > then summarised to give an overview of performance. What I am aiming at is > to provide a framework to implement Quality of Service(QoS) for services > that are delivered over HTTP. > > At the moment, I'm able to measure the time that a request is sent, the > time that it's associated response headers are recieved and the size > and time taken to download the reply entity (if one exists) so kbps > download for the reply entity are possible to calculate. > > I'm trying to extend my ingoing filter which currently only measures the > time that a request is sent ,to be able to calculate the size and rate of > upload of a request entity that a POST method typically has. > > I'm having a problem with my code shown below which gives me the following > error for certain POST requests.. It appears that somewhere(I think in > HttpBasicServer), an inputStream is marked and reset which is causing the > problem but I'm not sure.. > > Any help would be appreciated.. > > Eamon. > > java.io.IOException: mark/reset not supported > at java.io.InputStream.reset(InputStream.java:336) > at org.w3c.www.protocol.http.HttpBasicServer.runRequest(Compile > at org.w3c.www.protocol.http.HttpManager.runRequest(Compiled Co > at org.w3c.jigsaw.proxy.ForwardFrame.perform(Compiled Code) > at org.w3c.tools.resources.FramedResource.performFrames(Compile > at org.w3c.tools.resources.FramedResource.perform(Compiled Code > at org.w3c.jigsaw.http.httpd.perform(Compiled Code) > at org.w3c.jigsaw.http.Client.processRequest(Compiled Code) > at org.w3c.jigsaw.http.Client.startConnection(Compiled Code) > at org.w3c.jigsaw.http.socket.SocketClient.run(SocketClient.jav > at org.w3c.util.CachedThread.run(Compiled Code) > > In my ingoingfilter, I am calling the following, > > if(request.hasOutputStream()){ > try { > PipedOutputStream pout = new PipedOutputStream(); > PipedInputStream pin = new PipedInputStream(pout); > new RequestDataMover(request.getOutputStream(),pout); > request.setOutputStream(pin); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > } > > and RequestDataMover(which is similar to what the > org.w3c.jigsaw.filters.GZIPDataMover does except that it's being done on > the request) looks like > > class RequestDataMover extends Thread { > > InputStream in = null; > OutputStream out = null; > > public void run() { > try { > > byte buf[] = new byte[1]; > int got = -1; > > //Calcuate some parameter.. > > int contentLenght = 0; > while ((got = in.read(buf)) >= 0){ > out.write(buf, 0, got); > contentLenght = contentLenght + 1; > } > > //Calcuate some more parameter.. > > } catch (IOException ex) { > ex.printStackTrace(); > } finally { > try { in.close(); } catch (Exception ex) {}; > try { out.close(); } catch (Exception ex) {} ; > } > } > > RequestDataMover(InputStream in, OutputStream out ) { > this.in = in; > this.out = out; > setName("RequestDataMover"); > start(); > } > } -- - Benoît Mahé ------------------------------------------------------- World Wide Web Consortium (W3C) Architecture domain - Jigsaw Engineer http://www.w3.org/People/Mahe - bmahe@w3.org ---------------------------------------------------------------------
Received on Wednesday, 16 August 2000 12:23:36 UTC