Re: allow access without auth to app from several ip ranges , but leave auth from any other hosts

2008-06-14 Thread Johnny Kewl


- Original Message - 
From: Alex Mestiashvili [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, June 13, 2008 9:56 PM
Subject: allow access without auth to app from several ip ranges , but leave 
auth from any other hosts




HI ALL .
I have basic authentication for my tomcat application .
Now I want , allow access without authentication to this app from several 
ip ranges , but leave auth from any other hosts .

I did not find any solution  in google
Is it possible ?

tomcat version is 6.0.16

Thanks in advance .


Would have to be different pages...
/webapp/servlet
/webapp/servletip

TC security checks everything before you can get at it if the page is 
protected, its protected ;)


Another way is with programmatic authentication... ie do the BASIC auth in 
a servlet yourself... then you can do anything.


Have fun..

---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
--- 



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



Re: Hiding JSP Pages

2008-06-14 Thread Johnny Kewl


- Original Message - 
From: W Strater [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, June 13, 2008 5:06 PM
Subject: Hiding JSP Pages


I am trying to hide the JSP so they can only be accessed via a forward. I 
have been able to put them in a subdirectory of WEB-INF using other 
containers but have not been able to do that with Tomcat 5.5.


We are not using Struts but it is the same approach where our business
logic is servlet/action based and we only use JSP for presentation.

A common practice would be to put the JSP page in the root directory of 
the WAR like following:


/HelloWorld.jsp
/WEB-INF/web.xml
/WEB-INF/classes/HelloWorld.class


Mmmm no dont think so, that kinda looks like a mix between precompiled and 
JSP
Anyway doesnt matter... and it maybe because I'm in a different IDE, doesnt 
work the same...


This would allow the user to access the JSP page through the servlet with 
http://localhost:8080/app/HelloWorld or directly with 
http://localhost:8080/app/HelloWorld.jsp.


I want to use to only be able to access the JSP page through the servlet 
and the directory of the WAR would like the following:


/WEB-INF/web.xml
/WEB-INF/classes/HelloWorld.class
/WEB-INF/jsp/HelloWorld.jsp

The HelloWorld servlet would use the JSP for presentation by forwarding to 
it using code like the fllowing:


RequestDispatcher dispatcher = request.getRequestDispatcher(
/WEB-INF/jsp/HelloWorld.jsp);


Rather use this mapping...
/META-INF/test/index.jsp

ie just put the JSP's into Meta_Inf
That will hide em and they'll still work...

Having said that, this is the first time I gave this a whiz... you're 
forwarding idea is actually just the MVC model, a good way to do it...
But normally what I do is stick a little code in the JSP... ie I check the 
bean, or the URI... then redirect or give the user a little message.


Interesting question... thanks

I tested on NB... there it just amounted to dragging the jsp's to the META 
folder... done.


Have fun..

---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---


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



Re: disable directory indexing in tomcat?

2008-06-14 Thread Johnny Kewl


- Original Message - 
From: Dave Girardin [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, June 13, 2008 11:38 PM
Subject: disable directory indexing in tomcat?



Group,

I'm a Unix admin working on a Solaris 8 server running Tomcat 6.0.16. No
other apps run on the server, for example, there is no Apache httpd 
running.

I have been tasked with disabling directory indexing based on a security
scan that provided this infomation:


Look in the GLOBAL web.xml

- servlet
 servlet-namedefault/servlet-name
 servlet-classorg.apache.catalina.servlets.DefaultServlet/servlet-class
- init-param
 param-namedebug/param-name
 param-value0/param-value
 /init-param
- init-param
 param-namelistings/param-name
 param-valuefalse/param-value
 /init-param
 load-on-startup1/load-on-startup
 /servlet

See that listing... thats the thing... yours is true.

---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---


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



Re: Installing the deployer on windows server 2003

2008-06-14 Thread Johnny Kewl


- Original Message - 
From: Vinny [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, June 13, 2008 8:37 PM
Subject: Installing the deployer on windows server 2003



I have tomcat 5.5  java 1.5 on window server 2003.
Does the windows installer come with the Deployer bundled?
I basically just want to deploy my webapps from netbeans remotely.
If I need to install the Deployer separately , do I just uncompress it in
the same installation folder as tomcat_home ?


Wil, I dont do this stuff every day, so I could be wrong...
The only time you really need the deployer package is if you want to go nuts 
with ANT stuff.

Thats what I used it for if I remember correctly

Otherwise its much easier
Type this into your browser
http://localhost:8080/manager/html

ie logon the TC of interest, pick the war file which lives in your NB DIST 
folder... it shall go there ;)


The NB deploy stuff in the menu's is doing the same thing... but targets the 
TC you using in the project.


---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---  



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



Re: Farm War Deployer / Deploment Strategies

2008-06-14 Thread Johnny Kewl


- Original Message - 
From: Theparanoidone Theparanoidone [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Thursday, June 12, 2008 9:14 PM
Subject: Farm War Deployer / Deploment Strategies



Hola~

I'm looking for an efficient way to deploy a tomcat project to 2 or more 
tomcat servers simultaneously.


Changes to are tomcat project may affect the way it communicates with a 
database, and therefore we'd like to make sure the deployment takes place 
swiftly.


What are some of the better ways to deploy a project to multiple 
servers???




According to this link from 2007, the farm war deployer is broken... but 
it hints at other methods:

http://marc.info/?l=tomcat-userm=117345255505224w=2

It also seems to state it's still broken in the docs here:
http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-deployer.html



Oh sorry, my previous post assumed you were using sticky sessions... didnt 
realize you clustering (persisting sessions), and to be honest I'd almost 
forgotten it was there, looked at it along time ago and decided sticky is 
for me ;)

I think heres your answer...
http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-deployer.html

Maybe sticky is also for you ;)

This is the article I read yonks ago.. and decided I can live with sticky...
http://www.onjava.com/pub/a/onjava/2004/11/24/replication1.html

Good luck!

---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
--- 



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



Re: Tomcat will not create session cookie

2008-06-14 Thread Johnny Kewl


- Original Message - 
From: mkweb [EMAIL PROTECTED]

To: users@tomcat.apache.org
Sent: Friday, June 13, 2008 11:44 AM
Subject: Tomcat will not create session cookie




Hello,
I'm new to the forum. I have a strange problem with my tomcat 
installation.

I'm using tomcat5.5.26 and struts for my web projekt.

I configured the projekt in a context file, like this :
Context path= docBase=C:\webprojekt debug=1 reloadable=true
crossContext=true cookies=true

I set the attribute cookies to 'true' because I want to have session
cookies.

Furthermore I added the following lines to the index.jsp to display the
cookies :

out.println(hCookies : /h);
Cookie[] cookies=request.getCookies();
if(cookies==null) {
out.println(No cookies);
} else {
Cookie MyCookie;
for(int i=0;icookies.length;i++) {
MyCookie=cookies[i];
out.println(MyCookie.getName() + =+MyCookie.getValue());
}
}



Mario, I dont use Struts...
But this is what my code typically looks like

   HttpSession session = request.getSession(true);
   daBean= (DaBean)session.getAttribute(daBean);
   if (daBean== null) { // make new bean
   daBean= new daBean();
   } else {// got session info

   }

That getSession(true);
makes the cookie if there isnt one... and struts probably has some XML that 
does this.


Then the other thing is that you must send it when you send your form... its 
no good only making the sesion (cookie) when you trying to read the form 
data, its too late then.


You dont have to set cookies=true its the default... and it means it will 
use cookies, but you still have to create the things.

Somewhere underneath struts is doing this I guess...

Hope that helps...

---
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
--- 



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



RE: URL is null and HTTP 404 error when using FROM authentication

2008-06-14 Thread Caldarale, Charles R
 From: exkor [mailto:[EMAIL PROTECTED]
 Subject: Re: URL is null and HTTP 404 error when using FROM
 authentication

It's good that you're starting from a clean install.

 MySQL logs indicate the the connector has connected to the database
 and quering the right table + fields:

Except there's no query for the role, indicating that either the uid is not 
found or the password check fails.  The MySQL logs should show the responses to 
the queries; do those look correct?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

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



Re: URL is null and HTTP 404 error when using FROM authentication

2008-06-14 Thread exkor
Hi Chuck

Thanks alot for this last bit about the query for the roles, it
actually made me realize what was wrong. The digest algorithm i used
to initialize my users table was different from the digest algorithm
used by tomcat. This is very surprising I've never seen encountered
something like that in the past. The algorith I used was from
www.md5oogle.com, so apperently they are using some different
encoding...

So I've changed the global sever.xml config and i see this in MySQL logs:
080614  9:57:35 118 Connect [EMAIL PROTECTED] on hamula
118 Query   /* mysql-connector-java-5.1.6 ( Revision:
${svn.Revision} ) */SHOW VARIABLES WHERE Variable_name ='language' OR
Variable_name = 'net_write_timeout' OR Variable_name =
'interactive_timeout' OR Variable_name = 'wait_timeout' OR
Variable_name = 'character_set_client' OR Variable_name =
'character_set_connection' OR Variable_name = 'character_set' OR
Variable_name = 'character_set_server' OR Variable_name =
'tx_isolation' OR Variable_name = 'transaction_isolation' OR
Variable_name = 'character_set_results' OR Variable_name = 'timezone'
OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone'
OR Variable_name = 'lower_case_table_names' OR Variable_name =
'max_allowed_packet' OR Variable_name = 'net_buffer_length' OR
Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR
Variable_name = 'query_cache_size' OR Variable_name = 'init_connect'
080614  9:57:54 118 Query   SELECT password FROM users WHERE
uid = '[EMAIL PROTECTED]'
118 Query   commit
118 Query   SELECT role FROM users WHERE uid = '[EMAIL 
PROTECTED]'
118 Query   commit

And it actually lets me through when i try to login into the manager.

The problem im having right now (which i beleave is relatively simple)
is that my app doesn't connect to the DB. I configured server.xml back
to use MemoryRealm because i want only the app to use the DB. Then
I've changed my apps context.xml to this:
?xml version=1.0 encoding=UTF-8?

Context path=/hamula docBase=hamula
debug=5 reloadable=true crossContext=true

Resource name=jdbc/hamula
  auth=Container
  type=javax.sql.DataSource
  driverClassName=com.mysql.jdbc.Driver
  url=jdbc:mysql://localhost:3306/hamula?autoReconnect=true/
  username=root
  password=skywalker
  digest=MD5
  userTable=users
  userNameCol=uid
  userCredCol=password
  userRoleTable=users
  roleNameCol=role
  logAbandoned=true
  removeAbandoned=true
  removeAbandonedTimeout=10
  maxActive=20
  maxIdle=10
  maxWait=-1/

/Context

And my web.xml to this:
web-app
display-nameHamula/display-name
distributable/

welcome-file-list
welcome-file
  home.jsp
/welcome-file
/welcome-file-list


resource-ref
descriptionDB Connection/description
res-ref-namejdbc/hamula/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref

security-constraint
web-resource-collection
web-resource-nameHamula/web-resource-name
descriptionPages accessible by registered users/description

!-- PAGES ACCESIBLE ONLY BY REGISTERED USERS SHOULD BE
ADDED HERE --
url-pattern/home.jsp/url-pattern
url-pattern/events.jsp/url-pattern
url-pattern/profile.jsp/url-pattern
url-pattern/community.jsp/url-pattern
!--
THIS IS AN EXAMPLE OF A PATTERN TO MATCH MANY PAGES
url-pattern/protected/*.jsp/url-pattern
   --
!--
= --

http-methodGET/http-method
http-methodPOST/http-method
/web-resource-collection
auth-constraint
role-nameadmin/role-name
role-namemanager/role-name
/auth-constraint
/security-constraint

login-config
auth-methodFORM/auth-method
form-login-config
form-login-page/index.jsp/form-login-page
form-error-page/index.jsp/form-error-page
/form-login-config
/login-config

security-role
description
The role that is required to access registered user functions and
pages
/description
role-nameadmin/role-name
role-namemanager/role-name
/security-role
/web-app

I don't see any attempt for a connection in the mysql logs... very weird...
Do I need to define some global naming for the DB connection?


Thanks
-Assaf

On Sat, Jun 14, 2008 at 7:55 AM, Caldarale, Charles R
[EMAIL PROTECTED] wrote:
 From: exkor [mailto:[EMAIL PROTECTED]
 Subject: Re: URL is null and HTTP 404 

RE: mapping tomcat to ip address behind router

2008-06-14 Thread Steve Ochani
Date sent:  Fri, 13 Jun 2008 08:52:51 -0500
From:   Caldarale, Charles R [EMAIL PROTECTED]
Subject:RE: mapping tomcat to ip address behind router
To: Tomcat Users List users@tomcat.apache.org
Send reply to:  Tomcat Users List users@tomcat.apache.org

  From: Walter Thompson [mailto:[EMAIL PROTECTED]
  Subject: RE: mapping tomcat to ip address behind router
 
  IP numbers usually are 0-255 and the end number in your IP
  address is 456?
 
 Sometimes we miss the obvious.  Not just usually 0-255, they must be
 0-255, since it's an octet.
 
 Thanks for pointing out what Steve, Chris, Johnny, and I missed.
 
  - Chuck
 

I had just figured that ip address was fake to hide his real address and I 
mostly ignored that 
section since he said that it was working.


-Steve O.




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



Tomcat started but is not available!

2008-06-14 Thread henry human
Hello
I have Tomcat 6.0.4, JRE 1.6 on my PC. I embed tomcat
in eclipse IDE.
When i run  tomcat with the startup.bat from the
console i have access to tomcat at the web browser via
http://localhost:8080 and I see in the console output
of the tomcat that my web applications in
tomcat/webapps are deployed.
In contrast to that, when i start it inside eclipse,
although i see that the tomcat is successfully
started, but the tomcat output does not show that my
web applications are deployed and at the browser i
have no access to server typing http://localhost:8080!

I get the HTTP Status 404 - / ERROR:

HTTP Status 404 - / 
type Status report
description The requested resource (/) is not
available.
Apache Tomcat/6.0.14
++


Thanks for you hints
henry



  __
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

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



Re: Tomcat started but is not available!

2008-06-14 Thread Youssef Mohammed
it is just because under eclipse you don't have the the ROOT application .
just deploy your web app and it will work fine.


On Sat, Jun 14, 2008 at 10:14 PM, henry human [EMAIL PROTECTED] wrote:

 Hello
 I have Tomcat 6.0.4, JRE 1.6 on my PC. I embed tomcat
 in eclipse IDE.
 When i run  tomcat with the startup.bat from the
 console i have access to tomcat at the web browser via
 http://localhost:8080 and I see in the console output
 of the tomcat that my web applications in
 tomcat/webapps are deployed.
 In contrast to that, when i start it inside eclipse,
 although i see that the tomcat is successfully
 started, but the tomcat output does not show that my
 web applications are deployed and at the browser i
 have no access to server typing http://localhost:8080!

 I get the HTTP Status 404 - / ERROR:
 
 HTTP Status 404 - /
 type Status report
 description The requested resource (/) is not
 available.
 Apache Tomcat/6.0.14
 ++


 Thanks for you hints
 henry



  __
 Gesendet von Yahoo! Mail.
 Dem pfiffigeren Posteingang.
 http://de.overview.mail.yahoo.com

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




-- 
Regards, Youssef


Re: Tomcat started but is not available!

2008-06-14 Thread henry human
 it is just because under eclipse you don't have the
 the ROOT application .

What do you mean with a ROOT application?
Where should i deploy my web applications? they are
already in tomcat/webapps but as i said when i start
tomcat 
from eclipse, although the tomcat is started, but the
tomcat is not available from the browser and and
consequently my web applications too


 just deploy your web app and it will work fine.
Whre
 
 On Sat, Jun 14, 2008 at 10:14 PM, henry human
 [EMAIL PROTECTED] wrote:
 
  Hello
  I have Tomcat 6.0.4, JRE 1.6 on my PC. I embed
 tomcat
  in eclipse IDE.
  When i run  tomcat with the startup.bat from the
  console i have access to tomcat at the web browser
 via
  http://localhost:8080 and I see in the console
 output
  of the tomcat that my web applications in
  tomcat/webapps are deployed.
  In contrast to that, when i start it inside
 eclipse,
  although i see that the tomcat is successfully
  started, but the tomcat output does not show that
 my
  web applications are deployed and at the browser i
  have no access to server typing
 http://localhost:8080!
 
  I get the HTTP Status 404 - / ERROR:
  
  HTTP Status 404 - /
  type Status report
  description The requested resource (/) is not
  available.
  Apache Tomcat/6.0.14
  ++
 
 
  Thanks for you hints
  henry
 
 
 
  

__
  Gesendet von Yahoo! Mail.
  Dem pfiffigeren Posteingang.
  http://de.overview.mail.yahoo.com
 
 

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



  __
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

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



Re: Tomcat Custom Connector

2008-06-14 Thread Bill Barker
The Adapter is set in the initialize method  of the Connector 
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/connector/Connector.html).
 
You can pretty much just trust that Tomcat will give you an Adapter instance 
before the first request comes through, since that is the contract.  Yes, 
the current implementation only will give you an instance of CoyoteAdapter, 
but programming your ProtocolHandler around this is dangerous, since the 
contract only promises an instance of Adapter.

The Adapter is the bridge between your ProtocolHandler and the Tomcat 
Servlet Container.  Once you hand off your Request and Response objects to 
the Adapter, you can trust that Tomcat will handle all of the Servlet-Spec 
parts by itself, including finding the Servlet to send the request to.  At 
that point, you are only responsible for communicating with the client over 
the wire via the InputBuffer and OutputBuffer interfaces.  For example, the 
various AJP/1.3 Connectors 
(http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpProcessor.html)
 
convert the message into AJP/1.3 format before sending it over the wire to 
Apache httpd.

Once you have figured out how to initialize the Request and Response objects 
to look enough like the wire protocol was HTTP, the rest is really pretty 
easy :).  For non-HTTP protocols (e.g. trying to make Tomcat look like an 
FTP server), this is the hard part.

Simon Aquilina [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Hi,

I have checked the code in Tomcat again, and although it is very confusing I 
feel I did understand something here and there :)

However I have a question - where is the adapter being set? No Adapter is 
being initialized in the 'JIoEndPoint', 'Http11Protocol' and 
'Http11Processor'. I also checked the 'server.xml' file and this is not 
being set! From the API documentation I found out the 'CoyoteAdapter'; so is 
this the default being used for Tomcat? Is it the CoyoteAdapter which is 
responsible to find the servlet for which the request is? or?

Thanks for any comments,
Simon J.
 To: users@tomcat.apache.org From: [EMAIL PROTECTED] Subject: Re: 
 Tomcat Custom Connector Date: Tue, 3 Jun 2008 19:17:03 -0700  AFAIK, 
 there isn't a lot of documentation. But there isn't that much too  it. 
 You need to implement a ProtocolHandler  
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ProtocolHandler.html)
  
   This class is responsible for managing the transport (e.g. ServerSocket) 
 and  request threads (but the various EndPoint classes in  
 org.apache.tomcat.util.net may simplify this aspect for you). For best  
 results, this class may implement ActionHook as well  
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ActionHook.html).
  
   When a new request comes in, it is the ProtocolHandler's job to 
 initialize a  Request  
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Request.html) 
   and a Response  
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Response.html) 
   objects for it, making certain that they get valid InputBuffer  
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/InputBuffer.html)
  
   and OutputBuffer  
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/OutputBuffer.html)
  
   instances to comunicate with the client. Then within the thread, you 
 hand  the Request and Response off to the service method of the Adapter  
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Adapter.html) 
   that Tomcat will give to the ProtocolHandler. And that is pretty much it 
   :).  Using the standard server.xml (as opposed to Embedding), you 
 would configure  Tomcat to use your Connector with an element like: 
 Connector protocol=com.myfirm.mypackage.MyProtocolHandler ... / Any 
 other attributes in the Connector / tag will be passed JavaBean style  
 to the ProtocolHandler to handle init options.  For the simplest 
 example, look at  org.apache.coyote.memory.MemoryProtocolHandler (but 
 this one is mostly  useful for unit testing).  Simon Aquilina 
 [EMAIL PROTECTED] wrote in message  
 news:[EMAIL PROTECTED]  Hi, I am 
 interested in building a custom connector for Tomcat. I have checked  the 
 Tomcat source code and found the source code for the ‘http11’ and ‘ajp’  
 connectors. I thought of trying to understand the code of these two  
 connectors and then try to implement mine based on these. However I am no 
   expert and was wondering if there is any good documentation/tutorial on 
 how  a connector can be developed for Tomcat (I would later use this 
 connector  with Geronimo). Just to give you some insight; what I want to 
 achieve is to build a custom  connector so that Tomcat can understand 
 requests made from a 3rd party  clients who cannot communicate using the 
 Http protocol and nor do they  expect data in html format. Additionally 
 some of the clients could  communicate on Bluetooth! I do not 

RE: Tomcat Custom Connector

2008-06-14 Thread Martin Gainty

Any ability to configure in custom JioEndpoint?
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/tomcat/util/net/JIoEndpoint.html

which can be configured as parameter to Ajp?
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpProcessor.html#AjpProcessor(int,%20org.apache.tomcat.util.net.JIoEndpoint)

?
Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 


 To: users@tomcat.apache.org
 From: [EMAIL PROTECTED]
 Subject: Re: Tomcat Custom Connector
 Date: Fri, 13 Jun 2008 19:51:35 -0700
 
 The Adapter is set in the initialize method  of the Connector 
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/connector/Connector.html).
  
 You can pretty much just trust that Tomcat will give you an Adapter instance 
 before the first request comes through, since that is the contract.  Yes, 
 the current implementation only will give you an instance of CoyoteAdapter, 
 but programming your ProtocolHandler around this is dangerous, since the 
 contract only promises an instance of Adapter.
 
 The Adapter is the bridge between your ProtocolHandler and the Tomcat 
 Servlet Container.  Once you hand off your Request and Response objects to 
 the Adapter, you can trust that Tomcat will handle all of the Servlet-Spec 
 parts by itself, including finding the Servlet to send the request to.  At 
 that point, you are only responsible for communicating with the client over 
 the wire via the InputBuffer and OutputBuffer interfaces.  For example, the 
 various AJP/1.3 Connectors 
 (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ajp/AjpProcessor.html)
  
 convert the message into AJP/1.3 format before sending it over the wire to 
 Apache httpd.
 
 Once you have figured out how to initialize the Request and Response objects 
 to look enough like the wire protocol was HTTP, the rest is really pretty 
 easy :).  For non-HTTP protocols (e.g. trying to make Tomcat look like an 
 FTP server), this is the hard part.
 
 Simon Aquilina [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 
 Hi,
 
 I have checked the code in Tomcat again, and although it is very confusing I 
 feel I did understand something here and there :)
 
 However I have a question - where is the adapter being set? No Adapter is 
 being initialized in the 'JIoEndPoint', 'Http11Protocol' and 
 'Http11Processor'. I also checked the 'server.xml' file and this is not 
 being set! From the API documentation I found out the 'CoyoteAdapter'; so is 
 this the default being used for Tomcat? Is it the CoyoteAdapter which is 
 responsible to find the servlet for which the request is? or?
 
 Thanks for any comments,
 Simon J.
  To: users@tomcat.apache.org From: [EMAIL PROTECTED] Subject: Re: 
  Tomcat Custom Connector Date: Tue, 3 Jun 2008 19:17:03 -0700  AFAIK, 
  there isn't a lot of documentation. But there isn't that much too  it. 
  You need to implement a ProtocolHandler  
  (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ProtocolHandler.html)
   
This class is responsible for managing the transport (e.g. ServerSocket) 
  and  request threads (but the various EndPoint classes in  
  org.apache.tomcat.util.net may simplify this aspect for you). For best  
  results, this class may implement ActionHook as well  
  (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/ActionHook.html).
   
When a new request comes in, it is the ProtocolHandler's job to 
  initialize a  Request  
  (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Request.html)
   
and a Response  
  (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Response.html)
   
objects for it, making certain that they get valid InputBuffer  
  (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/InputBuffer.html)
   
and OutputBuffer  
  (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/OutputBuffer.html)
   
instances to comunicate with the client. Then within the thread, you 
  hand  the Request and Response off to the service method of the Adapter  
  (http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/coyote/Adapter.html)
   
that Tomcat will give to the ProtocolHandler. And that is pretty much it 
:).  Using the standard server.xml (as opposed to Embedding), you 
  would configure  Tomcat to use your Connector with an element like: 
  Connector protocol=com.myfirm.mypackage.MyProtocolHandler ... / Any 
  other attributes in the Connector / tag will be passed JavaBean style  
  to the ProtocolHandler to handle init options.  For the simplest 
  example, look at  org.apache.coyote.memory.MemoryProtocolHandler