Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

connecting to a servlet

Thread view: 
gk - 25 Oct 2005 14:53 GMT
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);
       }
Roedy Green - 25 Oct 2005 15:19 GMT
>java.io.IOException: Server returned HTTP response code: 405 for URL:

I googled that and found:

10.4.6 405 Method Not Allowed

The method specified in the Request-Line is not allowed for the
resource identified by the Request-URI. The response MUST include an
Allow header containing a list of valid methods for the requested
resource.

-----
405    Method Not Allowed    The request method is not allowed.
Typically when trying to execute a normal document or display a
script.
------

405    Method not allowed     The method specified in the
Request-Line is not allowed for the resource identified by the
Request-URI. The response must include an Allow header containing a
list of valid method's for the requested resource.

-------
405    HTTP_METHOD_NOT_ALLOWED   
    The method being used to access the file is not allowed.
--------

Basically they are all telling you the right half of your URL is
buggered.

If you ever go to Boston, you have to try the local specialty, scrod,
fresh young cod.  I was once on a business trip there and went
wandering the city in search of the delicacy.  I don't like asking
directions, but I was getting impatient and hungry, so I finally asked
an old guy selling newspapers, "where can I get scrod?"  He replied,
"I've been asked that question many times before, but never by a
Canadian in the pluperfect subjunctive. The above story is apocryphal,
as many of your over 50s can attest.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.