Re: avoiding multiple form submission

2006-12-20 Thread olivier nouguier

1) How do you submit your forms ... a few years ago I had a guy who show my
that issue, in fact he submitted the form oncheck on an input image ...

2a) There is a simple server side pattern two avoid double submit:(could not
find the www reference).
* jsp put a token in the session (scriplet, taglib).
* submit action test the token and remove it from the session.
so the second post can safely fail as the token is not found !

2b) js code !?

On 12/19/06, Pierre Goupil [EMAIL PROTECTED] wrote:


Hello, listers !

As you have certainly seen it, some sites submit their forms as many times
as you validate them. For instance, how many forums post two messages if,
by
mistake, you click on the submit button twice ?

As everyone (I guess), I had to face this problem, and then... I gave
Hibernate a try : then, for some reason, it didn't happened to my webapp
anymore. Great, thought I !

But today, in front of my customers for a demo (!), I decided not to use
Firefox as usual, but Konqueror (a Linux browser). And to show them, I
validated a form 5-6 times and... it got submited twice. 'f*?*?' thought I
!
'Not now...' :-/

If anyone could explain me this behaviour, it would be appreciated : why
an
Hibernate can avoid this on a Firefox, but partly not on another browser !

But if I post it here is because my REAL question is this one : does
anyone
know a way to totally avoid this ? I guess this is servlet container
(hence
Tomcat, for me) - related.

Any suggestions ?

Regards,


Pierre

--
To her who remembers every word spoken,
From the heroe's oath
To the baby's cry.
You're my eternal witness.





--
Souviens-toi qu'au moment de ta naissance tout le monde était dans la joie
et toi dans les pleurs.
Vis de manière qu'au moment de ta mort, tout le monde soit dans les pleurs
et toi dans la joie.


Limit Num Requests

2006-12-20 Thread adamle

Hello,

I'm running a j2EE with Apache front end and Tomcat at the back accessing a
MySQL db.  I have some heavy urls, can take around 2 seconds each call.
While testing the site with JMeter if I put 25 users in a thread group and
hit the above url concurrently I kill my tomcat instance.
This means that someone could bring my site down with the above method?
I'm looking for some way to stop this happening.  Could be caused by by
ajp13 connector?
I'm not looking for a solution to cut down the time it takes to service each
request, with caching for instance.

Thanks in advance,
Adam.
-- 
View this message in context: 
http://www.nabble.com/Limit-Num-Requests-tf2858769.html#a7987047
Sent from the Tomcat - User mailing list archive at Nabble.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: Limit Num Requests

2006-12-20 Thread Peter Crowther
 From: adamle [mailto:[EMAIL PROTECTED] 
 While testing the site with JMeter if I put 25 users in a 
 thread group and
 hit the above url concurrently I kill my tomcat instance.

What's the error?  Do you run out of memory, for example?  How much
memory have you allocated to the JVM?

 I'm looking for some way to stop this happening.

Cut down the number of worker threads in Tomcat to limit the number of
requests that are processed concurrently?  Note that this has the
unpleasant side-effect of throttling Tomcat's request processing even
for the lighter pages that don't cause problems.

 Could be caused by ajp13 connector?

Much more likely to be an application issue - there are plenty of other
people on this list who run Tomcat with significantly higher loads than
that with no issues.

 I'm not looking for a solution to cut down the time it takes 
 to service each request, with caching for instance.

Then you are probably excluding your actual problem from consideration,
and you will be applying sticking plaster to a broken leg because you're
not willing to consider the real problem.

- Peter

-
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: Limit Num Requests

2006-12-20 Thread adamle

Thanks for the reply Peter.

I am caching these pages after they are processed, but because of the nature
of the application, they are many different kinds of these pages.

Tomcat does not even throw an exception, I have allocated 128-356 mb memory. 
It just dies and does not response to requests.

I am looking for a solution that for a certain url pattern only allows a
certain number of requests to be serviced at the same time.  This would
solve my problem, while not affecting servicing lighter pages.

Cheers,
Adam.



Peter Crowther wrote:
 
 From: adamle [mailto:[EMAIL PROTECTED] 
 While testing the site with JMeter if I put 25 users in a 
 thread group and
 hit the above url concurrently I kill my tomcat instance.
 
 What's the error?  Do you run out of memory, for example?  How much
 memory have you allocated to the JVM?
 
 I'm looking for some way to stop this happening.
 
 Cut down the number of worker threads in Tomcat to limit the number of
 requests that are processed concurrently?  Note that this has the
 unpleasant side-effect of throttling Tomcat's request processing even
 for the lighter pages that don't cause problems.
 
 Could be caused by ajp13 connector?
 
 Much more likely to be an application issue - there are plenty of other
 people on this list who run Tomcat with significantly higher loads than
 that with no issues.
 
 I'm not looking for a solution to cut down the time it takes 
 to service each request, with caching for instance.
 
 Then you are probably excluding your actual problem from consideration,
 and you will be applying sticking plaster to a broken leg because you're
 not willing to consider the real problem.
 
   - Peter
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Limit-Num-Requests-tf2858769.html#a7987388
Sent from the Tomcat - User mailing list archive at Nabble.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: How to Run Servlet

2006-12-20 Thread Andre Prasetya

no wonder, add the classpath to servlet, you need to ad the servlet-api.jar

e.g : javac -cp d:/path/to/servlet-api.jar HelloServlet.java

Athula, I suggest u startoff with an IDE, I recommend Netbeans for a
beginner to servlet.

download the Netbeans5.5

then new project, choose web project, choose the bundled tomcat as the
server

then new servlet, choose any name, or HelloWorld. Then you'll get a starter
servlet and a mapping

after that you can start running... and you can test using a browser. If the
bundled tomcat port is 1980 then you tried hitting
http://localhost:1980/context path/mapped servlet-name

for example if my context path is /Dummy and the mapped-servlet-name is
HelloWorld then I hit
http://localhost:1980/Dummy/HelloWorld

try it

I always regard a servlet as a cgi java, if you want to do a complex
programming, i recommend you start with java 1st then the servlet and jsp,
you might wanna take a look at Spring Framework, Struts, WebWork or GWT


On 12/20/06, athula bogoda [EMAIL PROTECTED] wrote:


Here is the out put. I run it on command prompt.


D:\BOGODA\DEVELOPMENT\PRODUCTS\SERVLETSjavac HelloServlet.java
HelloServlet.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
HelloServlet.java:5: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
HelloServlet.java:21: cannot find symbol
symbol: class HttpServlet
public class HelloServlet extends HttpServlet
  ^
HelloServlet.java:23: cannot find symbol
symbol  : class HttpServletRequest
location: class HelloServlet
  public void doGet(HttpServletRequest request,
^
HelloServlet.java:25: cannot find symbol
symbol  : class HttpServletResponse
location: class HelloServlet
HttpServletResponse response)
^
HelloServlet.java:27: cannot find symbol
symbol  : class ServletException
location: class HelloServlet
throws ServletException, IOException
   ^
6 errors

Thanks,
Athula


- Original Message 
From: David Delbecq [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, December 19, 2006 6:19:11 PM
Subject: Re: How to Run Servlet

And please provide the complete terminal output of compilation process
so we can have an idea what is your problem.
Mark Thomas a écrit :
 athula bogoda wrote:

 This is the file i tried to execute.

 I also set the class path for jsp-api.jar and servlet.jar files.
 But it did not work.


 Your servlet needs to be in a package.

 Next, how did you try and compile it when you got the Cannot find
 symbols. error?

 Mark




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




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







Send instant messages to your online friends http://uk.messenger.yahoo.com





--
-Andre-

People see things the way they are and say why ? I see things that never
were and say Why not ?


RE: Limit Num Requests

2006-12-20 Thread Peter Crowther
 From: adamle [mailto:[EMAIL PROTECTED] 
 I am looking for a solution that for a certain url pattern 
 only allows a
 certain number of requests to be serviced at the same time.  
 This would
 solve my problem, while not affecting servicing lighter pages.

Makes sense.

If you can stand for your users to get a 'Busy, please try again later'
message, then one approach would be to put a Filter in front of the
relevant pages.  Whenever it sends a request for processing, it
increments a filter-wide counter; whenever a request returns from
processing, it decrements the counter; if the counter is above a certain
value when the request comes in, don't forward the request and show the
client a try-later message.

If this isn't appropriate, I'm out of ideas - but I'm a lightweight on
this forum, and have never used AJP.  I suspect some of the better minds
on here will weigh in later!

- Peter

-
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: Limit Num Requests

2006-12-20 Thread adamle

Thanks for the idea Peter.

I thought of maybe putting a filter on the certain url pattern that I want,
but instead of turning back the user, I could put his thread to sleep for
aset amount of time and have him try again.  Hopefully by then some of the
earlier threads will have finished and he can be let through.

Do you some inherent problem with this?

Thanks,
Adam.



Peter Crowther wrote:
 
 From: adamle [mailto:[EMAIL PROTECTED] 
 I am looking for a solution that for a certain url pattern 
 only allows a
 certain number of requests to be serviced at the same time.  
 This would
 solve my problem, while not affecting servicing lighter pages.
 
 Makes sense.
 
 If you can stand for your users to get a 'Busy, please try again later'
 message, then one approach would be to put a Filter in front of the
 relevant pages.  Whenever it sends a request for processing, it
 increments a filter-wide counter; whenever a request returns from
 processing, it decrements the counter; if the counter is above a certain
 value when the request comes in, don't forward the request and show the
 client a try-later message.
 
 If this isn't appropriate, I'm out of ideas - but I'm a lightweight on
 this forum, and have never used AJP.  I suspect some of the better minds
 on here will weigh in later!
 
   - Peter
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Limit-Num-Requests-tf2858769.html#a7987715
Sent from the Tomcat - User mailing list archive at Nabble.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: Limit Num Requests

2006-12-20 Thread Peter Crowther
 From: adamle [mailto:[EMAIL PROTECTED] 
 I thought of maybe putting a filter on the certain url 
 pattern that I want,
 but instead of turning back the user, I could put his thread 
 to sleep for
 aset amount of time and have him try again.  Hopefully by 
 then some of the
 earlier threads will have finished and he can be let through.
 
 Do you some inherent problem with this?

I'd always be cautious about consuming any resource for an extended
period - in this case a thread.  An attacker could starve Tomcat of
threads by flooding the system with requests for the slow-processing
pages.  You probably wouldn't get a crash; you *would* get very slow
service elsewhere.

Is there no way you can hand back a 'try later' response, even using
something tacky like a refresh header?

- Peter

-
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[2]: PHP on Tomcat

2006-12-20 Thread Dima Retov
Here is faster solution.
http://php-java-bridge.sourceforge.net/

It runs PHP in FastCGI mode. (much faster then CGI)




Tuesday, December 19, 2006, 10:40:52 PM, you wrote:



d Ran-2 wrote:
 
 Has anyone managed to get PHP4/5 to work on Tomcat ? 

d Try here ..
d http://tools.herberlin.de/phpservlet/index.shtml phpservlet.war .. this
d worked for me on PHP5 (note: read configuration file re: use of
d php-cgi.exe).




-- 
Best regards,
 Dimamailto:[EMAIL PROTECTED]



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



RE: Installing Tomcat and IIS

2006-12-20 Thread Simon Renshaw
Thanks again!

Today I will try to install version 1.2.

Maybe I'll get it to work.

My other sites are OWA and a few Wikis (uses PHP).

-Original Message-
From: LiuYan 刘研 [mailto:[EMAIL PROTECTED] 
Sent: 19 décembre, 2006 21:51
To: users@tomcat.apache.org
Subject: RE: Installing Tomcat and IIS


I normally need to access http://localhost:9191/luntbuild to see my
application. So in theory with that filter thing installed correctly I
should be able to access it by going to http://localhost/luntbuild?
Yes, that's our goal of integration.

But for IIS, /luntbuild does not exist. How does it figure out that it is a
Tomcat dir?
Have you configured URI mapping ?
I use jk1.2 (not jk2), I have a uriworkermap.properties file which saved
from my former tomcat installtion.
It seems that new version tomcat does not contained this file. Here is the
original content in uriworkermap.properties file:
# uriworkermap.properties - IIS
#
# This file provides sample mappings for example ajp13w
# worker defined in workermap.properties.minimal
# The general sytax for this file is:
# [URL]=[Worker name]

/servlet-examples/*=ajp13w

# Optionally filter out all .jpeg files inside that context
# For no mapping the url has to start with exclamation (!)

!/servlet-examples/*.jpeg=ajp13w


Maybe you need map the uri of your application (/luntbuild) to 'ajp13'. I
simply mapped all uri (/*) to 'ajp13',.
If you use jk2 which that article used, you can read the last paragraph of
http://www.iis-resources.com/modules/AMS/article.php?storyid=485page=2

Also, I'm running a few websites on this server. Does this have an impact
on the Tomcat/IIS integration?
Does your websites use only 1 script language ?
We have 3 websites on the same server, the main website only use ASP, the
other two websites only use JSP, they works ok now.
But when I try to installing 'awstats' which use PERL/CGI, I can't get PERL
and JSP running at the same time.


-- 
View this message in context: 
http://www.nabble.com/Installing-Tomcat-and-IIS-tf2821771.html#a7983783
Sent from the Tomcat - User mailing list archive at Nabble.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]


-
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: Several instancias of Tomcat on a same machine

2006-12-20 Thread Bachler, Elisabeth \(Elisabeth\)
 
 Hello,
I have never done that before and I am affraid of making a mistake so
please help me with this.
I would like to download tomcat (5 times). I need 5 instances of tomcat
on the same machine (tomcat1, tomcat2, etc).
What do I have to configure in order to work I seem to remember I
need to modify the port but I cannot remember where!

Thanks
Elisabeth

-
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: Several instancias of Tomcat on a same machine

2006-12-20 Thread Peter Crowther
 From: Bachler, Elisabeth (Elisabeth) 
 [mailto:[EMAIL PROTECTED] 
 I would like to download tomcat (5 times).

You'll only need to download it once.

Are you wanting to run this on Windows or Linux, and do you want to
start the instances as daemons/services or from the command line?

 I need 5 instances of tomcat
 on the same machine (tomcat1, tomcat2, etc).
 What do I have to configure in order to work I seem to remember I
 need to modify the port but I cannot remember where!

The simple way:

- Get one Tomcat installed and working.

- Copy the installation.  Just once for now.

- Edit conf/server.xml.  Change the shutdown port (that's the one most
people forget) and the port in any Connectors that aren't commented out.

- Start this second installation using its startup.{bat,sh} and check it
works.

- Now repeat the process for the other 3 now that you're sure what you
want to change!

- Peter

-
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: Multi processor issue

2006-12-20 Thread Marziou, Gael
 By looking at the code of ApplicationDispatcher, I would tend to think
that 
 the answer is no because of fields like wrapRequest and requestURI
(there
 are other fields but they are unused) however the javadoc does not
mention it.

I forgot to include the question but some of you may have guessed it ;-)
The question was: can we call forward() on same ApplicationDispatcher
object from 2 concurrent threads?

Gael 




-
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: Setting session variables

2006-12-20 Thread Andres Cubides P.


Apache Tomcat version: 5.5.12
OS: Windows 2003 5.2

No errors appear in tomcat/stderr logs. I have a simple test servlet to show 
session id/variables, each time I call the servlet in the same browser 
session a different ID is returned:


ID 9180ECEA4F3CBBECC2FA86EA592D2C4E Created: Wed Dec 20 12:13:46 COT 2006 
Last Accessed: Wed Dec 20 12:13:46 COT 2006


ID 346AEE8B40C7DB83B330ED1DFC08928B Created: Wed Dec 20 12:13:59 COT 2006 
Last Accessed: Wed Dec 20 12:13:59 COT 2006


Can it be related with permissions in work/catalina directories?

thanks,




From: Peter Crowther [EMAIL PROTECTED]
Reply-To: Tomcat Users List users@tomcat.apache.org
To: Tomcat Users List users@tomcat.apache.org
Subject: RE: Setting session variables Date: Wed, 20 Dec 2006 16:39:45 
-


 From: Andres Cubides P. [mailto:[EMAIL PROTECTED]
 I'm having trouble setting session variables in a tomcat
 application.

*Exactly* which 5.5 version is it, what configuration (load-balanced?)
and what errors / symptoms do you get?  We don't really have a lot to go
on here...

- Peter

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



_
MSN Amor: busca tu ½ naranja http://latam.msn.com/amor/


-
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: Several instancias of Tomcat on a same machine

2006-12-20 Thread Bachler, Elisabeth \(Elisabeth\)

Thanks for your quick answer. 
I want to run the 5 instances of tomcat  on Solaris. 
Let's have a look at the server.xml and let's make sure I have understood 
correctly what needs to be done:

Server port=8004

Connector acceptCount=100 connectionTimeout=2 
disableUploadTimeout=true port=8081 redirectPort=8443
/Connector
Connector port=8009 protocol=AJP/1.3 
protocolHandlerClassName=org.apache.jk.server.JkCoyoteHandler 
redirectPort=8443
/Connector
.
- The shutdown port (in this case ... 8004) has to be unique... 
   ===  I can start with 8001 - 8002 ... Till 8005
- The http connector port (in this case  8081) has to be unique... == I 
can start with 8080 - 8081 - ... Till 8084

 === What about the redirectPort??? Should it change?  =

 - The ajp connector (in this case  8009) has to be unique ..
   == I can start with 8009 -8010  till 8013 

 == Do I need to modify other procedures? ==

Thanks
Elisabeth


-Original Message-
From: Peter Crowther [mailto:[EMAIL PROTECTED] 
Sent: miércoles, 20 de diciembre de 2006 17:49
To: Tomcat Users List
Subject: RE: Several instancias of Tomcat on a same machine

 From: Bachler, Elisabeth (Elisabeth)
 [mailto:[EMAIL PROTECTED]
 I would like to download tomcat (5 times).

You'll only need to download it once.

Are you wanting to run this on Windows or Linux, and do you want to start the 
instances as daemons/services or from the command line?

 I need 5 instances of tomcat
 on the same machine (tomcat1, tomcat2, etc).
 What do I have to configure in order to work I seem to remember I 
 need to modify the port but I cannot remember where!

The simple way:

- Get one Tomcat installed and working.

- Copy the installation.  Just once for now.

- Edit conf/server.xml.  Change the shutdown port (that's the one most people 
forget) and the port in any Connectors that aren't commented out.

- Start this second installation using its startup.{bat,sh} and check it works.

- Now repeat the process for the other 3 now that you're sure what you want to 
change!

- Peter

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


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



RE: Several instancias of Tomcat on a same machine

2006-12-20 Thread Peter Crowther
 From: Bachler, Elisabeth (Elisabeth) 
 - The shutdown port (in this case ... 8004) has to be unique... 
===  I can start with 8001 - 8002 ... Till 8005

Yes.

 - The http connector port (in this case  8081) has to be 
 unique... == I can start with 8080 - 8081 - ... Till 8084

Yes.

  === What about the redirectPort??? Should it change?  =

Only if you're using https: - in which case you should be changing the
https ports as well.

  - The ajp connector (in this case  8009) has to be unique ..
== I can start with 8009 -8010  till 8013 

Only true if you're using AJP - i.e. front-ending with Apache.  Are you?
If so, are you using it exclusively (in which case you can knock out the
http connector)?

  == Do I need to modify other procedures? ==

Not that I'm aware of.

- Peter

-
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: Several instancias of Tomcat on a same machine

2006-12-20 Thread Bachler, Elisabeth \(Elisabeth\)
I must admit that I don't know what AJP is ... So I guess I am not using it. No 
need to change it right?
Thank you so much!
 

-Original Message-
From: Peter Crowther [mailto:[EMAIL PROTECTED] 
Sent: miércoles, 20 de diciembre de 2006 18:22
To: Tomcat Users List
Subject: RE: Several instancias of Tomcat on a same machine

 From: Bachler, Elisabeth (Elisabeth)
 - The shutdown port (in this case ... 8004) has to be unique... 
===  I can start with 8001 - 8002 ... Till 8005

Yes.

 - The http connector port (in this case  8081) has to be unique... 
 == I can start with 8080 - 8081 - ... Till 8084

Yes.

  === What about the redirectPort??? Should it change?  =

Only if you're using https: - in which case you should be changing the https 
ports as well.

  - The ajp connector (in this case  8009) has to be unique ..
== I can start with 8009 -8010  till 8013

Only true if you're using AJP - i.e. front-ending with Apache.  Are you?
If so, are you using it exclusively (in which case you can knock out the http 
connector)?

  == Do I need to modify other procedures? ==

Not that I'm aware of.

- Peter

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


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



RE: Several instancias of Tomcat on a same machine

2006-12-20 Thread Peter Crowther
 From: Peter Crowther 
   - The ajp connector (in this case  8009) has to be unique ..
 == I can start with 8009 -8010  till 8013 
 
 Only true if you're using AJP - i.e. front-ending with 
 Apache.  Are you?
 If so, are you using it exclusively (in which case you can 
 knock out the http connector)?

That could have been misinterpreted.  If you're not using AJP, comment
the connector or change the ports as you suggest.

- Peter

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



Test JSP Page

2006-12-20 Thread Grok Mogger

Hey everyone,

I'm setting up Tomcat for the first time.  I'm trying to use a 
simple test just to verify that I have everything set up 
properly, and I was hoping someone could confirm for me that I 
understand what I'm doing.


I'm setting up Apache, mod_jk, and Tomcat on a (Debian) Linux 
server.


I have a test page (test.jsp) in my Apache www directory. 
Here's the test page in its entirety:



HTML
BODY
pHello World!/p
pThe time is now %= new java.util.Date() %/p
/BODY
/HTML


I believe the page I should see when I visit 
'http://www.myserver.com/test.jsp' should be...



Hello World!
The time is now 2:30:17


Where the time may not be formatted exactly like that and where 
it actually changes according to what time it happens to be.  Do 
I at least have that much right?  I'm not getting those results 
and I just want to make sure that I don't misunderstand how this 
is supposed to work.  I'm coming from a PHP background and might 
be confused.  =P


Thanks everyone,
- GM


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.25/593 - Release Date: 12/19/2006 
1:17 PM


-
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: Re[2]: PHP on Tomcat

2006-12-20 Thread Ran

Thanks Dima,
I may not understand how the the php-java bridge works. It did not seem to
allow a php application to run under Tomcat ?

ran

On 12/20/06, Dima Retov [EMAIL PROTECTED] wrote:


Here is faster solution.
http://php-java-bridge.sourceforge.net/

It runs PHP in FastCGI mode. (much faster then CGI)




Tuesday, December 19, 2006, 10:40:52 PM, you wrote:



d Ran-2 wrote:

 Has anyone managed to get PHP4/5 to work on Tomcat ?

d Try here ..
d http://tools.herberlin.de/phpservlet/index.shtml phpservlet.war .. this
d worked for me on PHP5 (note: read configuration file re: use of
d php-cgi.exe).




--
Best regards,
Dimamailto:[EMAIL PROTECTED]



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




Re: Setting session variables

2006-12-20 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andres,

Andres Cubides P. wrote:
 No errors appear in tomcat/stderr logs. I have a simple test servlet to
 show session id/variables, each time I call the servlet in the same
 browser session a different ID is returned:
 
 ID 9180ECEA4F3CBBECC2FA86EA592D2C4E Created: Wed Dec 20 12:13:46 COT
 2006 Last Accessed: Wed Dec 20 12:13:46 COT 2006
 
 ID 346AEE8B40C7DB83B330ED1DFC08928B Created: Wed Dec 20 12:13:59 COT
 2006 Last Accessed: Wed Dec 20 12:13:59 COT 2006

Ar you using the same browser to connect to both of your apps (the
working one, and the non-working one)?

If you are using Mozilla Firefox, is it possible that you have banned
one of the servers from setting cookies? I just had that problem this
morning on one of my test servers, actually. I nearly lost my mind
trying to figure out what was going on.

Also, if you are using ff, try the LiveHttpHeaders extension so you can
watch the HTTP headers going between the server and the browser. You
might be able to see if your browser is either ignoring the cookie or
(for some bizarre reason), sending the wrong one.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFiXN59CaO5/Lv0PARApp6AKC2B4BGE6mN+GNRCSzu59uiI/hNMQCgjKRq
I1rdqFIyOvBPadNhkSgzM5s=
=hi7w
-END PGP SIGNATURE-

-
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: JSessionId and Google

2006-12-20 Thread Brian Caruso
Consider using a filter like this:

package com.foo;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;

/**
 * Replaces the Response with one that will never put in a jsession.

 * Here is what needs to go into the web.xml:
 *
filter
filter-nameJSession Strip Filter/filter-name
filter-classcom.foo.JSessionStripFilter/filter-class
/filter

filter-mapping
filter-nameJSession Strip Filter/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
/filter-mapping

 * some of this code is from URLRewriteFilter
 */
public class JSessionStripFilter implements Filter {
private FilterConfig filterConfig = null;

//private static final Log log = 
LogFactory.getLog(JSessionStripFilter.class.getName());
public static String USING_JSESSION_STRIP = usingJsessionStrip;

public void init(FilterConfig filterConfig) throws ServletException {
//log.info(Filtering: no jsessionids will be generated.);
this.filterConfig = filterConfig;
}

public void doFilter(ServletRequest request, ServletResponse response,
 FilterChain chain) throws IOException, 
ServletException {
HttpServletResponse hResponse = (HttpServletResponse)response;
HttpServletRequest hRequest = (HttpServletRequest) request;
hRequest.setAttribute(USING_JSESSION_STRIP, true);

if (hResponse.isCommitted()) {
//log.error(response is comitted cannot forward  +
//   (check you haven't done anything to the response (ie, 
written to it) before here));
return;
}
chain.doFilter(hRequest, new StripSessionIdWrapper( hResponse) );

}

public void destroy() {
filterConfig = null;
}

/**
 * This is a wrapper that does not encode urls with jsessions
 */
public class StripSessionIdWrapper extends HttpServletResponseWrapper {
public StripSessionIdWrapper(HttpServletResponse response)
{
super(response);
}
public String encodeRedirectURL(String url) { return (url); }
public String encodeUrl(String url) { return (url); }
public String encodeURL(String url) { return (url); }

}
}


On Wednesday 06 December 2006 5:53 pm, Simon Pink wrote:
 Hi there,
 
 It is well noted by Google (and other search engines) that they do not like
 session tracking info as part of the URL. This does include JSessionId, and
 because Google visits your site as a cookieless user, every page indexed by
 them includes JSessionId, this is bad for numerous reasons - but the main
 reason is that Google may think you are cheating, as they are indexing the
 same page multiple times and it adversely effects your ranking.
 
 It is annoying as Tomcat deals with the URL according to standards, It seems
 to be everything else which doesn't. To be more precise, it is the ';' in
 the URL which servers such as Apache, and search engines and spiders like
 Google don't like much at all. By all rights Google should ignore the
 session id but it doesn't.
 
 Anyway, how do I turn this cookie-less tracking off for Tomcat? I would
 rather have better ranking (and not be banned) than have a minor percent of
 customers not being able to use my site. Or is there another solution that I
 have missed here?
 
 Kind Regards,
 Simon.
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-- 
Brian Caruso
Programmer/Analyst
Albert R. Mann Library
Cornell University 
Ithaca, NY 14853
(607)255-7705

-
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[4]: PHP on Tomcat

2006-12-20 Thread Dima Retov
You can run php daemon in FastCGI mode and setup servlet in tomcat
that would handle *.php requests

http://php-java-bridge.sourceforge.net/pjb/faq.php

R I want to use PHP for all tomcat applications. Apache and IIS are
R not available, but performance is important. How do I install it?




Wednesday, December 20, 2006, 7:31:06 PM, you wrote:

R Thanks Dima,
R I may not understand how the the php-java bridge works. It did not seem to
R allow a php application to run under Tomcat ?

R ran

R On 12/20/06, Dima Retov [EMAIL PROTECTED] wrote:

 Here is faster solution.
 http://php-java-bridge.sourceforge.net/

 It runs PHP in FastCGI mode. (much faster then CGI)




 Tuesday, December 19, 2006, 10:40:52 PM, you wrote:



 d Ran-2 wrote:
 
  Has anyone managed to get PHP4/5 to work on Tomcat ?

 d Try here ..
 d http://tools.herberlin.de/phpservlet/index.shtml phpservlet.war .. this
 d worked for me on PHP5 (note: read configuration file re: use of
 d php-cgi.exe).




 --
 Best regards,
 Dimamailto:[EMAIL PROTECTED]



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





-- 
Best regards,
 Dimamailto:[EMAIL PROTECTED]



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



RE: Several instancias of Tomcat on a same machine

2006-12-20 Thread Bachler, Elisabeth \(Elisabeth\)
Thanks!
Elisabeth
 

-Original Message-
From: Peter Crowther [mailto:[EMAIL PROTECTED] 
Sent: miércoles, 20 de diciembre de 2006 18:26
To: Tomcat Users List
Subject: RE: Several instancias of Tomcat on a same machine

 From: Peter Crowther
   - The ajp connector (in this case  8009) has to be unique ..
 == I can start with 8009 -8010  till 8013
 
 Only true if you're using AJP - i.e. front-ending with Apache.  Are 
 you?
 If so, are you using it exclusively (in which case you can knock out 
 the http connector)?

That could have been misinterpreted.  If you're not using AJP, comment the 
connector or change the ports as you suggest.

- Peter

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


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



RE: Custom JAAS LoginModule not authorizing GenericPrincipal roles

2006-12-20 Thread Workman, Joe
Thanks Charles and John, you were both a great help!!! I got it working
now. 

Cheers
Joe 

-Original Message-
From: John McPeek [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 19, 2006 6:50 PM
To: Tomcat Users List
Subject: Re: Custom JAAS LoginModule not authorizing GenericPrincipal
roles

Hi Joe,
This is my commit(). I think you are missing the User Principle. 
When you say request.getUserPrincipal(), that
token (1)  I am putting in first comes back. The Principles you add 
after that are the roles you want to test against.
This stuff drove me nuts when I was setting it up. Hope that does it for

you.

John

public boolean commit() throws LoginException {
log.debug( Commit login. );

if ( token != null ) {
if ( subject.isReadOnly() ) {
throw new LoginException( Subject is Readonly );
}

** (1) Add User Priciple first *
subject.getPrincipals().add( token );

ListPermission permissions = token.getPermissions();
SetPrincipal jaasPermissions = subject.getPrincipals();
for ( Permission permission : permissions ) {
jaasPermissions.add( permission );
}
}

token = null;
return true;
}


I'm trying to use my own LoginModule. Its is successfully
authenticating
my username but the problem is when its trying to authorize my roles. 
 
Tried:
1. Here is the code snippet from my LoginModule commit method. 
Code:
 
  List roles = new ArrayList();
  roles.add( tomcat_auth_role );
  GenericPrincipal gp = new GenericPrincipal(null, username, null,
roles);
  subject.getPrincipals().add(gp);

3. Added following to server.xml:
Code:
 
  Realm className=org.apache.catalina.realm.JAASRealm
 appName=Tomcat
 
userClassNames=org.apache.catalina.realm.GenericPrincipal
 
roleClassNames=org.apache.catalina.realm.GenericPrincipal
 useContextClassLoader=true
 debug=2/
 
3. Added following to web.xml:
Code:
 
auth-constraint
  role-nametomcat_auth_role/role-name
/auth-constraint
 
Any help would be greatly appreciated. 
 
Cheers
Joe

---
---

This email is confidential and may be legally privileged.

It is intended solely for the addressee. Access to this email by anyone
else, unless expressly approved by the sender or an authorized
addressee, is unauthorized.

If you are not the intended recipient, any disclosure, copying,
distribution or any action omitted or taken in reliance on it, is
prohibited and may be unlawful. If you believe that you have received
this email in error, please contact the sender, delete this e-mail and
destroy all copies.

===
===

  



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



--

This email is confidential and may be legally privileged.

It is intended solely for the addressee. Access to this email by anyone else, 
unless expressly approved by the sender or an authorized addressee, is 
unauthorized.

If you are not the intended recipient, any disclosure, copying, distribution or 
any action omitted or taken in reliance on it, is prohibited and may be 
unlawful. If you believe that you have received this email in error, please 
contact the sender, delete this e-mail and destroy all copies.

==


-
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: Servlet with POST Request

2006-12-20 Thread Hassan Schroeder

On 12/19/06, Scott Carr [EMAIL PROTECTED] wrote:


adduser can be an unlimited amount of times.  I want to process the
lines as they come into the Servlet, that way a seperate process could
be doing something to complete each of the tasks, while I am in the
process of working on reading the lines.


unlimited is kind of vague -- are you talking hundreds, thousands?
How time-consuming is the processing of each adduser?

I doubt you really want to start a separate thread for each one :-)

--
Hassan Schroeder  [EMAIL PROTECTED]

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



Re: Multi processor issue

2006-12-20 Thread Leon Rosenberg

BINGO :-)

Please check the servlet spec 2.5, SRV 8.2

To use a request dispatcher, a servlet calls either the include
method or forward
method of the RequestDispatcher interface. The parameters to these methods can
be either the request and response arguments that were passed in via the service
method of the javax.servlet interface, or instances of subclasses of
the request an
response wrapper classes that were introduced for version 2.3 of the
specification. In the latter case, the wrapper instances must wrap the
request or response objects that the container passed into the service
method.
The Container Provider should ensure that the dispatch of the request to a
target servlet occurs in the same thread of the same JVM as the
original request.

Please note that the last paragraph. I assume if the servlet container
works properly, your method simply can't work. Can you remove
Dispatcher caching and check whether the issue is gone?

regards
Leon


On 12/20/06, Marziou, Gael [EMAIL PROTECTED] wrote:

 By looking at the code of ApplicationDispatcher, I would tend to think
that
 the answer is no because of fields like wrapRequest and requestURI
(there
 are other fields but they are unused) however the javadoc does not
mention it.

I forgot to include the question but some of you may have guessed it ;-)
The question was: can we call forward() on same ApplicationDispatcher
object from 2 concurrent threads?

Gael




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




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



Re: JSessionId and Google

2006-12-20 Thread Brian Caruso
Also, if you have been running your site with jsessionids for awhile
then the spiders have your jsessionid urls on their link frontier.
So the spiders will continue to crawl your site for jsession funky
urls even once you've prevented your tomcat from generating
them.  Tomcat strips the jsession part of the url before you get 
to test them so this can be hassle.

Try a apache mod_rewrite rule:
  IfModule mod_rewrite.c
RewriteEngine On
RewriteRule ^(.*)jsession(.*)$  - [R=404]
   /IfModule


On Wednesday 06 December 2006 5:53 pm, Simon Pink wrote:
 Hi there,
 
 It is well noted by Google (and other search engines) that they do not like
 session tracking info as part of the URL. This does include JSessionId, and
 because Google visits your site as a cookieless user, every page indexed by
 them includes JSessionId, this is bad for numerous reasons - but the main
 reason is that Google may think you are cheating, as they are indexing the
 same page multiple times and it adversely effects your ranking.
 
 It is annoying as Tomcat deals with the URL according to standards, It seems
 to be everything else which doesn't. To be more precise, it is the ';' in
 the URL which servers such as Apache, and search engines and spiders like
 Google don't like much at all. By all rights Google should ignore the
 session id but it doesn't.
 
 Anyway, how do I turn this cookie-less tracking off for Tomcat? I would
 rather have better ranking (and not be banned) than have a minor percent of
 customers not being able to use my site. Or is there another solution that I
 have missed here?
 
 Kind Regards,
 Simon.
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-- 
Brian Caruso
Programmer/Analyst
Albert R. Mann Library
Cornell University 
Ithaca, NY 14853
(607)255-7705

-
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: Need help with JK2 connector/workers2.properties

2006-12-20 Thread Simon Renshaw
I tried to get it to work with JK1.2 but I got the same page not found error.

There was no workers.properties and uriworkermap.properties files in Tomcat 
5.5.20 so I had to make my own. This might be the problem.

I put the following in workers.preperties (from Tomcat's site):

  # Define 1 real worker using ajp13
  worker.list=worker1
  # Set properties for worker1 (ajp13)
  worker.worker1.type=ajp13
  worker.worker1.host=localhost
  worker.worker1.port=8009
  worker.worker1.lbfactor=50
  worker.worker1.cachesize=10
  worker.worker1.cache_timeout=600
  worker.worker1.socket_keepalive=1
  worker.worker1.recycle_timeout=300

And in uriworkermap.properties (from a guess):

/jsp-examples/*=worker1 

/servlets-examples/*=worker1

/luntbuild/*=worker1

Is that correct?

I created the jakarta virtual directory and added the filter to the website.

Going to http://192.168.64.20:9191/jsp-examples/ works fine but I get a 404 if 
I try to go to http://192.168.64.20/jsp-examples/.

What am I missing?

Thanks!
Simon


-Original Message-
From: Caldarale, Charles R [mailto:[EMAIL PROTECTED] 
Sent: 19 décembre, 2006 14:20
To: Tomcat Users List
Subject: RE: Need help with JK2 connector/workers2.properties

 From: Simon Renshaw [mailto:[EMAIL PROTECTED] 
 Subject: Need help with JK2 connector/workers2.properties
 
 I followed the instructions found at
 http://tjworld.net/help/kb/0001_iis6-Tomcat5-JK2.html to install the
 connector.

The mod_jk2 package has been deprecated for well over a year - no
development, no support.  Suggest reading the real Tomcat documentation:
http://tomcat.apache.org/connectors-doc/

 - 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]


-
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: Multi processor issue

2006-12-20 Thread Caldarale, Charles R
 From: Leon Rosenberg [mailto:[EMAIL PROTECTED] 
 Subject: Re: Multi processor issue
 
 The Container Provider should ensure that the dispatch of the 
 request to a target servlet occurs in the same thread of the 
 same JVM as the original request.

I'm not sure the above is really pertinent to the issue, which I think
can be boiled down to this:

Should a RequestDispatcher object be treated as if it were in the scope
of a Request or instead in the scope of a Servlet?  The spec provides no
definitive statement that I can find, but there are a couple of hints
that a RequestDispatcher should be considered unique to each request.
In particular:

SRV.8.1.1 Query Strings in Request Dispatcher Paths:
The ServletContext and ServletRequest methods that create
RequestDispatcher objects using path information allow the optional
attachment of query string information to the path.

Parameters specified in the query string used to create the
RequestDispatcher take precedence over other parameters of the same name
passed to the included servlet. The parameters associated with a
RequestDispatcher are scoped to apply only for the duration of the
include or forward call.

SRV.8.4.1 Query String:
The request dispatching mechanism is responsible for aggregating query
string parameters when forwarding or including requests.

SRV.15.2.8 ServletContext, getRequestDispatcher(String):
The resource can be dynamic or static.

Based on the above, I think the app's reuse of RequestDispatcher objects
is indeed erroneous.

 - 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: Setting session variables

2006-12-20 Thread Andres Cubides P.


Cristopher:

Thanks for the Firefox/cookies hint, it was very helpful to figure out the 
problem. It was related with Internet Explorer. I was using IE, so I decided 
to try Firefox to test the cookies configuration. In Firefox the app worked 
perfectly. Searching again in the tomcat list archives I found that a 
patch provided by Microsoft for IE 5.5 and 6.0 causes cookies to be 
rejected from servers with non-alphanumeric characters, such as _. The 
server name with the problem has an _, when I used the IP instead of the 
name the session problems were resolved.


thanks,



From: Christopher Schultz [EMAIL PROTECTED]
Reply-To: Tomcat Users List users@tomcat.apache.org
To: Tomcat Users List users@tomcat.apache.org
Subject: Re: Setting session variables
Date: Wed, 20 Dec 2006 12:31:37 -0500

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andres,

Andres Cubides P. wrote:
 No errors appear in tomcat/stderr logs. I have a simple test servlet to
 show session id/variables, each time I call the servlet in the same
 browser session a different ID is returned:

 ID 9180ECEA4F3CBBECC2FA86EA592D2C4E Created: Wed Dec 20 12:13:46 COT
 2006 Last Accessed: Wed Dec 20 12:13:46 COT 2006

 ID 346AEE8B40C7DB83B330ED1DFC08928B Created: Wed Dec 20 12:13:59 COT
 2006 Last Accessed: Wed Dec 20 12:13:59 COT 2006

Ar you using the same browser to connect to both of your apps (the
working one, and the non-working one)?

If you are using Mozilla Firefox, is it possible that you have banned
one of the servers from setting cookies? I just had that problem this
morning on one of my test servers, actually. I nearly lost my mind
trying to figure out what was going on.

Also, if you are using ff, try the LiveHttpHeaders extension so you can
watch the HTTP headers going between the server and the browser. You
might be able to see if your browser is either ignoring the cookie or
(for some bizarre reason), sending the wrong one.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFiXN59CaO5/Lv0PARApp6AKC2B4BGE6mN+GNRCSzu59uiI/hNMQCgjKRq
I1rdqFIyOvBPadNhkSgzM5s=
=hi7w
-END PGP SIGNATURE-

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



_
Moda para esta temporada. Ponte al día de todas las tendencias. 
http://www.msn.es/Mujer/moda/default.asp



-
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: Test JSP Page

2006-12-20 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Grok,

Grok Mogger wrote:
 I'm setting up Tomcat for the first time.  I'm trying to use a simple
 test just to verify that I have everything set up properly, and I was
 hoping someone could confirm for me that I understand what I'm doing.
 
 I'm setting up Apache, mod_jk, and Tomcat on a (Debian) Linux server.

I would eliminate Apache and mod_jk from the equation for the time
being. Once you have everything working with (just) Tomcat, you can
evaluate whether or not to add Apache out front.

 HTML
 BODY
 pHello World!/p
 pThe time is now %= new java.util.Date() %/p
 /BODY
 /HTML

The page itself looks fine.

 I have a test page (test.jsp) in my Apache www directory.

You probably have the JSP file in the wrong place. You need to put your
JSP files wherever Tomcat expects them to be. When you use Apache httpd
out in front of Tomcat, it merely delegates the request to Tomcat, so
Apache is not really involved in the process of actually running the
JSP, etc.

 I'm coming from a PHP background and might be confused.

Coming from a PHP background, I can certainly understand why you did
what you did. PHP typically runs as a webserver plug-in (mod_php in this
case) and so Apache httpd sort-of manages the invocation of the PHP
processor. Tomcat interacts differently with the web server, which is
why I suggested that you drop that from your setup while you get started.

Exactly what is necessary depends on your version of Tomcat (4.x, 5.0.x,
or 5.5.x), but you might be able to get away with dropping your JSP file
into the webapps directory in your Tomcat directory.

Strictly speaking, you should probably create a formal webapp by
creating a subdirectory underneath webapps and including a context.xml
file in a WEB-INF subdirectory underneath that. But, just to get going
and convince yourself that new java.lang.Date() does, in fact, give
you the current date, you can probably just move your JSP file into the
webapps directory and try again.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFiaHn9CaO5/Lv0PARAn4NAKC+IrQUETJF/czavm7tUrdTmIZiHACePan0
YKnOocnYgh/B3YPoCYm8lsY=
=ajrQ
-END PGP SIGNATURE-

-
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: Multi processor issue

2006-12-20 Thread Mark Thomas
Caldarale, Charles R wrote:
 From: Leon Rosenberg [mailto:[EMAIL PROTECTED] 
 Subject: Re: Multi processor issue

 The Container Provider should ensure that the dispatch of the 
 request to a target servlet occurs in the same thread of the 
 same JVM as the original request.
 
 I'm not sure the above is really pertinent to the issue, which I think
 can be boiled down to this:
 
 Should a RequestDispatcher object be treated as if it were in the scope
 of a Request or instead in the scope of a Servlet?  The spec provides no
 definitive statement that I can find, but there are a couple of hints
 that a RequestDispatcher should be considered unique to each request.
 In particular:

What about RequestDispatcher ServletContext.getNamedDispatcher(String)

Since this method is at the Context level, any RequestDispatcher
obtained effectively has context wide scope. It is this method that
the OP is using and, given the non-threadsafe nature of
o.a.c.core.ApplicationDispatcher, this looks like a Tomcat bug to me.
I haven't had a chance to see how hard it might be to fix yet.

Mark

-
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: Test JSP Page

2006-12-20 Thread Grok Mogger

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Grok,

Grok Mogger wrote:

I'm setting up Tomcat for the first time.  I'm trying to use a simple
test just to verify that I have everything set up properly, and I was
hoping someone could confirm for me that I understand what I'm doing.

I'm setting up Apache, mod_jk, and Tomcat on a (Debian) Linux server.


I would eliminate Apache and mod_jk from the equation for the time
being. Once you have everything working with (just) Tomcat, you can
evaluate whether or not to add Apache out front.


HTML
BODY
pHello World!/p
pThe time is now %= new java.util.Date() %/p
/BODY
/HTML


The page itself looks fine.


I have a test page (test.jsp) in my Apache www directory.


You probably have the JSP file in the wrong place. You need to put your
JSP files wherever Tomcat expects them to be. When you use Apache httpd
out in front of Tomcat, it merely delegates the request to Tomcat, so
Apache is not really involved in the process of actually running the
JSP, etc.


I'm coming from a PHP background and might be confused.


Coming from a PHP background, I can certainly understand why you did
what you did. PHP typically runs as a webserver plug-in (mod_php in this
case) and so Apache httpd sort-of manages the invocation of the PHP
processor. Tomcat interacts differently with the web server, which is
why I suggested that you drop that from your setup while you get started.

Exactly what is necessary depends on your version of Tomcat (4.x, 5.0.x,
or 5.5.x), but you might be able to get away with dropping your JSP file
into the webapps directory in your Tomcat directory.

Strictly speaking, you should probably create a formal webapp by
creating a subdirectory underneath webapps and including a context.xml
file in a WEB-INF subdirectory underneath that. But, just to get going
and convince yourself that new java.lang.Date() does, in fact, give
you the current date, you can probably just move your JSP file into the
webapps directory and try again.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFiaHn9CaO5/Lv0PARAn4NAKC+IrQUETJF/czavm7tUrdTmIZiHACePan0
YKnOocnYgh/B3YPoCYm8lsY=
=ajrQ
-END PGP SIGNATURE-

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





Thank you very much for taking the time to type all that, it 
certainly helped clear up a few things.  I haven't actually 
gotten to try any of it yet, but that does make a lot of sense. 
 I'm sure I can get it working now.  Thanks again!


- GM


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.25/593 - Release Date: 12/19/2006 
1:17 PM


-
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: Multi processor issue

2006-12-20 Thread Caldarale, Charles R
 From: Mark Thomas [mailto:[EMAIL PROTECTED] 
 Subject: Re: Multi processor issue
 
 What about RequestDispatcher ServletContext.getNamedDispatcher(String)
 
 Since this method is at the Context level, any RequestDispatcher
 obtained effectively has context wide scope. It is this method that
 the OP is using and, given the non-threadsafe nature of
 o.a.c.core.ApplicationDispatcher, this looks like a Tomcat bug to me.
 I haven't had a chance to see how hard it might be to fix yet.

I think some Servlet spec clarification would be really helpful here.
Unless the spec intends for there to be different flavors of
RequestDispatcher, the apparent context-level scope seems to conflict
with the request-specific comments I noted earlier.

 - 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]



Multiple Host designing.

2006-12-20 Thread Wang Penghui
Hello,

We are starting to design a ISP level JSP virutal hosting system which
could serve JSP and Servlets.

Here are some thing i decide to to:

Apache 2.0.52(RHEL 4 default installation)
Tomcat 5.5.20 (http://tomcat.apache.org)
Tomcat connector 1.2.18(http://tomcat.apache.org)

Add the follow lines in httpd.conf

JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties
JkLogFile /etc/httpd/logs/mod_jk.log
JkLogLevelinfo
JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
Location /WEB-INF/
AllowOverride None
deny from all
/Location
Location /META-INF/
AllowOverride None
deny from all
/Location

Then here is a example VirtualHost in httpd.conf

VirtualHost 1.2.3.4
SuexecUserGroup wangph clients
ServerAdmin [EMAIL PROTECTED]
ServerName wangph.example.com
DocumentRoot /home/wangph/wwwroot
ScriptAlias /cgi-bin/ /home/wangph/wwwroot/cgi-bin/
ScriptAlias /perl/ /home/wangph/wwwroot/cgi-bin/
ErrorLog logs/error_log
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
/VirtualHost

And here is a example Host in server.xml

Host className=org.apache.catalina.core.StandardHost appBase=
autoDeploy=true
configClass=org.apache.catalina.startup.ContextConfig
contextClass=org.apache.catalina.core.StandardContext debug=0
deployXML=true
errorReportValveClass=org.apache.catalina.valves.ErrorReportValve
liveDeploy=true
mapperClass=org.apache.catalina.core.StandardHostMapper
name=wangph.example.com unpackWARs=true
Context path= docBase=/home/wangph/wwwroot reloadable=true
debug=0/
/Host

I leave appBase blank. And point the docBase to the apache virtual
documentroot.


If i add a new virtual host, simply add one VirutalHost in httpd.conf
and one Host in server.xml.

Is there any problem?

Thanks very much

Wang Penghui


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



How can I display servlet in browser.....

2006-12-20 Thread athula bogoda
can any one tell me how should I display servlet
file(HelloWorld.java) in IE browser.

I already compile the file and put both .java and
.class file it to the 
C:\Program Files\Apache Software Foundation\Tomcat
5.0\webapps\ROOT\bo
(bo is the file I put my develped files)

after I browse the file using
http://localhost:8080/bo/

It show all files in it.

But when i click on the HelloWorld.class file it
disply as a pop up dialog box to Open.

How can I dispaly this servlet in the browser.

Thanks.
Athula

Send instant messages to your online friends http://uk.messenger.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: How can I display servlet in browser.....

2006-12-20 Thread Caldarale, Charles R
 From: athula bogoda [mailto:[EMAIL PROTECTED] 
 Subject: How can I display servlet in browser.
 
 I already compile the file and put both .java and
 .class file it to the 
 C:\Program Files\Apache Software Foundation\Tomcat
 5.0\webapps\ROOT\bo
 (bo is the file I put my develped files)

You need to read the Servlet spec and become familiar with the proper
structure of a webapp.  In particular, your bo webapp should not go
under webapps/ROOT, it should be in webapps/bo.  Under the webapps/bo
directory, you need a WEB-INF/web.xml, where you will specify your URI
path to servlet class mappings.  Take a look at the sample applications
that come with Tomcat for examples, and get the Servlet spec from here:
http://jcp.org/aboutJava/communityprocess/first/jsr053/index.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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Servlet with POST Request

2006-12-20 Thread Andre Prasetya

I see, you're thinking in Sockets

Sockets are usually :
1. open connection
2. give start byte
3. keep streaming the job byte
4. give the stop byte

The question is. How long is the number 3 ? how long between the 1st adduser
and the 2nd adduser ? if its very short then you can use put, if not... you
can consider writing a socket server or creating an async servlet, the logic
is
1. Hit the startjob servlet and get a trxid
2. Hit the job servlet with trxid and jobdescription as its parameter, this
servlet will write the jobs and its sequence to database
3. Hit the endjob servlet with trxid as its parameter, this servlet will
commit the whole process.

Make sense ?

On 12/20/06, Scott Carr [EMAIL PROTECTED] wrote:


I am creating a client - server application that will process lines like:

startjob
adduser
adduser
adduser
adduser
endjob

adduser can be an unlimited amount of times.  I want to process the
lines as they come into the Servlet, that way a seperate process could
be doing something to complete each of the tasks, while I am in the
process of working on reading the lines.

I have written a Socket server of my own to do this before, I am now
trying to use Tomcat Servlet to do the same thing, because Tomcat
already some behind the scenes stuff already setup.

Does this make sense?  Am I totally off my rocker?  (My wife would
definately agree with that last bit.)

Andre Prasetya wrote:
 Why do you want to read POST by using reader ? I only use the stream
from
 request on a PUT request.


 On 12/16/06, Scott Carr [EMAIL PROTECTED] wrote:

 Hassan Schroeder wrote:
  On 12/15/06, Scott Carr [EMAIL PROTECTED] wrote:
  Does a servlet require the use of a Content-Length for the Reader
 to be
  populated?
 
  A pretty cursory test seems to indicate not, but I could just be
lucky
  :-)
 
  ...and I want to read each line as they come in, and handle the
  request on
  a line by line basis.
 
  Have you tried this yet? request.getReader() would seem to cover
  your situation, assuming this isn't binary data.
 
 Hm, the reason I asked, is because of a test I ran.  strLine is always
 null.

 Using the following code for processRequest:

 response.setContentType(text/plain);

 m_out = response.getWriter();
 m_bufRead = request.getReader();

 while (true) {
 strLine = m_bufRead.readLine();

 if (strLine != null) {
 if (strLine.startsWith(login)) {
 ProcessLogin();
 } else if (strLine.startsWith(exit)) {
 break;
 }
 } else {
 try {
 Thread.sleep(1000);
 } catch (InterruptedException ex) {
 ex.printStackTrace();
 }
 }
 }

 m_bufRead = null;
 m_out.close();

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





--
Scott Carr
OpenOffice.org
Documentation Co-Lead
http://documentation.openoffice.org


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





--
-Andre-

People see things the way they are and say why ? I see things that never
were and say Why not ?