Peter Kennard wrote:

Excuse the naivety but I thought you couldn't open a socket with J2EE.
I was told (I think on this list) that you need to use a JCA to make
the connection.

Tomcat is not a full J2EE server, just servlets+JSP, so maybe
it lets you do things which are verboten in J2EE?

If this is true I want to know about this. I am so far under the impression if you needed to connect with another protocol in a servlet you could in essence (Worst case scenario) "write a server" inside a servlet using sockets.

Well you can certainly make an HTTP request (to an arbitrary
URL, including your own) from within a servlet, wait for the
response, process it as you see fit and finally return it to
the original requestor.  Several of our apps do this.

If you want to wrap a connection-based protocol in this way,
you'll have to save socket info in session state.  This works
with database connections (although connection pooling is
better practice).

But that would require you write all the code to handle aborting startup/shutdown thread management etc etc. If I can have a "tweaked" protocol servlet as part of a multi-servlet application this would make a perfect model for the "gateway" type of application between HTTP and a non (exactly) HTTP protocol we are trying to support.

Please clarify: are you aiming to wrap non-HTTP services as
HTTP services, for HTTP clients only?  I got the impression
from another msg that you hoped to "hand off" an initial
HTTP request to a telnet conversation, which could be tricky
or impossible.

Are you reinventing "HTTP tunneling"?
  http://en.wikipedia.org/wiki/HTTP-Tunnel

Paul Singleton

Can you "write a server" inside a servlet ??
PK


At 06:46 2/28/2007, you wrote:
On Wed, 28 Feb 2007 12:36:03 +0100
Georg Sauer-Limbach <[EMAIL PROTECTED]> wrote:

> If you don't want to deal with HTTP, you should
> not use the Servlet API (which is the Java
> abstraction of HTTP) at all. You can do the
> indicated code with generic sockets, no need to
> mind about Servlets altogether.

Regards
Wayne

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Paul Singleton
Jambusters Ltd

tel: 01782 750821
fax: 08707 628609
VAT: 777 3904 85
Company no. 04150146


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to