This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet Tunneling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Tunneling" Watch "Servlet Tunneling" New topic

Servlet Tunneling

purushottam srinivas raju

Joined: Jun 15, 2004
Posts: 2
What is servlet tunneling? Why it is used and advantages of using it.Can anyone pl. help me?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32304

Google comes up with quite a few results on this topic.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
purushottam srinivas raju

Joined: Jun 15, 2004
Posts: 2
thank you jeanne. well I could find sufficient material but a complete code on how srvlet tunneling works could heve been more beneficial to me. I'll will try and in the mean time if you could help me with the same.

Larry Cryderm

Joined: Mar 23, 2004
Posts: 9
...this is what I use as a client that 'tunnels' into a listening servlet, hope it helps: url = new; con = url.openConnection();


con.setRequestProperty("Content-Type", "text/xml; charset=utf-8");

DataOutputStream out = new DataOutputStream(con.getOutputStream());

out.write(your_string_to_send.getBytes()); // WRITE to the site


BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(con.getInputStream()));
StringBuffer sb = new StringBuffer();
while ((inputLine = bufferedreader.readLine()) != null) {
sb.append(inputLine); // READ from the site

I shoulda been a rock star.
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
Http client from jakarta commons provides a easier api, if http tunneling is what Larry talks about.
Larry Cryderm

Joined: Mar 23, 2004
Posts: 9
Yup...the Commons API is full feature HTTP client stuff...didn't know it was out there, Thanks!
It is sorta covered in the JavaRanch Style Guide.
subject: Servlet Tunneling
jQuery in Action, 3rd edition