RE: Help/Examples setting up security settings1

2005-06-15 Thread fzlists
Although I don't think this is the source of your problem, it strikes me
as odd to be protecting the root of your webapp when this is where the
unprotected page are as well (i.e., login.jsp, login_error.html)  I
would suggest leaving those two in the root of the webapp, and move
environment.jsp and error.jsp to a subdirectory, maybe /Simple_JSP/content
or something, then of course update the security constraint to constrain
that new directory.

Actually, one other thing... the references to the login form and the
login error page in the login-config element I believe are relative to
the webapp root, so drop the Simple_JSP from the beginning of them so they
are /login.jsp and /login_error.jsp respectively.  Again, not sure this is
the problem, but it could be.

Some other things, and this is where hopefully some Tomcat folks more
knowledgable than me can help... There seems to be a realm-name element
for login-config as well, but I have never used it... does it apply
here?  I think it may be for basic auth, but I am unsure.

Also, there are perhaps some other things you need to do to tell Tomcat to
use security... anyone else, does Joseph need to do anything to set up the
UserDatabase resource, or is that set up by default?  Also, does he need
to create a context for his app and perhaps set something to tell Tomcat
to use security?  This is stuff I am not familiar with, so hopefully
someone else reading this can help.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, June 15, 2005 9:31 am, Gagnon, Joseph M  \(US SSA\) said:
 Ah-ha! Everything I had read so far led me to think I needed to put
 everything under ROOT. I'm glad you guys pointed that out. It makes
 sense.

 In the meantime, to make things simpler, I set up another webapp
 without any of the SPID stuff I was talking about before. It's very
 simple and contains nothing more than a login page (login.jsp) and login
 error page (login_error.html), the environment page (environment.jsp)
 I mentioned before and an error page (error.jsp), specified in the
 errorPage attribute of the page directive of the JSP files.

 The new app. sits in [tomcat]\webapps\Simple_JSP (not under ROOT any
 more) and the web.xml file in the WEB-INF subdirectory has been set up
 to use the correct path. I also included the security-role element Frank
 mentioned below.

 The web-app portion of web.xml looks like this:

 web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

 display-nameSimple JSP/display-name
 descriptionSimple JSP Test/description

 login-config
 auth-methodFORM/auth-method
 form-login-config

 form-login-page/Simple_JSP/login.jsp/form-login-page

 form-error-page/Simple_JSP/login_error.html/form-error-page
 /form-login-config
 /login-config

 security-role
 descriptionSecurity Role/description
 role-namesimple_jsp/role-name
 /security-role

 security-constraint
 web-resource-collection
 web-resource-nameSimple JSP
 Test/web-resource-name
 url-pattern/Simple_JSP/*/url-pattern
 http-methodGET/http-method
 http-methodPOST/http-method
 /web-resource-collection
 auth-constraint
 role-namesimple_jsp/role-name
 /auth-constraint
 /security-constraint

 /web-app

 Of course, I set up the simple_jsp role in the tomcat-users.xml file and
 added that role to my user entry.

 Now that this is all said and done, I'm still getting behavior that I'm
 not expecting. If I load my environment file into the browser
 (http://localhost/Simple_JSP/environment.jsp), it comes up as though
 there were no security/authentication mechanism to put up a roadblock.
 The login page is never presented.

 I was expecting that if I were to request any page from the Simple_JSP
 area, that before anything is displayed, I would be prompted to provide
 and user name and password. Isn't that what's supposed to happen?

 Thanks,
 Joe



 -Original Message-
 From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 14, 2005 6:37 PM
 To: Tomcat Users List
 Subject: Re: Help/Examples setting up security settings

 As Mark indicated in another post, the first problem you need to resolve

 is how you have installed your webapp.  ROOT is itself a webapp, and
 although it might seem right that you want to put your webapp under it,
 that isn't the case.  Move SPID_JSP to /webapps and you should be all
 set.

 One other thing I see is you are missing security role definitions in
 your web.xml.  You'll want to add something like this:


Re: Connection reset by peer: socket write error

2005-01-25 Thread fzlists
I get those frequently as well, but only in one or two specific places.  I've 
actually factored them out of my code (i.e., if they are thrown, I ignore them 
instead of allowing them to be logged).  As you said, not disruptive, just 
clogging up the logs.

As near as I've been able to figure out, they occur when a user clicks stop, or 
the browser times out, usually it only seems to occur when your streaming 
something to the response object, like a PDF for instance.  I too would like to 
know for sure what causes them, but this is what seems to be the cause.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, January 25, 2005 2:16 pm, Dola Woolfe said:
 Hi,
 
 I get these all the time. They don't seem to be
 disruptive so I don't worry about them too much. But
 the do obscure the valuable output so I would like to
 eliminate them if psiible.
 
 
 Dola
 
 ClientAbortException:  java.net.SocketException:
 Connection reset by peer: socket write error
 at
 org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:365)
 at
 org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
 at
 org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:313)
 at
 org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:292)
 at
 org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:85)
 at
 universe.Chartable$PertracStylePerformance.pOutputChart(Chartable.java:226)
 at
 servlets.ChartGenerator.doGet(ChartGenerator.java:25)
 at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
 at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
 at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
 at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
 at
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
 at
 org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
 at
 org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
 at
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
 at java.lang.Thread.run(Thread.java:534)
 
 
 
 
 __
 Do you Yahoo!?
 Yahoo! Mail - 250MB free storage. Do more. Manage less.
 http://info.mail.yahoo.com/mail_250
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

Re: dynamically compile JSPs

2004-12-22 Thread fzlists
If they are uploaded via a web interface, I assume it's your own interface... 
If so, why not just make part of the upload process a compilation?  You can 
compile it and overwrite the working copy in Tomcat, changes should be there 
instantly.  A bigger plus too is that you can catch any compile-time errors at 
that point and report back to the user with the trace, so you would never have 
any bad JSP's in production.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, December 22, 2004 12:11 pm, Matt Bathje said:
 Well they are being precompiled at first. The problem is that some of
 the pages are being uploaded/overwritten through a web interface, and
 the changes aren't immediately visible to users. (They have to wait for
 the scheduled recompile to happen to see the changes they made.)
 
 
 Matt
 
 Dale, Matt wrote:
 This might be a long way round but you could call a system ant job to
 compile them. Or if it is appropriate in your environment you should
 just precompile them anyway, this way there will be no performance hit
 at all on your production server when a new deployment is made.

 Ta
 Matt

 -Original Message-
 From: Matt Bathje [mailto:[EMAIL PROTECTED]
 Sent: 22 December 2004 17:01
 To: Tomcat Users List
 Subject: Re: dynamically compile JSPs


 I can't seem to find any solid documentation on this (I downloaded the
 JSP 2.0 spec and don't see it mentioned, even though based on a google
 search it seems like it is is a JSP thing and not a tomcat thing)

 But anyways - it doesn't seem to work for me, and I think the reason is
 that the jsp I want to compile dynamically is a struts/tiles layout
 page. There is no way to access the file directly through the browser.

 I may be able to get away with putting jsp_compile=true in the tile
 definition path, but I'd like to avoid that because (if my understanding
 of this parameter is true) the page will get recompiled on every page
 load, which is really not what I want, and would probably hurt
 performance a lot.

 Any other ideas for dynamic JSP compilation? Calling the compiler from
 inside the code (a struts action) if possible is not out of the question
 as long as there is no serious downside.


 Thanks,
 Matt




 Tim Funk wrote:

I would think that making the query string be jsp_compile=true would do
 it.
For example:  mypage.jsp?jsp_compile=true

[I never tried it]

-Tim

Matt Bathje wrote:


Hi all -

If you have your tomcat servers setup with development=false
(compiling every 5 minutes) - is there a way to dynamically compile
certain JSP pages from inside your servlet code? (Or at least to
trigger a compile to happen off of the schedule?)

If so - are there any side effects of doing this?





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



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



 

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

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

Re: dynamically compile JSPs

2004-12-22 Thread fzlists
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper/docs/api/index.html

Usage of the JspC class.  This should be what you want.

I work in Windows 95% of the time, and I'm a simplicity freak, so I tend do do 
things, most of the time, with batch files called from UltraEdit.  Anyway, this 
is relevant because one of the steps in my typical build process is a 
compilation of all JSP's.  I use this class to do that.  I can give you the two 
lines from my batch file that does this if it would be helpful, but I tend to 
think the javadocs will get you where you want to go.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, December 22, 2004 12:32 pm, Matt Bathje said:
 [EMAIL PROTECTED] wrote:
 If they are uploaded via a web interface, I assume it's your own
 interface... If so, why not just make part of the upload process a
 compilation?  You can compile it and overwrite the working copy in
 Tomcat, changes should be there instantly.  A bigger plus too is that
 you can catch any compile-time errors at that point and report back to
 the user with the trace, so you would never have any bad JSP's in
 production.



 
 Well...that is my question...I can't figure out how to do that
 compilation :)
 
 
 Matt
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

Re: Tomcat lost request parameters

2004-12-22 Thread fzlists
I don't think your going crazy, I have been seeing the same thing too... I have 
an app that has been in production for about a year.  Yes, there have been 
changes along the way, but it's been more or less rock-solid stable... except 
that the past few months I've seen occassional NPE's caused by incoming request 
parameters being null.

I have never been able to replicate this in test or development.  It's not 
frequent, maybe 5-10 times per 50,000 requests, which is 5-10 times too many, 
but not too bad (I haven't been yelled at, let's put it that way :) ).  But, 
it's been bugging me.  

I see it in similar places as you... Doing a database query, where the SQL is 
constructed based on incoming parameters, and they wind up being null, causing 
SQL exceptions.  Because of the way the front-end works, it should be entirely 
impossible for a user to ever not submit these requests (you'll have to trust 
me on this... if it's not impossible, they'd have to go out of their way and 
try to do this).

So, yes, I'm seeing the same thing.  Also, it's been a number of Tomcat 
versions now, all in the 5.0.x branch.  We're at 5.0.29 now.

I've also seen some bizarre exceptions caused by session problems... Trying to 
set an attribute and it's telling me the session is invalid 
(IllegalStateException), except that the line of code DIRECTLY BEFORE THAT ONE 
verified that the session is valid!

We are moving to WebSphere in the next few weeks, so I'll know pretty quickly 
if this is a Tomcat issue or not, but I strongly suspect it is (not meant as a 
knock, I absolutely adore Tomcat).

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Wed, December 22, 2004 3:51 pm, Roberto Rios said:
 Hi,
 
 I know that my subject sounds crazy, but I'm going nuts...
 
 I have an application, 100% java (jsp 1.2 and servlet 2.3). This
 application has more or less 1,5 years. So it is stable. I always used
 tomcat as my web server (without apache because I don't have static html
 to be served) with no problem.
 
 We are using TC 4.1.31, with J2SDK1.4.2_03 on a W2K/SP4 box (Xeon 3.0Ghz
 with 2GB mem).
 
 At this time we had more or less 25 concurrent users. We were happy...
 
 Recently, another department in company started to use the application.
 So now we have more or less 100 concurrent users.
 
 Since then the problems began raising. Most of then when we try to
 insert/update data in database. Generally we receive errors telling that
 we tried to insert null values into a not null field (BTW we are using
 oracle 8.1.7 with JDBC - classes12.jar).
 
 My point is that application was working. Nothing changed (except the
 number of users). So, I'm sure that the fields are being properly
 filled.
 
 What I would like to ask you, is if someone has experienced this kind of
 problem. I was wondering if tomcat could lost request parameters under
 heavy traffic...
 
 I don't have any prove that it actually lost something. As I said, I'm
 just wondering. Maybe the JDBC...
 
 Searching into the mailing list archive, I found a thread about
 performance. I have changed the connector maxProcessors to 150 and also
 add maxKeepAliveRequests=1 to it after reading it. Nothing change.
 
 Does someone has some advice? I know that my posting is vague, but I
 don't where to look anymore...
 
 I was thinking about to do a tomcat upgrade (to 5.0.X).
 
 TIA,
 
 Bob
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

RE: sending a JSP page by email

2004-12-16 Thread fzlists
I *believe*, but don't hold me to it, that you can implement a filter AFTER the 
JSP renders, in the latest servlet spec.  With that, you shouldn't have much 
trouble taking the output stream and sending it as an eMail.  I'd also assume, 
although I don't know for sure, that you could basically kill the response at 
that point, so it's not trying to send back to the client or anything.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, December 16, 2004 1:38 pm, haimra said:
 I had tried doing the same thing and failed.
 But after I gained more knowledge I had a new idea that I did not tried
 yet.
 I will be happy if you let me know if it works.
 
 The basic Idea is that if we used a servelet we had no problem taking the
 StringBuffer created and coping it into the mail message and not back to
 the
 browser.
 
 
 The problem with JSP, it's actually a servlet but we can not control it.
 In the Java Server Page (O'reilly page 315) book I found some directive
 element.
 
 %@ page buffer=12kb autoFlash=false %
 
 When autoFlash=false the JSP container will not flush the buffer until
 the
 following script % out.flash() % is used. Maybe there is a way to
 redirect
 this output writer to a buffer and email it.
 
 What do you think?
 Haim
 
 -Original Message-
 From: Gabriel Belingueres [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 15, 2004 12:15 AM
 To: [EMAIL PROTECTED]
 Subject: sending a JSP page by email
 
 Hi,
 
 How can I take advantage of Tomcat's JSP processing engine to use a
 JSP page as a template for an email?
 
 That is, I want to do something like a page forwarding from a servlet,
 but this forwarding process the JSP page and, instead of send it to
 the browser, it send it by email to somebody.
 
 Thanks in advance,
 Gabriel
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

Re: Problems whith admin application and users management

2004-12-13 Thread fzlists
Hey thanks Hassan!  I was lurking, but this thread caught my eye because I 
recently upgraded Tomcat and for the first time decided to use the admin app, 
and I had this very problem.  Your solution solved it because I did basically 
the same thing, I started with minimal.xml and put in just what I needed for my 
apps, so I didn't have these entries.  Cool!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Mon, December 13, 2004 10:13 am, Hassan Schroeder said:
 Shapira, Yoav wrote:
 
I'm using the minimal server config xml file and sha
for users' password encryption.
 
 This is probably the cause: a misconfiguration somewhere along the way.
 
 The minimal caught my eye this morning and I realized that I'd
 also used it as the basis for my server.xml -- it's missing these
 two lines found in the full-figured example server.xml file :-)
 
 Listener
 className=org.apache.catalina.mbeans.ServerLifecycleListener/
 Listener
 className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/
 
 Add, restart, admin app is now happy...
 
 --
 Hassan Schroeder - [EMAIL PROTECTED]
 Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
 
dream.  code.
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

Limit size of tomcat_out.log?

2004-12-09 Thread fzlists
Is it possible, and if so how, to limit the size of the tomcat_out.og file?  I 
have a development box that is running out of space sometimes because the log 
grows rather large when a lot of users are testing.  Thanks all!

Frank W. Zammetti
Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: Limit size of tomcat_out.log?

2004-12-09 Thread fzlists
I am on Tomcat 5.0.29.  Can you point me at some documentation on configuring 
it?  I'm not sure about the rotating... is that a configurable option? (I 
assume so).  The log I just looked as was almost 2GB, and I would assume it 
would rotate before them.  But, I have done quite a bit of configuring, so it's 
more than possible I changed the setting.

I know it's not good practice in general, but in our test environment that's 
the way some other folks here want it.  All error and debug info goes to our 
own application-level logs, but a lot of info-type messages show up in the 
Tomcat logs but NOT the app logs, and that's the way they want it (I think just 
to make it a little easier to look at the app log without going through all the 
unimportant messages).  Ah, no sense arguing what's good to do or not, this 
is the way it is in this case.
-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Thu, December 9, 2004 3:03 pm, Shapira, Yoav said:
 
 Hi,
 
Is it possible, and if so how, to limit the size of the tomcat_out.og
 file?
I have a development box that is running out of space sometimes because
 the
log grows rather large when a lot of users are testing.  Thanks all!
 
 What Tomcat versions are you using?
 
 Tomcat's Loggers (version 5.0 and earlier) automatically rotate, so you
 can have a script in place to delete old ones.  For Tomcat 5.5 and
 later, you configure the logging via log4j or JDK 1.4 logging, which
 both support various options to control/trim file size.
 
 It's not good logging practice to write everything to standard output.
 Ig that's what's happening, and that's why it's ending up in tomcat.log,
 you should change the apps at some points to use a proper logging
 framework like log4j.
 
 Finally, there are tools like cronolog and logrotate which can
 rotate/trim this file for you: they're free and easy to use, just Google
 for them.
 
 The other approach is holistic: either get more disk space (it's cheap),
 configure the logging differently when there are many users, or both.
 
 So there's a bunch of stuff you can and should do.  But Tomcat by itself
 doesn't provide much of it for you.  These are routine sysadmin tasks.
 
 Yoav Shapira http://www.yoavshapira.com
 
 
 
 
 This e-mail, including any attachments, is a confidential business
 communication, and may contain information that is confidential,
 proprietary and/or privileged.  This e-mail is intended only for the
 individual(s) to whom it is addressed, and may not be saved, copied,
 printed, disclosed or used by anyone else.  If you are not the(an)
 intended recipient, please immediately delete this e-mail from your
 computer system and notify the sender.  Thank you.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

Re: Tomcat on PDA

2004-11-08 Thread fzlists
I don't think you'll find a native build, but you MIGHT be able to get away 
with emulation... There are one or two x86 emulator for PocketPC, at least one 
of which can run Windows 95... If you can get that far, Tomcat MIGHT run in 
that environment.  Performance would be terrible I'd guess, so it's probably 
not even worth trying.  Your looking for an ARM-native version that works under 
PocketPC, and that doesn't exist to my knowledge, partly because there's no 
ARM-compatible binaries and partly because PocketPC doesn't support most of 
what Tomcat would need (i.e., JDK or full-fledged JRE... there are some Java 
runtimes, but I'm not sure how complete they are).

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Mon, November 8, 2004 1:14 pm, Suleman Butt said:
 Hi ,
  Is there any tomcat release to be installed on a PDA (HP
 5500) devise with a specs 400mhz processor and 128mb ram. Actually i
 want to execute a semantic web service on a pda device.
 
 Could anybody help me in suggesting the appropriate set of softwares
 required.
 
 Regards Suleman.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

Session invalidation problem

2004-11-08 Thread fzlists
Hello all.  I'm cross-posting this to the Tomcat and Struts lists because I'm 
not sure where is more appropriate to post it.

I have an application that is throwing the following sporadic, but thankfully 
infrequent, exceptions:

stack trace: java.lang.illegalstateexception: setattribute: session already 
invalidated

It is on a call to session.setAttribute().  Here's the weird part... Just 
before that method call I do the following:

if (session == null || session.getAttribute(sessionAlive) == null) {
  request.setAttribute(message, Your session timed out.  Please log on 
again.);
  session.invalidate();
  return mapping.findForward(reload);
}

The idea of course is to tell the user their session timed out.  Now, as I 
understand it, the session==null portion will always be false because session 
is never null, there is always a session associated with the request, even if 
it's empty.  That's the reason I put the sessionAlive attribute in during logon 
and check if THAT is null with each subsequent request to indicate whether the 
session has timed out or not (please keep the comments about this not being 
done in the typical way to a minimum... this is an inherited app I'm dealing 
with).

Any idea why I might still be seeing that exception?  The verbiage of it is a 
little odd and doesn't seem to make sense, especially considering the check 
right before that is indicating the session is fine.  I guess it COULD be 
timing out between that first check and the call to setAttribute(), but I'm 
assuming the container wouldn't invalidate a session that is attached to a live 
request, logically that would make sense, so I've more or less discounted this 
possibility.  I appreciate any thoughts you may have!

Frank W. Zammetti
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: Session invalidation problem

2004-11-08 Thread fzlists
I hadn't thought of that, but it's an interesting thought... I guess the least 
intrusive way would be to add it to the IF statement... i.e., check if the 
session is null (which should always be false, but I'm anal so what the hell), 
check is sessionAlive is null, and check if session it's new... If any of those 
are true, the session has timed out.  Interesting thought, I think I'll give 
that a shot.  Thanks a lot Phillip!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Mon, November 8, 2004 2:57 pm, Phillip Qin said:
 Have you tried session.isNew()?
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: November 8, 2004 2:52 PM
 To: [EMAIL PROTECTED]
 Subject: Session invalidation problem
 
 
 Hello all.  I'm cross-posting this to the Tomcat and Struts lists because
 I'm not sure where is more appropriate to post it.
 
 I have an application that is throwing the following sporadic, but
 thankfully infrequent, exceptions:
 
 stack trace: java.lang.illegalstateexception: setattribute: session
 already
 invalidated
 
 It is on a call to session.setAttribute().  Here's the weird part... Just
 before that method call I do the following:
 
 if (session == null || session.getAttribute(sessionAlive) == null) {
   request.setAttribute(message, Your session timed out.  Please log on
 again.);
   session.invalidate();
   return mapping.findForward(reload);
 }
 
 The idea of course is to tell the user their session timed out.  Now, as I
 understand it, the session==null portion will always be false because
 session is never null, there is always a session associated with the
 request, even if it's empty.  That's the reason I put the sessionAlive
 attribute in during logon and check if THAT is null with each subsequent
 request to indicate whether the session has timed out or not (please keep
 the comments about this not being done in the typical way to a minimum...
 this is an inherited app I'm dealing with).
 
 Any idea why I might still be seeing that exception?  The verbiage of it
 is
 a little odd and doesn't seem to make sense, especially considering the
 check right before that is indicating the session is fine.  I guess it
 COULD
 be timing out between that first check and the call to setAttribute(), but
 I'm assuming the container wouldn't invalidate a session that is attached
 to
 a live request, logically that would make sense, so I've more or less
 discounted this possibility.  I appreciate any thoughts you may have!
 
 Frank W. Zammetti
 
 
 !DSPAM:418fce80320296137119042!
 

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

RE: Response and file downloads

2004-11-01 Thread fzlists
Justin is of course completely correct.  When you submit a form to the server, you are 
getting a response back.  That response could be in a number of forms, but there's no 
such thing as creating a second response on the server and sending back both.

If you want to avoid client-side scripting (which is how soemthing like this would 
typically be done) what you can do is return your form page simply with a link to the 
file to download.  This link would in fact be a call to your server-side process that 
will push the file through THAT response.  Be sure to set the content-disposition 
headers on the response and you'll get a Save As dialog on the client WITHOUT 
overwriting what's in their browser.

As an alternative to the link, call a Javascript function on the pages' onLoad() event 
that does the same thing as clicking the link would.  Or, if you really don't want to 
use the scripting, do it with a meta redirect (or refresh, I forget off-hand) to do 
the same thing.  The pertinent point is that the content-disposition header will 
result in the Save-As dialog rather than overwriting what's on the browser already.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Mon, November 1, 2004 3:17 pm, Luc Foisy said:
 I know there is only a single response, thats why I want to create a new
 one :)
 
 I don't even want to get into opening other windows nor do I want to rely
 on javascript for required operation.
 
 I am not sure what you are refering to as atypical or robustness...
 
 How do other sites generate files on the fly (take it out of a database,
 or a report just run), on form submit, and send them down the line and not
 run into this problem?
 
 I see many people posting many places on the net that they are using the
 response to send a file, a lot of them are getting this IllegalState, but
 I never really found a followup solution that really fit my needs.
 
 Why would the possibility exist to push a file through the response if it
 leaves you with the ability to go nowhere after?
 
 (not really questions possed to you Justin, just hoping to keep it alive)
 
 -Original Message-
 From: Justin Ruthenbeck [mailto:[EMAIL PROTECTED]
 Sent: Monday, November 01, 2004 2:56 PM
 To: Tomcat Users List
 Subject: Re: Response and file downloads
 
 
 
 Luc,
 
 At 11:42 AM 11/1/2004, you wrote:
I am having a wee problem with using the response.

I have a form on a page, with a submit button to download a file. That
file is being pulled from a database and pushed to the response.
The problem I am having, I just used that response to submit the page,
so I am getting and IllegalStateException, even though it is still
pushing the file to the browswer
I also want to be able to send a redirect after the file is downloaded
(so I can refresh the page so the form submit page is regenerated, since
we are using a string to determine unique submits are only coming from
the pages we generated, and not the browser address bar)

Can we get a new response from the session variable (the one available
to jsp writing) to send the file, then get another new response to
perform a redirect
Basically I want to be able to do something like

the form submits, and passes to the applications perform methods through
the jsp catching the submit
response = new Response
response.sendFile
response = new Response
response.sendRedirect
(yes I know those are not actual methods and classes, just trying to
explain what I want)
 
 Your understanding of how, exactly, the http protocol works is
 incorrect.  Because it is a (single) request, (single) response protocol,
 what you're asking for cannot be done.
 
 It seems like what you want is for a user to fill out a form, click
 submit, then be presented with a new, fresh, form again ... with the file
 download on the side.  If you have determined that you absolutely want
 this behavior (it's atypical, so doing it won't be particularly robust),
 consider programmatically opening another browser window on form submit
 from which the download will happen ... and reload your form in your
 main browser window.  This will, of course, subject you to any
 headaches associated with javascipt window opening.
 
 justin
 
 
 
 __
 Justin Ruthenbeck
 Lead Software Engineer, NextEngine Inc.
 justinr - AT - nextengine DOT com
 Confidential. See:
 http://www.nextengine.com/confidentiality.php
 __
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

Re: Reducing network traffic for rollover images

2004-10-01 Thread fzlists
The problem is actually in your scripting... The browser should be caching the image 
after the first view anyway, but the problem you are referring to is a result of not 
pre-loading the images.  You do that by the following script when the page loads:

img0 = new Image();
img0.src = normal_version.gif;
img1 = new Image();
img1.src = mouseover_version.gif;

The for your mouseovers, you simply do:

onMouseover=this.src=img1.src;

and for mouseout:

onMouseOut=this.src=img0.src;

That way, when the page loads the images will be loaded into the img0 and img1 
objects, and the switching of the src for the displayed image is pointing to an image 
in memory at that point.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, October 1, 2004 1:44 pm, Robert Hunt said:
 Is there a way (as in, response header or other HTTPServletResponse
 setting)
 that can persuade a
 browser to use a cached version of an GIF/JPG that's used for a rollover
 effect?
 I'd like to reduce the network traffic (and perhaps improve the browser's
 response)
 from browsers that attempt to (re)load a rollover image for every tiny
 mousemove increment --
 only to receive a 304 response anyway.
 
 
 -- RH
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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