Re: Tomcat 7 Valve not logging correct response size

2011-12-04 Thread Konstantin Kolinko
2011/12/5 Antonios Kogias :
> Good morning,
>
>  I'm using Tomcat 7.0.16 and a Valve in the server.xml file that uses the %B
> option to log the "Bytes sent, excluding HTTP headers"
> (http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html).
>
>  directory="logs"
>               prefix="localhost_access_log." suffix=".txt"
>               pattern="%H %p %m %D %s %B %a %t "%r""
> resolveHosts="false"/>
>
> This works correctly for small response size (up to 30-40 kB), but for
> bigger sizes it doesn't; it only writes zero as response size in the web
> access log (I have tested that with 100 kB and 1000 kB static files).
>
> Any idea why is that happening and what can be done to overcome?
>
> Antonios
>
> PS. OS is MS Windows XP 32bit SP3

1. What happens with 7.0.23?
2. Are you sure that the file was delivered to the client? Was the
time taken to process the request greater than zero? Was ir response
200 OK, or 304 Not modified? In the latter case the file is not sent,
because the clint already has a copy of it.
3. What connectors are you using and what are their settings?

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Name comp is not bound in this Context

2011-12-04 Thread Konstantin Kolinko
2011/12/5 Jerry Malcolm <2ndgenfi...@gmail.com>:
> I'm currently migrating from Tomcat 5.5 to 7.0.  I have everything pretty
> much running now.  But I have one webapp that has run fine for years on
> 5.5, but will not run on 7.0.  I get the following error message:
> javax.naming.NameNotFoundException: Name comp is not bound in this Context.
>
> It occurs inside a servlet that autoruns on startup.  I'm trying to access
> a datasource resource statement defined in the context.
>
> The weird thing is that I copied that same app to another host on the same
> server, and it works fine.
>
> I'm stuck... any ideas what might be causing this message?
>

1. What exact version of 7.0.x on both servers?
2. What is in server.xml and in context XML file for your web
application? Is the resource defined there? (If that does not help,
remove comments and passwords and post the files here).
You must have META-INF/context.xml file in your application either
with Resource or with ResourceLink element.
You may compare configuration files between the servers. The JDBC
driver jar from your database vendor - is it present on both?
3. Any errors or warnings logged during Tomcat startup and webapp startup?

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Tomcat 7 Valve not logging correct response size

2011-12-04 Thread Antonios Kogias

Good morning,

  I'm using Tomcat 7.0.16 and a Valve in the server.xml file that uses 
the %B option to log the "Bytes sent, excluding HTTP headers" 
(http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html).


directory="logs"

   prefix="localhost_access_log." suffix=".txt"
   pattern="%H %p %m %D %s %B %a %t "%r"" 
resolveHosts="false"/>


This works correctly for small response size (up to 30-40 kB), but for 
bigger sizes it doesn't; it only writes zero as response size in the web 
access log (I have tested that with 100 kB and 1000 kB static files).


Any idea why is that happening and what can be done to overcome?

Antonios

PS. OS is MS Windows XP 32bit SP3


Re: MVC or Model2 with Tomcat

2011-12-04 Thread Blaxton





 From: André Warnier 
To: Tomcat Users List  
Sent: Monday, December 5, 2011 4:13:33 AM
Subject: Re: MVC or Model2 with Tomcat
 
Blaxton wrote:
> 
> 
> 
> 
>  From: André Warnier 
> To: Tomcat Users List  
> Sent: Monday, December 5, 2011 2:00:09 AM
> Subject: Re: MVC or Model2 with Tomcat
>  
> Blaxton wrote:
>>
>>
>> 
>>   From: Pid * 
>> To: Tomcat Users List  
>> Sent: Sunday, December 4, 2011 11:10:08 PM
>> Subject: Re: MVC or Model2 with Tomcat
>>  
>> On 4 Dec 2011, at 16:17, Blaxton  wrote:
>>
>>>
>>>
>>> 
>>> From: André Warnier 
>>> To: Tomcat Users List 
>>> Sent: Sunday, December 4, 2011 6:51:58 PM
>>> Subject: Re: MVC or Model2 with Tomcat
>>>
>>> Blaxton wrote:
 I have created ROOT directory and placed index.jsp in ROOT directory
 the same as your example:
 /path/to/appbase/ROOT/index.jsp    -> myhost.com/index.jsp

 but that didn't work.

 I followed following instructions but those didn't work either.

 http://www.jguru.com/faq/view.jsp?EID=91006

 http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F

 is there any thing else I should do to work this out?

>>> I wrote that second faq, but I don't see what it has to do with your 
>>> problem.
>>>
>>> You haven't answered Pid's question :
>>>
 Why do you need to do that to implement MVC?
>>> Nor his second question :
>>>
 Without more information about your config, e.g. workers.properties it's
 impossible to tell why this didn't work.
>>> And please, do not top-post.  It is very hard to follow a discussion when 
>>> you have to jump up and down in the mesage to understand what each phrase 
>>> relates to.
>>>
>>> Also, thank you for providing the versions of Apache httpd and Tomcat 
>>> up-front.
>>> But "mod_jk version 2", that does not exist.
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>
>>>
>>> My bad, the subject should have been "serving .jsp files from apache 
>>> document root"
>>> I just want to access my website as follow:
>>> www.mydomain.com/index.jsp
>>>
>>> the same as the solustion you wrote, but that solustion didn't work for me.
>>> maybe because in that solution you were talking about
>>> CATALINA_BASE/webapps/ROOT directory
>>> and I created CATALINA_BASE/webapps/myapplication/ROOT directory.
>>>
>>> can we have ROOT directory for each application ?
>>> like:
>>>
>>> CATALINA_BASE/webapps/ROOT
>>> CATALINA_BASE/webapps/firstapp/ROOT
>>> CATALINA_BASE/webapps/secondapp/ROOT
>> No, you can't. None of the docs day you can.
>>
>> ROOT is the special name for the default application, which serves
>> resources from / and handles all requests which are not handled by
>> other applications.
>>
>> Putting ROOT inside other apps just results in publishing that whole
>> dir as /appname/ROOT.
>>
>> If you don't provide other details of your config, no-one here will be
>> able to help, without a really, really lucky guess.
>>
>>
>> p
>>
>>
>>> anyway, here is the out put of the package query on my FreeBSD box:
>>> ap22-mo_jk-ap2-1.2.30_1 Apache2 JK module for connecting to Tomcat using 
>>> AJP1X
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>>
>> Its a virtual host with following lines have been added to main httpd.conf:
>> LoadModule jk_module          libexec/apache22/mod_jk.so
>> JkWorkersFile /usr/local/etc/apache22/workers.properties
>> JkShmFile     /var/log/mod_jk.shm
>> JkLogFile     /var/log/mod_jk.log
>> JkLogLevel   debug 
>> JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
>>
>> and following JkMount directives for each virtual host:
>> JkMount  /appexmp1/*     appexmp1
>> JkMount  /appexmp1/*.jsp appexmp1
>>
>> and following is the worker file for two of the sites:
>> worker.list=appexmp2,appexmp1
>> worker.appexmp2.type=ajp13
>> worker.appexmp2.host=localhost
>> worker.appexmp2.port=8009
>> worker.appexmp1.type=ajp13
>> worker.appexmp1.host=localhost
>> worker.appexmp1.port=8109
>>
>>
>> Created separate directories in CATALINA_BASE/webapps/
>> for each application so , it contain following directories:
>> CATALINA_BASE/webapps/ROOT
>> CATALINA_BASE/webapps/appexmp1
>> CATALINA_BASE/webapps/appexmp2
>>
>> context file for each application resides in 
>> CATALINA_BASE/conf/Catalina/localhost for example:
>> CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
>> CATALINA_BASE/conf/Catalina/localhost/appexmp2.xml
>>
>> cat  CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
>> > crossContext="true">
>> 
>>
>> and web.xml file as follow:
>> cat CATALINA_BASE/webap

RE: Do any of the Tomcat LDAP-type realms support "no password" authentication?

2011-12-04 Thread ohaya

 oh...@cox.net wrote: 
> 
>  "Caldarale wrote: 
> > > From: oh...@cox.net [mailto:oh...@cox.net] 
> > > Subject: Re: Do any of the Tomcat LDAP-type realms support "no password" 
> > > authentication?
> > 
> > > In other words, even though my valve code can assert a user 
> > > into Tomcat, and even if that same user already exists in the
> > > Tomcat realm, the asserted user seems to be 'disassociated'
> > > from the same user in the Tomcat realm?  
> > 
> > Need to get some terminology correct here.  A Realm does not normally 
> > contain users, roles, or any other authentication or authorization _data_; 
> > rather, it is a Java class that embodies rules for examining the 
> > credentials supplied by a login attempt and comparing them to credentials 
> > and roles stored in some external location.  By default (and never meant to 
> > be used in production), the external location is the file tomcat-users.xml, 
> > and the Realm is UserDatabaseRealm (augmented by LockOutRealm to discourage 
> > probing).  Several other Realm classes are supplied with Tomcat, to allow 
> > access to credentials from LDAP servers, relational databases, JAAS, etc.
> > 
> > I think what you need is essentially a Realm that does no authentication of 
> > its own (trusting httpd to do that), but does perform the authorization 
> > function.  It can then map the userid to whatever set of roles are 
> > appropriate for that user, and return the appropriate response when 
> > queried.  See the doc for details:
> > 
> > http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html
> > 
> > It would seem likely that someone out there has written a Realm that 
> > performs the above functions in conjunction with httpd authentication.  
> > (Note: you keep using the word "Apache" - which is a software organization 
> > with many products - when you're referring to httpd, a specific Apache 
> > product, as is Tomcat.)
> > 
> >  - Chuck
> > 
> 
> 
> Hi Chuck,
> 
> Corrections understood, and I'll try to be more careful.  As you point out, 
> and as I mentioned earlier in the thread, it seems like I've come all the way 
> around to the original subject "...Tomcat LDAP-type realms support "no 
> password" authentication?".
> 
> I've been and still am looking around for something like that, but haven't 
> found it yet.
> 
> I'm still puzzled by something though.  Even if I did find (or implement) a 
> realm that was a "no password realm", how do I tie the two pieces that I end 
> up with, the valve and the no-password realm, together?
> 
> In other words, I can pull the userID from the incoming header in the valve, 
> but then I think that the valve code then needs to authenticate against the 
> no-password realm.  Is that correct?
> 
> And, if so, how to do that?  
> 
> I've been looking for a way (API?) to programmatically "authenticate the 
> user" against Tomcat, so that I could add that into my valve code, but 
> haven't been find anything yet.
> 
> Thanks,
> Jim 
> 
> 


Hi,

I've had some success, so I thought that some of you might be interested.  
After much more searching, I still haven't been to find anything like a "no 
password realm", so what I've been hacking around is to add an authenticate() 
method to my valve, where that calls an realm.authenticate(), then a register() 
method.  

This is more of an "experiment" than something realistic.

Anyway, doing the above, I've been able to successfully authenticate the 
incoming userID "into the Tomcat realm".  What I mean by "into the Tomcat 
realm" is that I get a MemoryUser object back, that has the roles (via 
MemoryUser.getRoles()) that are configured in the tomcat-users.xml.

In other words, a header comes into Tomcat with, say, userID of "foobar".  My 
valve code authenticates the user into the Tomcat realm, and then things like 
isInRole(), etc. seem to all work.

What I'm still trying to figure out is that the realm.authenticate() is still 
requiring a password match.  I thought that I could coerce the 
realm.authenticate() to do a cert authentication, because I've read that with 
that, it basically just tries to do a match of the user string in 
tomcat-users.xml, but I haven't been able to figure out how to do that (coerce 
the authentication method) yet.  If anyone knows how to do that, please post 
back.

Thanks,
Jim



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Character set issue

2011-12-04 Thread Konstantin Kolinko
2011/12/5 André Warnier :
> Hi.
>
> I need help with a problem on a Tomcat system.  The system is of difficult
> access, and I cannot access it directly right now (this is Sunday night in
> Europe).
> I know that the system runs Tomcat 6.something, under Oracle/Sun Java 1.6,
> and that's all I can say right now. The platform is RedHat RHEL, current
> version.
>
> The problem which happens is that, after the update of a webapp (of which I
> do not have the code), it seems that non-US-English "diacritic" characters
> posted to the webapp from a web , are now "corrupted". And I would
> like to understand better the Tomcat mechanism for reading HTTP request form
> parameters, so that I can start to figure out what is going wrong.
>
> The webapp consists of a single servlet, wrapped by two filters.
> The application's web.xml defines the order as
> filter1
> filter2
> servlet
> with both filters processing all requests to the servlet.
>
> "filter1" is a commercial product used on many Tomcat sites.
> "filter2" is my own filter (and it is the only part of which I have the
> source code)
> "servlet" is also a commercial product of which I do not have the code, and
> the one which has just been updated.
>
> What I would like to know is : with a setup such as the above, how does
> Tomcat determine in which /character set/ the body of the POST will be read
> ?
>
> For example :
> Suppose that we have 2 html forms, form1 and form2.  Both forms are
> functionally identical, and contain a text input box named "name1".
> The form form1 has an html declaration which specifies it as having the
> charset "iso-8859-1".
> The form form2 has an html declaration which specifies it as having the
> charset "UTF-8".
>
> The user, in the input box "name1" of each form, types the string "TÜV"
> (second character = uppercase U with umlaut) and then posts the form to the
> webapp.
> The user browser is the same in all cases.
>
> If the servlet executes a request.getParameter("name1"), what are the
> factors which can determine how it receives the value of this parameter ?
>
> Or maybe my question should be : /can/ the servlet (or one of the filters)
> do anything that would cause the value of "name1" to /not/ be a correct Java
> "TÜV" string in the servlet ?
>
> Additional information :
> Only the servlet was updated.  Prior to that update, the application worked
> correctly. So I strongly suspect that it is the updated servlet which
> creates the problem.  But I'd like to understand /how/ it can create such a
> problem, and if for example something in filter1 or filter2 could contribute
> to the problem, or not.
> Filter1 is an authentication servlet filter, and as far as I know it only
> checks HTTP headers, and does not concern itself with the body of the
> request.  But I suppose that even the request body "passes through" this
> filter, and that it could presumably corrupt this body (although I would
> consider this unlikely right now).
> Filter2 is my own filter (and I am not a Java expert).  This filter works at
> a number of installations (and also here, before this servlet update).  It
> subclasses the HTTP request, because it needs to add a HTTP header to the
> request, on-the-fly.  But the subclass only overrides the methods which have
> to do with the HTTP headers, and does not handle the body directly.
>
> Any information or ideas welcome.
>

1. I think you know the FAQ:
http://wiki.apache.org/tomcat/FAQ/CharacterEncoding

2. Make sure that the web browser understands what character encoding
the web form uses.

Some browsers remember what encoding was used on the previous page and
use that instead of what is provided by server.
Mixing both ISO-8859-1 and UTF-8 forms on the same site is bad in this sense.

Make sure that content type and charset value in
 a) Content-Type HTTP header sent by server and
 b) in META tag in HTML text
have _literally_ the same value. If they both are present and they do
not match, odd things may happen in "non-compliant" browsers.

3. A servlet or JSP page called as "include" cannot change the content
type (and thus the charset). The <%@page contentType=".."%> directive
will be ignored.


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: MVC or Model2 with Tomcat

2011-12-04 Thread André Warnier

Blaxton wrote:





 From: André Warnier 
To: Tomcat Users List  
Sent: Monday, December 5, 2011 2:00:09 AM

Subject: Re: MVC or Model2 with Tomcat
 
Blaxton wrote:




  From: Pid * 
To: Tomcat Users List  
Sent: Sunday, December 4, 2011 11:10:08 PM

Subject: Re: MVC or Model2 with Tomcat
  
On 4 Dec 2011, at 16:17, Blaxton  wrote:






From: André Warnier 
To: Tomcat Users List 
Sent: Sunday, December 4, 2011 6:51:58 PM
Subject: Re: MVC or Model2 with Tomcat

Blaxton wrote:

I have created ROOT directory and placed index.jsp in ROOT directory
the same as your example:
/path/to/appbase/ROOT/index.jsp-> myhost.com/index.jsp

but that didn't work.

I followed following instructions but those didn't work either.

http://www.jguru.com/faq/view.jsp?EID=91006

http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F

is there any thing else I should do to work this out?


I wrote that second faq, but I don't see what it has to do with your problem.

You haven't answered Pid's question :


Why do you need to do that to implement MVC?

Nor his second question :


Without more information about your config, e.g. workers.properties it's
impossible to tell why this didn't work.

And please, do not top-post.  It is very hard to follow a discussion when you 
have to jump up and down in the mesage to understand what each phrase relates 
to.

Also, thank you for providing the versions of Apache httpd and Tomcat up-front.
But "mod_jk version 2", that does not exist.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


My bad, the subject should have been "serving .jsp files from apache document 
root"
I just want to access my website as follow:
www.mydomain.com/index.jsp

the same as the solustion you wrote, but that solustion didn't work for me.
maybe because in that solution you were talking about
CATALINA_BASE/webapps/ROOT directory
and I created CATALINA_BASE/webapps/myapplication/ROOT directory.

can we have ROOT directory for each application ?
like:

CATALINA_BASE/webapps/ROOT
CATALINA_BASE/webapps/firstapp/ROOT
CATALINA_BASE/webapps/secondapp/ROOT

No, you can't. None of the docs day you can.

ROOT is the special name for the default application, which serves
resources from / and handles all requests which are not handled by
other applications.

Putting ROOT inside other apps just results in publishing that whole
dir as /appname/ROOT.

If you don't provide other details of your config, no-one here will be
able to help, without a really, really lucky guess.


p



anyway, here is the out put of the package query on my FreeBSD box:
ap22-mo_jk-ap2-1.2.30_1 Apache2 JK module for connecting to Tomcat using AJP1X

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Its a virtual host with following lines have been added to main httpd.conf:
LoadModule jk_module  libexec/apache22/mod_jk.so
JkWorkersFile /usr/local/etc/apache22/workers.properties
JkShmFile /var/log/mod_jk.shm
JkLogFile /var/log/mod_jk.log
JkLogLevel   debug 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "


and following JkMount directives for each virtual host:
JkMount  /appexmp1/* appexmp1
JkMount  /appexmp1/*.jsp appexmp1

and following is the worker file for two of the sites:
worker.list=appexmp2,appexmp1
worker.appexmp2.type=ajp13
worker.appexmp2.host=localhost
worker.appexmp2.port=8009
worker.appexmp1.type=ajp13
worker.appexmp1.host=localhost
worker.appexmp1.port=8109


Created separate directories in CATALINA_BASE/webapps/
for each application so , it contain following directories:
CATALINA_BASE/webapps/ROOT
CATALINA_BASE/webapps/appexmp1
CATALINA_BASE/webapps/appexmp2

context file for each application resides in 
CATALINA_BASE/conf/Catalina/localhost for example:

CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
CATALINA_BASE/conf/Catalina/localhost/appexmp2.xml

cat  CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml



and web.xml file as follow:
cat CATALINA_BASE/webapps/appexmp1/WEB-INF/web.xml
http://java.sun.com/xml/ns/javaee"; version="2.5">

 App1
 com.appexmp1.App1
   

   
 App1
 /APP1
   

   
 index.jsp
   




I already can access mydomain.com/App1/index.jsp and every thing works fine
but want to be able to serve .jsp files as follow:
mydomain.com/index.jsp
for each of my virtual hosts.

I hope I have provided enough information.


No. :-)

What we are still missing, is how you have defined the DocumentRoot in each of your Apache 
httpd VirtualHost's. And also any Alias directive which mentions "App1".


Because with your above setup, calling "mydomain.com/App1/index.js

RE: Disabling Apps in host root

2011-12-04 Thread Caldarale, Charles R
> From: Jerry Malcolm [mailto:2ndgenfi...@gmail.com] 
> Subject: Disabling Apps in host root

> When I start tomcat

What exact version?  We're not mind-readers, and capabilities vary considerably 
depending on what level you're on.

> it tries to start an app for every folder in the 
> host root directory.

What do you mean by "host root directory"?  Do you really mean the  
appBase directory?  Be precise.

> Some folders are really apps (with WEB-INF), and 
> some are folders that are not apps at all.

Then why are the non-apps folders there?

> But it doesn't seem to care if there is a context or not.

Correct; nothing in the spec requires the existence of a  element or 
even WEB-INF/web.xml.

> Is there a way to control the apps that start up

Look at the deployIgnore attribute of the  element:

http://tomcat.apache.org/tomcat-7.0-doc/config/host.html

 - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Name comp is not bound in this Context

2011-12-04 Thread Jerry Malcolm
I'm currently migrating from Tomcat 5.5 to 7.0.  I have everything pretty
much running now.  But I have one webapp that has run fine for years on
5.5, but will not run on 7.0.  I get the following error message:
javax.naming.NameNotFoundException: Name comp is not bound in this Context.

It occurs inside a servlet that autoruns on startup.  I'm trying to access
a datasource resource statement defined in the context.

The weird thing is that I copied that same app to another host on the same
server, and it works fine.

I'm stuck... any ideas what might be causing this message?

Thanks.

Jerry


Disabling Apps in host root

2011-12-04 Thread Jerry Malcolm
When I start tomcat, it tries to start an app for every folder in the host
root directory.  Some folders are really apps (with WEB-INF), and some are
folders that are not apps at all.   It starts up the apps in folders with
WEB-INF, but also shows other folders as apps in the manager.  I would like
to control the apps I want to start up and prevent TC from starting
everything it can find.  I figured having a context defined might control
it.  But it doesn't seem to care if there is a context or not.

Is there a way to control the apps that start up (short of removing the
folders from the root)?

Thx.

Jerry


Re: MVC or Model2 with Tomcat

2011-12-04 Thread Blaxton





 From: André Warnier 
To: Tomcat Users List  
Sent: Monday, December 5, 2011 2:00:09 AM
Subject: Re: MVC or Model2 with Tomcat
 
Blaxton wrote:
> 
> 
> 
> 
>  From: Pid * 
> To: Tomcat Users List  
> Sent: Sunday, December 4, 2011 11:10:08 PM
> Subject: Re: MVC or Model2 with Tomcat
>  
> On 4 Dec 2011, at 16:17, Blaxton  wrote:
> 
>>
>>
>>
>> 
>> From: André Warnier 
>> To: Tomcat Users List 
>> Sent: Sunday, December 4, 2011 6:51:58 PM
>> Subject: Re: MVC or Model2 with Tomcat
>>
>> Blaxton wrote:
>>> I have created ROOT directory and placed index.jsp in ROOT directory
>>> the same as your example:
>>> /path/to/appbase/ROOT/index.jsp    -> myhost.com/index.jsp
>>>
>>> but that didn't work.
>>>
>>> I followed following instructions but those didn't work either.
>>>
>>> http://www.jguru.com/faq/view.jsp?EID=91006
>>>
>>> http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
>>>
>>> is there any thing else I should do to work this out?
>>>
>> I wrote that second faq, but I don't see what it has to do with your problem.
>>
>> You haven't answered Pid's question :
>>
>>> Why do you need to do that to implement MVC?
>> Nor his second question :
>>
>>> Without more information about your config, e.g. workers.properties it's
>>> impossible to tell why this didn't work.
>> And please, do not top-post.  It is very hard to follow a discussion when 
>> you have to jump up and down in the mesage to understand what each phrase 
>> relates to.
>>
>> Also, thank you for providing the versions of Apache httpd and Tomcat 
>> up-front.
>> But "mod_jk version 2", that does not exist.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>> My bad, the subject should have been "serving .jsp files from apache 
>> document root"
>> I just want to access my website as follow:
>> www.mydomain.com/index.jsp
>>
>> the same as the solustion you wrote, but that solustion didn't work for me.
>> maybe because in that solution you were talking about
>> CATALINA_BASE/webapps/ROOT directory
>> and I created CATALINA_BASE/webapps/myapplication/ROOT directory.
>>
>> can we have ROOT directory for each application ?
>> like:
>>
>> CATALINA_BASE/webapps/ROOT
>> CATALINA_BASE/webapps/firstapp/ROOT
>> CATALINA_BASE/webapps/secondapp/ROOT
> 
> No, you can't. None of the docs day you can.
> 
> ROOT is the special name for the default application, which serves
> resources from / and handles all requests which are not handled by
> other applications.
> 
> Putting ROOT inside other apps just results in publishing that whole
> dir as /appname/ROOT.
> 
> If you don't provide other details of your config, no-one here will be
> able to help, without a really, really lucky guess.
> 
> 
> p
> 
> 
>> anyway, here is the out put of the package query on my FreeBSD box:
>> ap22-mo_jk-ap2-1.2.30_1 Apache2 JK module for connecting to Tomcat using 
>> AJP1X
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 
> Its a virtual host with following lines have been added to main httpd.conf:
> LoadModule jk_module          libexec/apache22/mod_jk.so
> JkWorkersFile /usr/local/etc/apache22/workers.properties
> JkShmFile     /var/log/mod_jk.shm
> JkLogFile     /var/log/mod_jk.log
> JkLogLevel   debug 
> JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
> 
> and following JkMount directives for each virtual host:
> JkMount  /appexmp1/*     appexmp1
> JkMount  /appexmp1/*.jsp appexmp1
> 
> and following is the worker file for two of the sites:
> worker.list=appexmp2,appexmp1
> worker.appexmp2.type=ajp13
> worker.appexmp2.host=localhost
> worker.appexmp2.port=8009
> worker.appexmp1.type=ajp13
> worker.appexmp1.host=localhost
> worker.appexmp1.port=8109
> 
> 
> Created separate directories in CATALINA_BASE/webapps/
> for each application so , it contain following directories:
> CATALINA_BASE/webapps/ROOT
> CATALINA_BASE/webapps/appexmp1
> CATALINA_BASE/webapps/appexmp2
> 
> context file for each application resides in 
> CATALINA_BASE/conf/Catalina/localhost for example:
> CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
> CATALINA_BASE/conf/Catalina/localhost/appexmp2.xml
> 
> cat  CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
>  crossContext="true">
> 
> 
> and web.xml file as follow:
> cat CATALINA_BASE/webapps/appexmp1/WEB-INF/web.xml
> http://java.sun.com/xml/ns/javaee"; version="2.5">
> 
>     App1
>     com.appexmp1.App1
>   
> 
>   
>     App1
>     /APP1
>   
> 
>   
>     index.jsp
>   
> 
> 
> 
> 
> I already can access mydomain.com/App1/index.jsp and every thing works fine
> but want to be able to serve 

Re: MVC or Model2 with Tomcat

2011-12-04 Thread André Warnier

Blaxton wrote:





 From: Pid * 
To: Tomcat Users List  
Sent: Sunday, December 4, 2011 11:10:08 PM

Subject: Re: MVC or Model2 with Tomcat
 
On 4 Dec 2011, at 16:17, Blaxton  wrote:







From: André Warnier 
To: Tomcat Users List 
Sent: Sunday, December 4, 2011 6:51:58 PM
Subject: Re: MVC or Model2 with Tomcat

Blaxton wrote:

I have created ROOT directory and placed index.jsp in ROOT directory
the same as your example:
/path/to/appbase/ROOT/index.jsp-> myhost.com/index.jsp

but that didn't work.

I followed following instructions but those didn't work either.

http://www.jguru.com/faq/view.jsp?EID=91006

http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F

is there any thing else I should do to work this out?


I wrote that second faq, but I don't see what it has to do with your problem.

You haven't answered Pid's question :


Why do you need to do that to implement MVC?

Nor his second question :


Without more information about your config, e.g. workers.properties it's
impossible to tell why this didn't work.

And please, do not top-post.  It is very hard to follow a discussion when you 
have to jump up and down in the mesage to understand what each phrase relates 
to.

Also, thank you for providing the versions of Apache httpd and Tomcat up-front.
But "mod_jk version 2", that does not exist.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


My bad, the subject should have been "serving .jsp files from apache document 
root"
I just want to access my website as follow:
www.mydomain.com/index.jsp

the same as the solustion you wrote, but that solustion didn't work for me.
maybe because in that solution you were talking about
CATALINA_BASE/webapps/ROOT directory
and I created CATALINA_BASE/webapps/myapplication/ROOT directory.

can we have ROOT directory for each application ?
like:

CATALINA_BASE/webapps/ROOT
CATALINA_BASE/webapps/firstapp/ROOT
CATALINA_BASE/webapps/secondapp/ROOT


No, you can't. None of the docs day you can.

ROOT is the special name for the default application, which serves
resources from / and handles all requests which are not handled by
other applications.

Putting ROOT inside other apps just results in publishing that whole
dir as /appname/ROOT.

If you don't provide other details of your config, no-one here will be
able to help, without a really, really lucky guess.


p



anyway, here is the out put of the package query on my FreeBSD box:
ap22-mo_jk-ap2-1.2.30_1 Apache2 JK module for connecting to Tomcat using AJP1X


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Its a virtual host with following lines have been added to main httpd.conf:
LoadModule jk_module  libexec/apache22/mod_jk.so
JkWorkersFile /usr/local/etc/apache22/workers.properties
JkShmFile /var/log/mod_jk.shm
JkLogFile /var/log/mod_jk.log
JkLogLevel   debug 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "


and following JkMount directives for each virtual host:
JkMount  /appexmp1/* appexmp1
JkMount  /appexmp1/*.jsp appexmp1

and following is the worker file for two of the sites:
worker.list=appexmp2,appexmp1
worker.appexmp2.type=ajp13
worker.appexmp2.host=localhost
worker.appexmp2.port=8009
worker.appexmp1.type=ajp13
worker.appexmp1.host=localhost
worker.appexmp1.port=8109


Created separate directories in CATALINA_BASE/webapps/
for each application so , it contain following directories:
CATALINA_BASE/webapps/ROOT
CATALINA_BASE/webapps/appexmp1
CATALINA_BASE/webapps/appexmp2

context file for each application resides in 
CATALINA_BASE/conf/Catalina/localhost for example:

CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
CATALINA_BASE/conf/Catalina/localhost/appexmp2.xml

cat  CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml



and web.xml file as follow:
cat CATALINA_BASE/webapps/appexmp1/WEB-INF/web.xml
http://java.sun.com/xml/ns/javaee"; version="2.5">

App1
com.appexmp1.App1
  

  
App1
/APP1
  

  
index.jsp
  




I already can access mydomain.com/App1/index.jsp and every thing works fine
but want to be able to serve .jsp files as follow:
mydomain.com/index.jsp
for each of my virtual hosts.

I hope I have provided enough information.


No. :-)

What we are still missing, is how you have defined the DocumentRoot in each of your Apache 
httpd VirtualHost's. And also any Alias directive which mentions "App1".


Because with your above setup, calling "mydomain.com/App1/index.jsp" can only work, if you 
have allowed Apache httpd to access your Tomcat applications directory directly.  Which 
you should not do.


Here is a reason why you should not do this :
Try the 

Character set issue

2011-12-04 Thread André Warnier

Hi.

I need help with a problem on a Tomcat system.  The system is of difficult access, and I 
cannot access it directly right now (this is Sunday night in Europe).
I know that the system runs Tomcat 6.something, under Oracle/Sun Java 1.6, and that's all 
I can say right now. The platform is RedHat RHEL, current version.


The problem which happens is that, after the update of a webapp (of which I do not have 
the code), it seems that non-US-English "diacritic" characters posted to the webapp from a 
web , are now "corrupted". And I would like to understand better the Tomcat 
mechanism for reading HTTP request form parameters, so that I can start to figure out what 
is going wrong.


The webapp consists of a single servlet, wrapped by two filters.
The application's web.xml defines the order as
filter1
filter2
servlet
with both filters processing all requests to the servlet.

"filter1" is a commercial product used on many Tomcat sites.
"filter2" is my own filter (and it is the only part of which I have the source 
code)
"servlet" is also a commercial product of which I do not have the code, and the one which 
has just been updated.


What I would like to know is : with a setup such as the above, how does Tomcat determine 
in which /character set/ the body of the POST will be read ?


For example :
Suppose that we have 2 html forms, form1 and form2.  Both forms are functionally 
identical, and contain a text input box named "name1".

The form form1 has an html declaration which specifies it as having the charset 
"iso-8859-1".
The form form2 has an html declaration which specifies it as having the charset 
"UTF-8".

The user, in the input box "name1" of each form, types the string "TÜV" (second character 
= uppercase U with umlaut) and then posts the form to the webapp.

The user browser is the same in all cases.

If the servlet executes a request.getParameter("name1"), what are the factors which can 
determine how it receives the value of this parameter ?


Or maybe my question should be : /can/ the servlet (or one of the filters) do anything 
that would cause the value of "name1" to /not/ be a correct Java "TÜV" string in the servlet ?


Additional information :
Only the servlet was updated.  Prior to that update, the application worked correctly. So 
I strongly suspect that it is the updated servlet which creates the problem.  But I'd like 
to understand /how/ it can create such a problem, and if for example something in filter1 
or filter2 could contribute to the problem, or not.
Filter1 is an authentication servlet filter, and as far as I know it only checks HTTP 
headers, and does not concern itself with the body of the request.  But I suppose that 
even the request body "passes through" this filter, and that it could presumably corrupt 
this body (although I would consider this unlikely right now).
Filter2 is my own filter (and I am not a Java expert).  This filter works at a number of 
installations (and also here, before this servlet update).  It subclasses the HTTP 
request, because it needs to add a HTTP header to the request, on-the-fly.  But the 
subclass only overrides the methods which have to do with the HTTP headers, and does not 
handle the body directly.


Any information or ideas welcome.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: MVC or Model2 with Tomcat

2011-12-04 Thread Blaxton





 From: Pid * 
To: Tomcat Users List  
Sent: Sunday, December 4, 2011 11:10:08 PM
Subject: Re: MVC or Model2 with Tomcat
 
On 4 Dec 2011, at 16:17, Blaxton  wrote:

>
>
>
>
> 
> From: André Warnier 
> To: Tomcat Users List 
> Sent: Sunday, December 4, 2011 6:51:58 PM
> Subject: Re: MVC or Model2 with Tomcat
>
> Blaxton wrote:
>> I have created ROOT directory and placed index.jsp in ROOT directory
>> the same as your example:
>> /path/to/appbase/ROOT/index.jsp    -> myhost.com/index.jsp
>>
>> but that didn't work.
>>
>> I followed following instructions but those didn't work either.
>>
>> http://www.jguru.com/faq/view.jsp?EID=91006
>>
>> http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
>>
>> is there any thing else I should do to work this out?
>>
>
> I wrote that second faq, but I don't see what it has to do with your problem.
>
> You haven't answered Pid's question :
>
>> Why do you need to do that to implement MVC?
>
> Nor his second question :
>
>> Without more information about your config, e.g. workers.properties it's
>> impossible to tell why this didn't work.
>
> And please, do not top-post.  It is very hard to follow a discussion when you 
> have to jump up and down in the mesage to understand what each phrase relates 
> to.
>
> Also, thank you for providing the versions of Apache httpd and Tomcat 
> up-front.
> But "mod_jk version 2", that does not exist.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
> My bad, the subject should have been "serving .jsp files from apache document 
> root"
> I just want to access my website as follow:
> www.mydomain.com/index.jsp
>
> the same as the solustion you wrote, but that solustion didn't work for me.
> maybe because in that solution you were talking about
> CATALINA_BASE/webapps/ROOT directory
> and I created CATALINA_BASE/webapps/myapplication/ROOT directory.
>
> can we have ROOT directory for each application ?
> like:
>
> CATALINA_BASE/webapps/ROOT
> CATALINA_BASE/webapps/firstapp/ROOT
> CATALINA_BASE/webapps/secondapp/ROOT

No, you can't. None of the docs day you can.

ROOT is the special name for the default application, which serves
resources from / and handles all requests which are not handled by
other applications.

Putting ROOT inside other apps just results in publishing that whole
dir as /appname/ROOT.

If you don't provide other details of your config, no-one here will be
able to help, without a really, really lucky guess.


p


> anyway, here is the out put of the package query on my FreeBSD box:
> ap22-mo_jk-ap2-1.2.30_1 Apache2 JK module for connecting to Tomcat using AJP1X

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Its a virtual host with following lines have been added to main httpd.conf:
LoadModule jk_module  libexec/apache22/mod_jk.so
JkWorkersFile /usr/local/etc/apache22/workers.properties
JkShmFile /var/log/mod_jk.shm
JkLogFile /var/log/mod_jk.log
JkLogLevel   debug 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

and following JkMount directives for each virtual host:
JkMount  /appexmp1/* appexmp1
JkMount  /appexmp1/*.jsp appexmp1

and following is the worker file for two of the sites:
worker.list=appexmp2,appexmp1
worker.appexmp2.type=ajp13
worker.appexmp2.host=localhost
worker.appexmp2.port=8009
worker.appexmp1.type=ajp13
worker.appexmp1.host=localhost
worker.appexmp1.port=8109


Created separate directories in CATALINA_BASE/webapps/
for each application so , it contain following directories:
CATALINA_BASE/webapps/ROOT
CATALINA_BASE/webapps/appexmp1
CATALINA_BASE/webapps/appexmp2

context file for each application resides in 
CATALINA_BASE/conf/Catalina/localhost for example:
CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
CATALINA_BASE/conf/Catalina/localhost/appexmp2.xml

cat  CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml



and web.xml file as follow:
cat CATALINA_BASE/webapps/appexmp1/WEB-INF/web.xml
http://java.sun.com/xml/ns/javaee"; version="2.5">

    App1
    com.appexmp1.App1
  

  
    App1
    /APP1
  

  
    index.jsp
  




I already can access mydomain.com/App1/index.jsp and every thing works fine
but want to be able to serve .jsp files as follow:
mydomain.com/index.jsp
for each of my virtual hosts.

I hope I have provided enough information.

Thanks for help

Re: MVC or Model2 with Tomcat

2011-12-04 Thread Pid *
On 4 Dec 2011, at 16:17, Blaxton  wrote:

>
>
>
>
> 
> From: André Warnier 
> To: Tomcat Users List 
> Sent: Sunday, December 4, 2011 6:51:58 PM
> Subject: Re: MVC or Model2 with Tomcat
>
> Blaxton wrote:
>> I have created ROOT directory and placed index.jsp in ROOT directory
>> the same as your example:
>> /path/to/appbase/ROOT/index.jsp-> myhost.com/index.jsp
>>
>> but that didn't work.
>>
>> I followed following instructions but those didn't work either.
>>
>> http://www.jguru.com/faq/view.jsp?EID=91006
>>
>> http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
>>
>> is there any thing else I should do to work this out?
>>
>
> I wrote that second faq, but I don't see what it has to do with your problem.
>
> You haven't answered Pid's question :
>
>> Why do you need to do that to implement MVC?
>
> Nor his second question :
>
>> Without more information about your config, e.g. workers.properties it's
>> impossible to tell why this didn't work.
>
> And please, do not top-post.  It is very hard to follow a discussion when you 
> have to jump up and down in the mesage to understand what each phrase relates 
> to.
>
> Also, thank you for providing the versions of Apache httpd and Tomcat 
> up-front.
> But "mod_jk version 2", that does not exist.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
> My bad, the subject should have been "serving .jsp files from apache document 
> root"
> I just want to access my website as follow:
> www.mydomain.com/index.jsp
>
> the same as the solustion you wrote, but that solustion didn't work for me.
> maybe because in that solution you were talking about
> CATALINA_BASE/webapps/ROOT directory
> and I created CATALINA_BASE/webapps/myapplication/ROOT directory.
>
> can we have ROOT directory for each application ?
> like:
>
> CATALINA_BASE/webapps/ROOT
> CATALINA_BASE/webapps/firstapp/ROOT
> CATALINA_BASE/webapps/secondapp/ROOT

No, you can't. None of the docs day you can.

ROOT is the special name for the default application, which serves
resources from / and handles all requests which are not handled by
other applications.

Putting ROOT inside other apps just results in publishing that whole
dir as /appname/ROOT.

If you don't provide other details of your config, no-one here will be
able to help, without a really, really lucky guess.


p


> anyway, here is the out put of the package query on my FreeBSD box:
> ap22-mo_jk-ap2-1.2.30_1 Apache2 JK module for connecting to Tomcat using AJP1X

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: MVC or Model2 with Tomcat

2011-12-04 Thread Blaxton





 From: André Warnier 
To: Tomcat Users List  
Sent: Sunday, December 4, 2011 6:51:58 PM
Subject: Re: MVC or Model2 with Tomcat
 
Blaxton wrote:
> I have created ROOT directory and placed index.jsp in ROOT directory
> the same as your example:
> /path/to/appbase/ROOT/index.jsp    -> myhost.com/index.jsp
> 
> but that didn't work. 
> 
> I followed following instructions but those didn't work either.
> 
> http://www.jguru.com/faq/view.jsp?EID=91006
> 
> http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
> 
> is there any thing else I should do to work this out?
> 

I wrote that second faq, but I don't see what it has to do with your problem.

You haven't answered Pid's question :

> Why do you need to do that to implement MVC?

Nor his second question :

> Without more information about your config, e.g. workers.properties it's
> impossible to tell why this didn't work.

And please, do not top-post.  It is very hard to follow a discussion when you 
have to jump up and down in the mesage to understand what each phrase relates 
to.

Also, thank you for providing the versions of Apache httpd and Tomcat up-front.
But "mod_jk version 2", that does not exist.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


My bad, the subject should have been "serving .jsp files from apache document 
root"
I just want to access my website as follow:
www.mydomain.com/index.jsp

the same as the solustion you wrote, but that solustion didn't work for me.
maybe because in that solution you were talking about 
CATALINA_BASE/webapps/ROOT directory
and I created CATALINA_BASE/webapps/myapplication/ROOT directory.

can we have ROOT directory for each application ?
like:

CATALINA_BASE/webapps/ROOT
CATALINA_BASE/webapps/firstapp/ROOT
CATALINA_BASE/webapps/secondapp/ROOT
.
.
.


anyway, here is the out put of the package query on my FreeBSD box:
ap22-mod_jk-ap2-1.2.30_1 Apache2 JK module for connecting to Tomcat using AJP1X


Thanks

Re: MVC or Model2 with Tomcat

2011-12-04 Thread André Warnier

Blaxton wrote:

I have created ROOT directory and placed index.jsp in ROOT directory
the same as your example:
/path/to/appbase/ROOT/index.jsp-> myhost.com/index.jsp

but that didn't work. 



I followed following instructions but those didn't work either.

http://www.jguru.com/faq/view.jsp?EID=91006

http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F

is there any thing else I should do to work this out?



I wrote that second faq, but I don't see what it has to do with your problem.

You haven't answered Pid's question :

> Why do you need to do that to implement MVC?

Nor his second question :

> Without more information about your config, e.g. workers.properties it's
> impossible to tell why this didn't work.

And please, do not top-post.  It is very hard to follow a discussion when you have to jump 
up and down in the mesage to understand what each phrase relates to.


Also, thank you for providing the versions of Apache httpd and Tomcat up-front.
But "mod_jk version 2", that does not exist.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Do any of the Tomcat LDAP-type realms support "no password" authentication?

2011-12-04 Thread André Warnier

oh...@cox.net wrote:
 "Caldarale wrote: 
From: oh...@cox.net [mailto:oh...@cox.net] 
Subject: Re: Do any of the Tomcat LDAP-type realms support "no password" authentication?
In other words, even though my valve code can assert a user 
into Tomcat, and even if that same user already exists in the

Tomcat realm, the asserted user seems to be 'disassociated'
from the same user in the Tomcat realm?  

Need to get some terminology correct here.  A Realm does not normally contain 
users, roles, or any other authentication or authorization _data_; rather, it 
is a Java class that embodies rules for examining the credentials supplied by a 
login attempt and comparing them to credentials and roles stored in some 
external location.  By default (and never meant to be used in production), the 
external location is the file tomcat-users.xml, and the Realm is 
UserDatabaseRealm (augmented by LockOutRealm to discourage probing).  Several 
other Realm classes are supplied with Tomcat, to allow access to credentials 
from LDAP servers, relational databases, JAAS, etc.

I think what you need is essentially a Realm that does no authentication of its 
own (trusting httpd to do that), but does perform the authorization function.  
It can then map the userid to whatever set of roles are appropriate for that 
user, and return the appropriate response when queried.  See the doc for 
details:

http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html

It would seem likely that someone out there has written a Realm that performs the above 
functions in conjunction with httpd authentication.  (Note: you keep using the word 
"Apache" - which is a software organization with many products - when you're 
referring to httpd, a specific Apache product, as is Tomcat.)

 - Chuck




Hi Chuck,

Corrections understood, and I'll try to be more careful.  As you point out, and as I mentioned 
earlier in the thread, it seems like I've come all the way around to the original subject 
"...Tomcat LDAP-type realms support "no password" authentication?".

I've been and still am looking around for something like that, but haven't 
found it yet.

I'm still puzzled by something though.  Even if I did find (or implement) a realm that 
was a "no password realm", how do I tie the two pieces that I end up with, the 
valve and the no-password realm, together?

In other words, I can pull the userID from the incoming header in the valve, 
but then I think that the valve code then needs to authenticate against the 
no-password realm.  Is that correct?

And, if so, how to do that?  


I've been looking for a way (API?) to programmatically "authenticate the user" 
against Tomcat, so that I could add that into my valve code, but haven't been find 
anything yet.



I am answering here, but it also follows-up on other previous messages to the list, to try 
and keep this manageable.


I believe that now you have reached a fundamental issue which you need to resolve first, 
before looking at the technical details of how to do it.


The basic issue - and I may not be expressing this entirely using the correct terms - is 
that the notion of "role" is somewhat specific to the Java servlet world, and it does not 
entirely match what in other "scopes" is called a "user attribute" and in yet other scopes 
is called a "user group", or even "privileges" for users and/or groups.


I don't know how OAM works, nor on what kind of concept among the above its "permissions" 
(to use yet another related concept) are based.


But in your case, to be entirely consistent, you would have to do the following 
:
After the user is /authenticated/ (meaning that you just have a user-id which you can 
trust), comes the /authorization/ part. That is, the user wants to access this webapp in 
Tomcat; is he allowed to do that ?
And to be consistent, you would have to ask OAM. And OAM would answer yes or no, on the 
base of information that OAM has, and Tomcat doesn't.
Because if you do otherwise, then you are going to find yourself obliged to duplicate 
under Tomcat a whole management of "roles" and keep them in sync with whatever back-end 
OAM uses to determine this.


To be more explicit : suppose you protect an application by Tomcat's declarative style of 
security, and in the web.xml of that application, you indicate that this application can 
only be used by users which have the "roleX" in their list of roles.
Then whenever a user tries to access the application, Tomcat will make a "isUserInRole" 
call, to find out if the current user has the role "roleX".
And for that, Tomcat will need a Realm, and this Realm will need a back-end which it can 
check to answer that question. And if this back-end is independent from the OAM system, 
then somehow you will have to keep it synchronised.  Because tomorrow the user can be 
promoted or demoted, and not have access to this application anymore, and this will be 
managed by the people who manage the users in the OAM system.
And you may also need a

Re: MVC or Model2 with Tomcat

2011-12-04 Thread Blaxton
I have created ROOT directory and placed index.jsp in ROOT directory
the same as your example:
/path/to/appbase/ROOT/index.jsp    -> myhost.com/index.jsp

but that didn't work. 


I followed following instructions but those didn't work either.

http://www.jguru.com/faq/view.jsp?EID=91006

http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F

is there any thing else I should do to work this out?

just want 






 From: Pid 
To: Tomcat Users List  
Sent: Sunday, December 4, 2011 2:11:22 PM
Subject: Re: MVC or Model2 with Tomcat
 
On 04/12/2011 09:32, Blaxton wrote:
> Apache 2.2.16  is connected to  Tomcat 6.0.29 through mod_jk version 2
> and every thing is working fine, but to implement Model2 or MVC, I need
> to serve JSP files from apache document root and don't know what is 
> the best soluction.

Why do you need to do that to implement MVC?


Mixing Apache HTTPD DocumentRoot and Tomcat appBase's is risky and often
users make mistakes which expose secure data.

Tomcat applications are not comparable with a DocumentRoot.  Each
application is indepedent and may be mapped to path which does not
exactly match the directory name.

Better practice is to separate the two:

/path/to/httpd/docroot/
/path/to/httpd/docroot/index.html  -> myhost.com/index.html
/path/to/httpd/docroot/images

/path/to/appbase/
/path/to/appbase/ROOT
/path/to/appbase/ROOT/index.jsp    -> myhost.com/index.jsp
/path/to/appbase/myapp/index.jsp   -> myhost.com/myapp/index.jsp


> Tried adding following to apache config file but that didn't help serving
> jsp files from apache document root.

Strongly recommend not doing that.


> JkMount /*.jsp ajp13

Without more information about your config, e.g. workers.properties it's
impossible to tell why this didn't work.


> Should i change Apache document root to tomcat's web application root
> to be able to support jsp files in apache document root ?
> 
> Or should i change the Tomcat's docbase to Apache's document root ?

No, definitely not.


> Or it can be done be aliasing in apache config file:
>
> Alias /examples /vat/tomcat3/webapps/examples

No, definitely not.


p



-- 

[key:62590808]

Re: MVC or Model2 with Tomcat

2011-12-04 Thread Pid
On 04/12/2011 09:32, Blaxton wrote:
> Apache 2.2.16  is connected to  Tomcat 6.0.29 through mod_jk version 2
> and every thing is working fine, but to implement Model2 or MVC, I need
> to serve JSP files from apache document root and don't know what is 
> the best soluction.

Why do you need to do that to implement MVC?


Mixing Apache HTTPD DocumentRoot and Tomcat appBase's is risky and often
users make mistakes which expose secure data.

Tomcat applications are not comparable with a DocumentRoot.  Each
application is indepedent and may be mapped to path which does not
exactly match the directory name.

Better practice is to separate the two:

 /path/to/httpd/docroot/
 /path/to/httpd/docroot/index.html  -> myhost.com/index.html
 /path/to/httpd/docroot/images

 /path/to/appbase/
 /path/to/appbase/ROOT
 /path/to/appbase/ROOT/index.jsp-> myhost.com/index.jsp
 /path/to/appbase/myapp/index.jsp   -> myhost.com/myapp/index.jsp


> Tried adding following to apache config file but that didn't help serving
> jsp files from apache document root.

Strongly recommend not doing that.


> JkMount /*.jsp ajp13

Without more information about your config, e.g. workers.properties it's
impossible to tell why this didn't work.


> Should i change Apache document root to tomcat's web application root
> to be able to support jsp files in apache document root ?
> 
> Or should i change the Tomcat's docbase to Apache's document root ?

No, definitely not.


> Or it can be done be aliasing in apache config file:
>
> Alias /examples /vat/tomcat3/webapps/examples

No, definitely not.


p



-- 

[key:62590808]



signature.asc
Description: OpenPGP digital signature


MVC or Model2 with Tomcat

2011-12-04 Thread Blaxton
Apache 2.2.16  is connected to  Tomcat 6.0.29 through mod_jk version 2
and every thing is working fine, but to implement Model2 or MVC, I need
to serve JSP files from apache document root and don't know what is 
the best soluction.

Tried adding following to apache config file but that didn't help serving
jsp files from apache document root.

JkMount /*.jsp ajp13
Should i change Apache document root to tomcat's web application root
to be able to support jsp files in apache document root ?

Or should i change the Tomcat's docbase to Apache's document root ?

Or it can be done be aliasing in apache config file:

Alias /examples /vat/tomcat3/webapps/examples

Thanks for help