commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <>
Subject Possible Http Client Problem
Date Tue, 10 Sep 2002 17:59:07 GMT
I've been playing witht he CVS Checkout of the Http Client and I'm 
getting a wierd exception which I've included below. This code worked 
with the previous version of the Http Client I was using:

	at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(
	at sun.nio.cs.StreamDecoder$CharsetSD.implRead(
	at org.apache.xerces.readers.CharReader.fillCurrentChunk(
	at org.apache.xerces.readers.AbstractCharReader.slowLoadNextChar(
	at org.apache.xerces.readers.AbstractCharReader.scanQName(
	at org.apache.xerces.framework.XMLDocumentScanner.scanElementType(
	at org.apache.xerces.framework.XMLDocumentScanner.access$1(
	at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(
	at org.apache.xerces.framework.XMLDocumentScanner.parseSome(
	at org.apache.xerces.framework.XMLParser.parse(
	at com.icl.saxon.Controller.transform(

I'm using the InputStream from method.getContentAsStream() in a JAXP transform like this:

/* SNIP */

URL url = new URL("");

HttpConnection connection = new HttpConnection(url.getHost(),80);
GetMethod method = new GetMethod(url.getPath());

int state = method.execute(new HttpState(), connection);

if(state != 200){
    out.println("<p>State = "+ state+" Reason = " + method.getStatusText()+"</p>");
     TransformerFactory tfactory  = TransformerFactory.newInstance();
     Templates templates = tfactory.newTemplates(new StreamSource("MainView.xsl"));
     Transformer transformer = templates.newTransformer();
     transformer.transform(new StreamSource(method.getResponseBodyAsStream()),new StreamResult(out));

/* SNIP */

if I use the following test, I do get the content from the response:

InputStream in = method.getResponseBodyAsStream();

    int c;
    while((c = != -1){

Any Ideas?

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message