G
gk
i was trying to connect to my servlet from my standalone java
application.
but i got the errors...
java.io.IOException: Server returned HTTP response code: 405 for URL:
http://xvcvbcbbbc....
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:791)
i found this is a bug.
i used for connection
http://javaalmanac.com/egs/java.net/Post.html
and to get the data in the servelt side..
int contentLength = request.getContentLength();
out.println("<hr>");
out.println("Content length = " +contentLength);
if (contentLength > 0) {
byte[] buffer = new byte[contentLength];
java.io.InputStream inputStream = request.getInputStream();
inputStream.read(buffer);
String content = new String(buffer);
out.println(content.length());
out.println(content);
}
application.
but i got the errors...
java.io.IOException: Server returned HTTP response code: 405 for URL:
http://xvcvbcbbbc....
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:791)
i found this is a bug.
i used for connection
http://javaalmanac.com/egs/java.net/Post.html
and to get the data in the servelt side..
int contentLength = request.getContentLength();
out.println("<hr>");
out.println("Content length = " +contentLength);
if (contentLength > 0) {
byte[] buffer = new byte[contentLength];
java.io.InputStream inputStream = request.getInputStream();
inputStream.read(buffer);
String content = new String(buffer);
out.println(content.length());
out.println(content);
}