Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

handing absolute URL in post request in tomcat

 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running my tomcat on 8999 port and I am not using apache. I have created servlet named TestServlet in context test.
Now if I telnet to my server on port 8999 and then say POST /test/servlet/TestServlet
it calls the servlet correctly.
but if I send an absolute URL in the POST request instead of relative URL like
POST http://localhost:8999/test/servlet/TestServlet
then it gives me 404 error in tomcat like
404 R( + http:/localhost:8999/test/servlet/TestServlet + null) null
How to configure the tomcat to accept this kind of absolute URL in post?
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you're repeating yourself. If you have already established a telnet connection to Tomcat on a certain port, then by simulating a POST with the full protocol, host, port and URI, it's as if you typed the following into your browser:

http://localhost:8999/http://localhost:8999/test/servlet/TestServlet

Isn't it?
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that's true. But the problem is that I have configured this servlet on my tomcat and some client is going to invoke this servlet with the given URL. The client here is an automated process, which I assume is written in C, which just opens socket on the 8999 port on my server and in post, again gives the absolute URL. Now why do this automated client program invokes absolute URL is not clear, but I assume he might be doing this to avoid some processing at his end.
If I use apache, then apache would handle this kind of URL, but I have some limitations at my end, and cannot use apache.
So how can I handle this in the tomcat?
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Finally I have got the solution.
None of the released versions of Tomcat 3 support HTTP/1.1 (except running behind Apache/IIS/SunOne). If you happen to be running 3.3.x, then you could upgrade to the CoyoteConnector2 in the nightly (to get a true HTTP/1.1
Connector), and all should be fine. Upgrading to Tomcat 4 would also do.
Ankit
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic