You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sean Nagle <se...@planet12.net> on 2007/11/16 17:28:56 UTC

Can Tomcat be used as a servlet container for non-http servlets?

Where can I get more information about the design and use of Tomcat in
regards to non-http servlet applications? I tried searching in the mailing
list archives for "non http" and found this thread:

http://mail-archives.apache.org/mod_mbox/tomcat-dev/200004.mbox/%3c38F4C980.
CE17E8BA@eng.sun.com%3e

This thread was from April 2000 and Tomcat 3.x and the developers were still
trying to figure out the architecture of generic vs. http servlets.

I am interested in writing a servlet that would derive from GenericServlet
and I am wondering if I will be able to use Tomcat as the servlet container.
My application would doesn't have anything to do with email or ftp or the
like. What I would like to do is something similar to JSP but instead of the
response being html it would be instructions to run a CNC machine

Other google searches have not turned up much information about how to use
Tomcat in this way.

If it is not currently designed for such a purpose, would it be possible to
modify or extend Tomcat so that it would be able to?

Thanks in advance for any help

Sean Nagle

Re: Can Tomcat be used as a servlet container for non-http servlets?

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Sean Nagle wrote:
> Where can I get more information about the design and use of Tomcat in
> regards to non-http servlet applications? I tried searching in the mailing
> list archives for "non http" and found this thread:
>
> http://mail-archives.apache.org/mod_mbox/tomcat-dev/200004.mbox/%3c38F4C980.
> CE17E8BA@eng.sun.com%3e
>
> This thread was from April 2000 and Tomcat 3.x and the developers were still
> trying to figure out the architecture of generic vs. http servlets.
>
> I am interested in writing a servlet that would derive from GenericServlet
> and I am wondering if I will be able to use Tomcat as the servlet container.
> My application would doesn't have anything to do with email or ftp or the
> like. What I would like to do is something similar to JSP but instead of the
> response being html it would be instructions to run a CNC machine
>
> Other google searches have not turned up much information about how to use
> Tomcat in this way.
>
> If it is not currently designed for such a purpose,
Tomcat currently only supports two protocols HTTP and AJP. What protocol 
did you want to use?
>  would it be possible to
> modify or extend Tomcat so that it would be able to?
>   
yes it is, but it's not trivial. It would depend on what protocol you 
want to use.

Filip
> Thanks in advance for any help
>
> Sean Nagle
>
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.503 / Virus Database: 269.15.33/1133 - Release Date: 11/15/2007 8:57 PM
>   


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


Re: Can Tomcat be used as a servlet container for non-http servlets?

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool pojo application server
---------------------------------------------------------------------------
----- Original Message ----- 
From: "Sean Nagle" <se...@planet12.net>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Saturday, November 17, 2007 2:20 AM
Subject: RE: Can Tomcat be used as a servlet container for non-http 
servlets?


> Johnny,
>
> The answers to most of your questions are still up in the air. There are
> several ways that I could go about the project. The CNC machines that I 
> have
> experience with rely on an operator (human) to point it (the machine) at a
> file that contains the instructions and say 'GO'.
>
> Along these lines, I was thinking one approach would be to have the CNC
> programmer write what would essentially be a JSP that has instructions in 
> G
> code and any logic in java. Next the programmer would request this page 
> from
> Tomcat and the response would only have the G code instructions and this
> file could be saved to the filesystem. Then the CNC operator would then
> point the machine at this file. That is the 'manual version'.

Its fairly easy to check....
Install a tomcat on the same network as the machine...
Just place a text file on tomcat "hellomachine.txt"
Give the CNC programmer the IP address and ask him if he can read it.
It will come in with all the HTTP header stuff... but if you get that then 
you in
business with a GenericServlet.

If he says it cant take an IP address... it aint TCP/IP ;)
If it uses say a UNC address, then its a file sharing protocol and Tomcat is 
not your thing.

If the documentation is really crap and you have a machine talking to a PC 
already, get a protocol analyser and watch whats happening... the one I like 
is Wire Shark.

Good luck...





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


Re: Can Tomcat be used as a servlet container for non-http servlets?

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool pojo application server
---------------------------------------------------------------------------
----- Original Message ----- 
From: "Sean Nagle" <se...@planet12.net>

http://spectral.mscs.mu.edu/Ent2005/examples/example3/

Found a little code for you to study...
These guys are messing around with their own protocols, like finger servers 
etc
And they have a little client code calling it from Applets etc.

Its not all relevant... but have a look at the GenericServlet stuff... and 
the clients that use it.
Your CNC guys has to be able to write the equivalent of those clients in 
whatever language the CNC machine uses... will help them a little.

If that machine offers sockets but its at a low level, quasi assembler, or 
even in C... keep in mind that Java makes this stuff look very very easy... 
ie give him a break... it may not be easy at all from a machine language.
or some kind of wierd PLC ladder logic.

I love this sort of stuff, but in the end the sensible thing may be to just 
put a browser in the factory office.
It gets the CNC files from head office and saves it to the PC... he points 
the CNC machine at those files.
ie stick to standard technology... can also include other stuff on the 
design office site... like "need this by friday" ;) 


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


RE: Can Tomcat be used as a servlet container for non-http servlets?

Posted by Sean Nagle <se...@planet12.net>.
Johnny,

The answers to most of your questions are still up in the air. There are
several ways that I could go about the project. The CNC machines that I have
experience with rely on an operator (human) to point it (the machine) at a
file that contains the instructions and say 'GO'.

Along these lines, I was thinking one approach would be to have the CNC
programmer write what would essentially be a JSP that has instructions in G
code and any logic in java. Next the programmer would request this page from
Tomcat and the response would only have the G code instructions and this
file could be saved to the filesystem. Then the CNC operator would then
point the machine at this file. That is the 'manual version'.

Another version of the system could have the CNC machine make the request
for a page from the server. This seems like the slicker, cooler version. My
servlet would be very similar to JSP but instead of responding with HTML, it
would respond with a text file containing the G code instructions.

I have to look into the machines communication protocols. I am fairly
certain that they are using TCP/IP to find files on a file system.

-----Original Message-----
From: Johnny Kewl [mailto:john@kewlstuff.co.za]
Sent: Friday, November 16, 2007 11:57 AM
To: Tomcat Users List
Subject: Re: Can Tomcat be used as a servlet container for non-http
servlets?



---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool pojo application server
---------------------------------------------------------------------------
----- Original Message -----
From: "Sean Nagle" <se...@planet12.net>
To: "apache users" <us...@tomcat.apache.org>
Sent: Friday, November 16, 2007 6:28 PM
Subject: Can Tomcat be used as a servlet container for non-http servlets?


> Where can I get more information about the design and use of Tomcat in
> regards to non-http servlet applications? I tried searching in the mailing
> list archives for "non http" and found this thread:
>
>
http://mail-archives.apache.org/mod_mbox/tomcat-dev/200004.mbox/%3c38F4C980.
> CE17E8BA@eng.sun.com%3e
>
> This thread was from April 2000 and Tomcat 3.x and the developers were
> still
> trying to figure out the architecture of generic vs. http servlets.
>
> I am interested in writing a servlet that would derive from GenericServlet
> and I am wondering if I will be able to use Tomcat as the servlet
> container.
> My application would doesn't have anything to do with email or ftp or the
> like. What I would like to do is something similar to JSP but instead of
> the
> response being html it would be instructions to run a CNC machine

Magic! Nice project...
I think the only question is whether the CNC machine can make TCP/IP
requests.
If so, yes why not? Its just a raw request with no protocol in it, ie no
HTTP headers and all the other things that browsers need, so you just have
to study what the machine wants to see.

//Machine will call into this
public void service(ServletRequest req, ServletResponse res){
    //Tell than machine what it needs to hear ;)
}

The CNC machine maybe the server though... in which case you will have to
use a socket to talk to it.
What protocol does the machine support?
Is it a Client or Server?

>
> Other google searches have not turned up much information about how to use
> Tomcat in this way.
>
> If it is not currently designed for such a purpose, would it be possible
> to
> modify or extend Tomcat so that it would be able to?
>
> Thanks in advance for any help
>
> Sean Nagle
>


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


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


Re: Can Tomcat be used as a servlet container for non-http servlets?

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool pojo application server
---------------------------------------------------------------------------
----- Original Message ----- 
From: "Sean Nagle" <se...@planet12.net>
To: "apache users" <us...@tomcat.apache.org>
Sent: Friday, November 16, 2007 6:28 PM
Subject: Can Tomcat be used as a servlet container for non-http servlets?


> Where can I get more information about the design and use of Tomcat in
> regards to non-http servlet applications? I tried searching in the mailing
> list archives for "non http" and found this thread:
>
> http://mail-archives.apache.org/mod_mbox/tomcat-dev/200004.mbox/%3c38F4C980.
> CE17E8BA@eng.sun.com%3e
>
> This thread was from April 2000 and Tomcat 3.x and the developers were 
> still
> trying to figure out the architecture of generic vs. http servlets.
>
> I am interested in writing a servlet that would derive from GenericServlet
> and I am wondering if I will be able to use Tomcat as the servlet 
> container.
> My application would doesn't have anything to do with email or ftp or the
> like. What I would like to do is something similar to JSP but instead of 
> the
> response being html it would be instructions to run a CNC machine

Magic! Nice project...
I think the only question is whether the CNC machine can make TCP/IP 
requests.
If so, yes why not? Its just a raw request with no protocol in it, ie no 
HTTP headers and all the other things that browsers need, so you just have 
to study what the machine wants to see.

//Machine will call into this
public void service(ServletRequest req, ServletResponse res){
    //Tell than machine what it needs to hear ;)
}

The CNC machine maybe the server though... in which case you will have to 
use a socket to talk to it.
What protocol does the machine support?
Is it a Client or Server?

>
> Other google searches have not turned up much information about how to use
> Tomcat in this way.
>
> If it is not currently designed for such a purpose, would it be possible 
> to
> modify or extend Tomcat so that it would be able to?
>
> Thanks in advance for any help
>
> Sean Nagle
> 


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