RE: Restart Session Persistence

2002-05-14 Thread Bill Boland

Thanks, August. I agree with that and I think that this should be in a
FAQ somewhere on session persistence if it isn't already.

But there are situations where you are using other libraries where you
are not in control of all the transient attributes of the beans. You can
do a lot to prevent the serialization via refactoring, wrapping, etc. It
would be nice just to avoid it all together in some situations. If push
comes to shove, I'll just create my own Manager and be done with it but
it seemed that the StandardManager should/could do this. :)

bill



-Original Message-
From: August Detlefsen [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 14, 2002 8:19 PM
To: Tomcat Users List
Subject: Re: Restart Session Persistence

If you want certain session data to not be serialized, just make those
variables transient in whatever bean classes you are using in session.
This will prevent just those variables from being saved.

public class UserBean implements Serializable {

  private String username; 
  private transient String password;  //password won't serialize

//getters and setters, other methods, etc.

}

-August



--- Bill Boland <[EMAIL PROTECTED]> wrote:
> 
> Hello all. I've been having a bit of a problem with the restart
> session
> persistence in Tomcat 4.0.3.
> I've been examining the documentation on the Manager
> (http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/manager.html)
> and I saw a few others who were having some problems with it (mainly
> with static attributes or JNDI). Even if I wasn't having a problem
> with
> it I may not want session data serialized on the web tier in some
> applications (example: for security reasons) while in other it may be
> a
> good thing. Until I figure out why I'm getting some
> ClassNotFoundExceptions when the web application is starting up, I
> thought I'd throw out this sample snippet from my server.xml that
> turns
> this off for a single web application. It beats deleting the
> SESSIONS.ser each time.
> 
> docBase="C:\webapps\test"
>  debug="0" >
>className="org.apache.catalina.session.StandardManager" pathname=""
> />
>   
> 
> The source code states that if the pathname is null, it will not use
> persistence. Not knowing how to set it to null from server.xml, I
> tried
> setting the pathname to an empty value (vs. the default SESSIONS.ser)
> and that seems to have disabled it. It didn't really disable it, but
> it
> couldn't create the relative file in the web application's work
> directory since it existed as the directory itself. I see exceptions
> in
> my log file...but at least my sessions are no longer persistent for
> this
> one application. You could probably put a bad file name with
> characters
> that are invalid for files of your O/S and get the same results.
> 
> Now for the question and answer portion of the show...
> 
> Is there a better way to do this? I guess I could create my own
> custom
> Manager class but it seems that 99.9% of this is already there...I
> just
> can't set pathname to null from server.xml (or can I?). If not, do
> you
> think setting pathname to the empty string is a reasonable
> enhancement
> that could be added (possibly to StandardManager.setPathname()) so
> that
> it be turned off (without generating exceptions).
> 
> Also, again for security reasons, shouldn't the persistent sessions
> (SESSIONS.ser) be deleted once loaded?
> 
> Thanks for any thoughts. 
> 
> bill
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Restart Session Persistence

2002-05-14 Thread Bill Boland


Hello all. I've been having a bit of a problem with the restart session
persistence in Tomcat 4.0.3.
I've been examining the documentation on the Manager
(http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/manager.html)
and I saw a few others who were having some problems with it (mainly
with static attributes or JNDI). Even if I wasn't having a problem with
it I may not want session data serialized on the web tier in some
applications (example: for security reasons) while in other it may be a
good thing. Until I figure out why I'm getting some
ClassNotFoundExceptions when the web application is starting up, I
thought I'd throw out this sample snippet from my server.xml that turns
this off for a single web application. It beats deleting the
SESSIONS.ser each time.


  


The source code states that if the pathname is null, it will not use
persistence. Not knowing how to set it to null from server.xml, I tried
setting the pathname to an empty value (vs. the default SESSIONS.ser)
and that seems to have disabled it. It didn't really disable it, but it
couldn't create the relative file in the web application's work
directory since it existed as the directory itself. I see exceptions in
my log file...but at least my sessions are no longer persistent for this
one application. You could probably put a bad file name with characters
that are invalid for files of your O/S and get the same results.

Now for the question and answer portion of the show...

Is there a better way to do this? I guess I could create my own custom
Manager class but it seems that 99.9% of this is already there...I just
can't set pathname to null from server.xml (or can I?). If not, do you
think setting pathname to the empty string is a reasonable enhancement
that could be added (possibly to StandardManager.setPathname()) so that
it be turned off (without generating exceptions).

Also, again for security reasons, shouldn't the persistent sessions
(SESSIONS.ser) be deleted once loaded?

Thanks for any thoughts. 

bill



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: TC4 and cgi

2002-02-23 Thread Bill Boland

Jared,

Ironically, I also was trying to get the CGIServlet to work on Friday
with great difficulty. I believe I got it to work (although I am not a
Perl person). I am using tomcat on Windows 2000 and I just wanted to
invoke an test executable batch file (test.bat) just to see if I could
get the ting to work. I assume you can replace what I did with your perl
scripts and be on your way.

One flaw I noticed in the documentation for the CGIServlet is that the
example does not work in TC 4.0.2 unless you specify a cgiPathPrefix of
"WEB-INF/cgi". The default is actually a null value and so no path is
added to the base of the web application. For example, if the web
application is at path "/foo" and you do not specify a cgiPathPrefix,
then when you enter http://localhost/foo/cgi-bin/test.bat it looks at
the "/foo" directory. At least the source code and testing proved
otherwise. I hope some contributor will read this and verify and correct
this. I'm new to this list so I don't know the ropes too well.

I am using TC as a web server and have not attempted to integrate it
with Apache HTTP Server. Of course, the Apache Server can handle the CGI
requests for you too.

Anyway, here's some snippets from the web.xml file for a web application
in TC 4.0.2. My web application has a path of "/foo" for the web.xml
file is at "/foo/WEB-INF/web.xml" and I create the directory named "cgi"
in the "/foo/WEB-INF" directory. I renamed just the
servlets-cgi.renametojar since I only needed the CGI capability. Now I
just need to hook into the CGI I want to use (Crystal Reports CGI
interface).


  
cgi
 
org.apache.catalina.servlets.CGIServlet

  cgiPathPrefix
  WEB-INF/cgi


  debug
  99

  

  
cgi
/cgi-bin/*
  


Hope this helps,

bill


-Original Message-
From: Jared Nedzel [mailto:[EMAIL PROTECTED]] 
Sent: Friday, February 22, 2002 12:17 PM
To: Tomcat Users List
Subject: Re: TC4 and cgi

Paul:

That doesn't appear to me to be the case, given that TC 4
has a bunch of stuff in web.xml concerning CGIs.  For example
there are entries in web.xml like: