Re: servlets and cookies

2003-10-14 Thread Robert Weeks
Hello -

Hello
i assume this is more of a servlet programming problem that tomcat, but
i hope someone has some insight?
Please tell me i can do this:
1)i go to a jsp page and if it does not find the exist of a cookie it
forwards to a login screen
2) the login screen submits to a servlet, and then set some cookies and
then forwards to the original JSP
3) the orig jsp sees those cookies and life is fine.

well i can not make the servlet set the cookies so that the forwarding
jsp sees those cookies.


When it comes to doing things like this - I generally use session or 
request variables to do so (not direct cookie access) - is there a 
reason you wouldn't want to do this instead of the session? I think 
most of the time tomcat will be using cookies for all of this (unless 
explicitly told to use URL rewriting).

For example - maybe do something like this (using struts):

(numbers correspond to above):

1)
%@ taglib uri=/tags/struts-bean prefix=bean %
%@ taglib uri=/tags/struts-html prefix=html %
%@ taglib uri=/tags/struts-logic prefix=logic %
html
head
  titleAdmin Tool/title
  html:base/
/head
body
html:errors/
logic:notPresent scope=session name=isLoggedIn
  logic:redirect forward=adminLogin/
/logic:notPresent
logic:present scope=session name=isLoggedIn
  logic:redirect forward=adminHome/
/logic:present
...
Where 'adminLogin' is mapped:

forward name=adminLogin path=/adminLogin.do/

which is an action that forwards to a file called login.jsp

action path=/adminLogin
  type=org.apache.struts.actions.ForwardAction
  parameter=/admin/login.jsp/
2  3) login.jsp (above) then uses a servlet to gather the information 
if successful then:

...
session.setAttribute(IConstants.IS_LOGGED_IN, true);
where ' IConstants.IS_LOGGED_IN' = isLoggedIn

and then forwards back to the home page (after setting other vars in 
the session/request as well).

Also this way - if the session has expired, then the test at the 
beginning would forward back to the login if needed as well.

I could be doing this wrong as well - but seems to work OK.

Hope this is what you were asking about (if not - sorry for the wasted 
space!)

=)

--
Robert B. Weeks
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Tomcat/Struts app hanging (Waiting for xx instance(s) to be deallocated)

2003-10-07 Thread Robert Weeks
Hello -

I am seeing a perplexing problem with an app I am using with Tomcat 
(4.1.24), struts (1.1) and MySql (4.0.12) running on RH.

It seems that after a certain amount of time, the whole app freezes and 
tomcat has to be restarted, and the top of the daily log that is 
created/appended says:

2003-10-07 11:37:45 StandardWrapper[:action]: Waiting for 38 
instance(s) to be deallocated
2003-10-07 11:37:55 WebappLoader[]: Deploying class repositories to 
work directory /usr/local/jakarta-tomcat-4.1.24/work/Standalone/xxx...

The number of instances is variable.

I have seen a number of queries on the 'Waiting for xx instance(s)...' 
around - but I cannot seem to find an answer to this problem.

Is anyone else seeing this?

I am using org.apache.commons.dbcp.BasicDataSource for the datasource:

data-sources
   data-source type=org.apache.commons.dbcp.BasicDataSource
 set-property
property=autoCommit
value=false/
 set-property
property=driverClassName
value=com.mysql.jdbc.Driver/
 set-property
property=maxActive
value=30/
 set-property
property=url
value=jdbc:mysql://localhost//
 set-property
property=username
value=/
 set-property
property=password
value=/
 set-property
property=validationQuery
value=SELECT COUNT(*) FROM Users /
   /data-source
 /data-sources


Thanks for any help.

--
Robert B. Weeks
[EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat/Struts app hanging (Waiting for xx instance(s) to be deallocated)

2003-10-07 Thread Robert Weeks
Hello -


I am seeing a perplexing problem with an app I am using with Tomcat
(4.1.24), struts (1.1) and MySql (4.0.12) running on RH.
What version of RedHat and what JDK?
Red Hat Linux release 6.1 (Cartman)
Kernel 2.2.12-20 on an i686
(Yes I know, old, but I am not in control of that one  ;)  )

[EMAIL PROTECTED] java -fullversion
java full version 1.4.1_03-b02


It seems that after a certain amount of time, the whole app freezes 
and
tomcat has to be restarted, and the top of the daily log that is
created/appended says:

2003-10-07 11:37:45 StandardWrapper[:action]: Waiting for 38
instance(s) to be deallocated
2003-10-07 11:37:55 WebappLoader[]: Deploying class repositories to
work directory /usr/local/jakarta-tomcat-4.1.24/work/Standalone/xxx...
The number of instances is variable.

I have seen a number of queries on the 'Waiting for xx instance(s)...'
around - but I cannot seem to find an answer to this problem.
Can you collect the output from sending Tomcat the -QUIT signal when 
this
happens?
I am not sure I understand this one.

I am kinda restricted on the deployment machine (the linux machine 
mentioned above) - it was developed on a Solaris 9 machine and moved 
over - everything works pretty normal 'cept this freezing problem. Same 
versions of all software on both machines tho 
(java,mysql,tomcat,struts).

I can ask the admin to give me the output of it the next time it 
freezes (we are periodically restarting it right now via cron just to 
make sure there is as little downtime as possible).

Thanks again.

--
Robert
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]