S
SPG
Hi,
I am trying to test an application of ours that opens a URL Connection and
reads the response.
I have set up a tomcat (5.xx) service and I can post to it from IE fine.
As soon as I send exactly the same via JAVA code I get the foolowing error:
java.io.IOException: Server returned HTTP response code: 505 for URL:
http://localhost:8080/TestChartData/chartdata?desc=Steve's Data
Test&shortdesc=test data
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
..java:709)
at java.net.URL.openStream(URL.java:960)
at spg.tools.web.chart.SampleConnect.<init>(SampleConnect.java:15)
at spg.tools.web.chart.SampleConnect.main(SampleConnect.java:9)
Server returned HTTP response code: 505 for URL:
http://localhost:8080/TestChartData/chartdata?desc=Steve's Data
Test&shortdesc=test data
Here is amy quick sample code..
try {
URL url = new
URL("http://localhost:8080/TestChartData/chartdata?desc=Steve's Data
Test&shortdesc=test data");
InputStream is = url.openStream(); //FAILS HERE USING TOMCAT
SERVER
int c = 0;
StringBuffer buff = new StringBuffer();
while ( (c = is.read()) > -1) {
buff.append((char)c);
}
System.out.println(buff.toString());
}
catch (Exception ex) {
ex.printStackTrace();
System.out.println(ex.getMessage());
}
Now, I guess I am sending an HTTP request using the wrong protocol version,
as texactly the same request works if just pasted into the IE URL box.
So, What I guess I am asking is how can I find out what version is being
sent using the java app, and how can I configure tomcat to accept this?
BTW, I have a servlet running using the JBuilder dev environment, and when
that is running and I post to that, the URL works fine also!!??
Steve
I am trying to test an application of ours that opens a URL Connection and
reads the response.
I have set up a tomcat (5.xx) service and I can post to it from IE fine.
As soon as I send exactly the same via JAVA code I get the foolowing error:
java.io.IOException: Server returned HTTP response code: 505 for URL:
http://localhost:8080/TestChartData/chartdata?desc=Steve's Data
Test&shortdesc=test data
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
..java:709)
at java.net.URL.openStream(URL.java:960)
at spg.tools.web.chart.SampleConnect.<init>(SampleConnect.java:15)
at spg.tools.web.chart.SampleConnect.main(SampleConnect.java:9)
Server returned HTTP response code: 505 for URL:
http://localhost:8080/TestChartData/chartdata?desc=Steve's Data
Test&shortdesc=test data
Here is amy quick sample code..
try {
URL url = new
URL("http://localhost:8080/TestChartData/chartdata?desc=Steve's Data
Test&shortdesc=test data");
InputStream is = url.openStream(); //FAILS HERE USING TOMCAT
SERVER
int c = 0;
StringBuffer buff = new StringBuffer();
while ( (c = is.read()) > -1) {
buff.append((char)c);
}
System.out.println(buff.toString());
}
catch (Exception ex) {
ex.printStackTrace();
System.out.println(ex.getMessage());
}
Now, I guess I am sending an HTTP request using the wrong protocol version,
as texactly the same request works if just pasted into the IE URL box.
So, What I guess I am asking is how can I find out what version is being
sent using the java app, and how can I configure tomcat to accept this?
BTW, I have a servlet running using the JBuilder dev environment, and when
that is running and I post to that, the URL works fine also!!??
Steve