This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request from Applet

 
Xinyi Zhang
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a Applet send HTTP request? I mean it communicate with Servlet or JavaBean.
Thanks.
 
Devesh H Rao
Ranch Hand
Posts: 687
Hibernate jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Xinyi
you can communicate with a servlet from a servlet in the following way
URL servletURL = new URL("/URL of servlet");
URLConnection oServletConnection = servletURL.openConnection();
ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
and then use the java api for ObjectInputStream to communicate with the servlet....
Devesh.
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey, if GET request is good enough for you, you don't need http tunneling.
you can use getAppletContext().showDocument(new URL("path_to_servlet");
from your applet.
enjoy.
 
Xinyi Zhang
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Devesh and Asher. Now, Let me try.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic