Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

calling servlet from another server.

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to all..

One servlet is running in my application ..in my server(it is in my system) it self..

can i call another servelt running in another application in another server(another system)..if yes...how ..please tell ..me ...

Thanks.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends on what you mean by "call".

Your users can click on links or form submit buttons, generated by your servlet, that will generate requests to the other servlet.

You can also use response.sendRedirect to suggest that the user's browser make a request to that servlet.

Note: If the other servlet is under a different domain, the user's browser will most likely warn them that the form, link, or redirect is attempting to take them to another domain. This is usually in the form of a gray popup window.
 
aman hindustani
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i mean ..can i transfer my request and respose object ..to another servlet running in another domain...using RequestDispatcher..

like this..

String str ="http://remotehost:8080/RemoteApplication/RemoteServlet";

RequestDispatcher rd = getServletContext().getRequestDispatcher(str);

rd.forward(request,response); (or) rd.include(request,response);

Waiting for reply...
Thanks.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by aman hindustani:
i mean ..can i transfer my request and respose object ..to another servlet running in another domain...using RequestDispatcher..



no. Those are specific to not just the server but the web application within that server which received the original request.
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are calling for any web resource in another server context, you have become a client and must use client code to do it. You can use HttpClient from Apache Jakarta Commons to do it.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try the following URL, You might get the solution.

http://support.novell.com/techcenter/articles/dne20030401.html
 
Jimi Parekh
Greenhorn
Posts: 7
 
aman hindustani
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to mr ben ,mr jeroen, mr carl, mr jimi ...

but i am unable to concluded .. how to call ..servlet which is running...in other server...from our servlet..

please give some sample code or simple article url.
Thanks to all once again
 
aman hindustani
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i mean servlet communication is possible between these two servlets running in two differenent servers..installed in two system...
 
I promise I will be the best, most loyal friend ever! All for this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic