I'm working on a proxy which has to be able to read GET/PUT/POST forms
from a client, then send stuff back. It doesn't want or need Velocity for
this function -- I'm reading from the client with data.getRequest() as
an HttpServletRequest directly.
I can read the meta-data and headers OK, but when I go to read the
client input stream, it throws an exception saying:
java.io.IOException: This input stream has been closed
The code bombs in the clientIn.read():
public HTTPRequest( HttpServletRequest client )
throws MalformedURLException, IOException
{
method = client.getMethod().toUpperCase();
length = client.getContentLength();
clientIn = client.getInputStream();
if (length > 0) {
log.debug("Read input length=" + length);
int c;
while ((c = clientIn.read()) != -1) {
log.debug(" char=" + c);
}
}
I've tried using getReader() instead of getInputStream() and it says:
java.lang.IllegalStateException:
getInputStream() has already been called for this request
The only think I can think is that Turbine or Velocity have already
opened the stream as a ServletInputStream() then closed it.
Is there a way around this, to read the client stream for PUT and POST
HTTP methods? What's opening then closing the InputStream?
For this portion of the project I don't need Velocity at all, since
I'm bypassing it. But my proxy is implemented as a VelocityAction.
Is there some lighter Action I can use which doesn't close the input
or generate output pages, leaving the client connections for me?
I still need to use Turbine's authentication facilities to make sure
only logged in folks use this, else I could go with bare servlets.
Thanks.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>