Results 1 to 5 of 5
  1. #1
    narcissist is offline Member
    Join Date
    Dec 2010
    Posts
    1
    Rep Power
    0

    Unhappy Servlet communication

    Hi all!
    I have a problem with my first HttpServlet.
    I have 2 HttpServlet (S1 & S2) on 2 different computers.
    what I want them to do is:
    - S1 changes values of some parameters in HttpServletRequest that it recieved, then sends modified request to S2.
    - S2 does something with HttpServletRequest sent by S1, then sends HttpServletResponse to S1.

    Anyone can show me what I have to do!
    Thanks!!!

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    because one servlet needs to invoke a http request to the second servlet, i imagine you would need something like a http client inside the first servlet to originate a request to the second servlet. see also: HttpClient - HttpClient Home

  3. #3
    mruss is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    If all servlet1 does is modify the request before sending it on to servlet2, it sounds like you should just use a ServletFilter, instead of having a whole separate servlet.

    The Essentials of Filters

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Except Servlet 2 is on a different machine, so is part of a different web app.

    It all smacks of web services gone a bit strange, but each to their own I suppose.

  5. #5
    mruss is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    You're right, Tolls, I missed that... d'oh!

    Unless the original post leaves out some compelling reason to do this with a servlet, I'd say an Apache reverse proxy is probably the easier solution... depending on the skills at hand, I guess.

Similar Threads

  1. Java Servlet and Web Services Communication
    By kiran.doddi in forum Java Servlet
    Replies: 0
    Last Post: 03-16-2010, 08:36 PM
  2. Java Servlet and Web Service communication
    By shussain@del.aithent.com in forum Java Servlet
    Replies: 36
    Last Post: 03-16-2010, 08:28 PM
  3. applet servlet communication
    By viswamadhavi in forum Java Applets
    Replies: 0
    Last Post: 04-06-2009, 02:12 PM
  4. Replies: 1
    Last Post: 12-02-2008, 01:23 AM
  5. applet servlet communication
    By hardc0d3r in forum Java Applets
    Replies: 1
    Last Post: 07-12-2007, 07:58 PM

Posting Permissions

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