×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    5

    HTTP POST to servlet not working to Tomcat

    Hi,

    I am sending a HTTP POST to a servlet on a Tomcat server.

    It only works when I send it via Fiddler.

    If I send it directly to the Tomcat server then it doesnt work.

    Anyone know why this would be?

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: HTTP POST to servlet not working to Tomcat

    hi,

    does you url host end with 8080 port? (common while using Tomcat installation)

    regards,
    peter

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    5

    Re: HTTP POST to servlet not working to Tomcat

    No, I set Tomcat up ti run on port 80.

    My normal url for posting is:

    http://localhost/myapp/servlet/MyServlet.

    When I route it via fiddler the url is:

    http://localhost:8888/myapp/servlet/MyServlet.

    Fiddler forwards it on to port 80.

    When I route it via fiddler it works but when I do it directly it doesn't. I have run the remote debugger from Eclipse to Tomcat and when I send the request directly to Tomcat I can see that the servlet's init() method never gets called, whereas via Fiddler it works perfectly.

    Is there any weird stuff with Midlets where HTTP POST have to go via a proxy. I'd be surprised but you never know.

    The only other thing I can think of is that I'm leaving out some required http request headers and fiddler is putting them in for me and that's why it works that way?

    How can I see the requests coming into Tomcat? Maybe I can figure out the differences.

  4. #4
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: HTTP POST to servlet not working to Tomcat

    hi,

    Another Java Servlet Filter Most Web Applications Should Have
    see that article, it contains description how to dump entire infor from web app into log files,

    regards,
    peter

  5. #5
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    150

    Talking Re: HTTP POST to servlet not working to Tomcat

    Hi pmcerlean!

    An easy way to control the frames that your server interchanges with other devices (input and output traffic packets) is to use a "PROTOCOL ANALYZER".

    "Ethereal" is a well-known one and I recommended you to use it! It is freeware tool and I think it is the better and easy "Protocol Analyzer" to use!

    Its url is: http://www.ethereal.com/

    You can download it and enjoy it! There are FAQs, documentation, HowTo...
    With this tool you can resolve some problems that actually you can't, analyzing the packets' headers and payloads!
    You can use filters and much more...

    I hope you it was helpful for you!

    Best regards.

    Summerman. ---

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    5

    Re: HTTP POST to servlet not working to Tomcat

    Hi Summerman,

    I've installed ethereal but I'm struggling to see the HTTP packets. I'm using wireless but the only interface I can select is the Ethernet one. It does show data but I can't see anything that resembles the HTTP POST.

    Everything is just running on my local host. What filters should I be setting and does wireless make a difference?

    Thanks.

  7. #7
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    150

    Wink Re: HTTP POST to servlet not working to Tomcat

    Hi, pmcerlean!

    It is more difficult to analyze Wireless data (802.11 b/g/a) with Ethereal! It depends on the OS that you use!

    If you use Windows XP Ethereal can't analyze that kind of traffic!

    If you use the Linux version I believe that you should be able to do!

    I would try to study the packets with an Ethernet network! Ethereal is perfect for that!!!

    If you can't do this you should try to use the Ethereal in a Linux PC to catch your Wireless traffic and to analyze it!

    Good luck!

Similar Threads

  1. HTTP POST using Nokia 7650
    By mikael_kinnunen in forum Mobile Java Networking & Messaging & Security
    Replies: 8
    Last Post: 2008-08-19, 23:32
  2. http post problem
    By ceehira in forum Symbian
    Replies: 0
    Last Post: 2006-07-28, 13:49
  3. Http post problem with emulator
    By robbin123 in forum Symbian
    Replies: 0
    Last Post: 2006-06-13, 21:37
  4. 7650 J2ME/MIDP HTTP Post
    By cwalkinshaw in forum Mobile Java General
    Replies: 2
    Last Post: 2002-10-23, 10:12
  5. Replies: 0
    Last Post: 2002-05-09, 12:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×