RE: caching static objects

2004-03-23 Thread Ronald Wildenberg
 We are running Tomcat-standalone and are having some caching 
 issues. It
 appears to be a browser issue, but there's got to be some workaround.
 We've got the headers set to pragma nocache, but it continues to cache
 objects, such as charts that are created dynamically. I suppose this
 wouldn't be an issue if the code worked with Apache. Also, creating
 unique identifiers for each object has been shot down. Does 
 anyone know
 of a way to get server.xml to set each object not to cache? Thanks.
 


The 'Pragma' header you use is from HTTP/1.0. Most caches, including
browser cache, by now use HTTP/1.1, where cache control is achieved
differently. You should use 'Cache-Control' headers (although it never
hurts to also use 'Pragma' headers, in case you encounter an older
HTTP/1.0 cache).

For more information you can look at the HTTP/1.1 RFC at:

   ftp://ftp.isi.edu/in-notes/rfc2616.txt

and search for the text 'Cache-Control'.


Regards, Ronald.

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



RE: How can I get a method to be called every 60 seconds in Tomca t?

2004-03-16 Thread Ronald Wildenberg
 I want to get a method to automatically get called every 60 
 seconds in Tomcat.  The method reset() will reset monitoring 
 information.  How can I do this?  
 

java.util.Timer and java.util.TimerTask


Regards, Ronald.

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



RE: Filters and load-on-startup

2004-03-16 Thread Ronald Wildenberg
 Hi,
 
 Do filters get loaded before servlets regardless of load-on-startup
 value?
 
 I don't think so: as filters can be mapped to servlet-name, servlets
 must be loaded first.  (Although I suppose you could read web.xml, so
 you have the servlet info, then instantiance filters, then instantiate
 servlets, but tomcat doesn't do this).
 
 I wouldn't rely on this order unless you had to, however, as it's not
 mandated either way by the Servlet Specification.
 


Actually, it is. SRV9.12 mandates the following load order: listeners,
filters, servlets (Servlet Specification 2.4). So any filters should be
loaded before any servlets, regardless of load-on-startup value.


Regards, Ronald.

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



RE: Passing init params to a listener?

2004-03-15 Thread Ronald Wildenberg
 G'day,
 
 I assume from this that init parameters can only be accessed 
 by a listener
 if they have been declared globally within the applications 
 context and not
 from within the scope of the listener itself?  
 
 Hm


You can not specify initialization parameters for individual
listeners. The syntax you use is even illegal.

I do not really see why this should not be possible, since
all other web components (servlets, filters) can be parameterized,
but that may be something for a future specification.

Regards, Ronald.

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



RE: redirect and request´s attributes doubts

2004-03-12 Thread Ronald Wildenberg
   Hello dudes, i´m trying to set some attributes to a 
 request in my
 servlet, that´s pretty easy as you know, but after i must use 
 redirect to a
 JSP page and when i try to recall those attributes created before they
 doesn´t appear in JSP´s request object. Even thought i set a request´s
 attribute and use redirect i cannot get it again, can i?
 


The attributes you add to the request are added on the server. There
is a request object on the server that you add attributes to.

If you use sendRedirect, the client (browser) receives a redirect
response from the server (status code 3xx), with the location to
redirect to. The client then creates a _new_ request for the new url
and sends it to the server. The server creates a new HttpServletRequest
object for you that has nothing to do with the old object.


Regards, Ronald.

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



RE: Dump HTTP Request and Response Headers

2004-03-12 Thread Ronald Wildenberg
 Dear folks,
   How could i dump HTTP Response and Request headers. 
   Im using Apache 1.3 and Tomcat 4.0 MOD_JK.
 

For Mozilla you have a tool called Live HTTP Headers
(http://livehttpheaders.mozdev.org/) that does exactly
what you want. You install it into Mozilla and it
shows you the headers that are sent and received by the
browser.

Undoubtedly for IE there exist similar tools.


Regards, Ronald.

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



RE: Setting page content Type

2004-03-12 Thread Ronald Wildenberg
 I have been experiementing with
 
 jsp:directive.page contentType=... /
 @ page contentType=... /
 
 but none of them seem to be able to take a variable value for 
 contentType,
 

These constructs will indeed not work (and they never will work in
future versions either). The constructs you use are directives
(the first one in XML syntax, the second in JSP syntax). Directives
are interpreted at page translation time. The tags you attempt to
use are not executed at page translation time but at page
execution time (when a request is received for the page).

Directives can not have variables as attributes, since the value
of these variables can never be known at the time the page is
translated to a servlet.

Regards, Ronald.

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



RE: release method in taglib

2004-03-11 Thread Ronald Wildenberg
 I have created several custom tag libs, I notice there is a 
 release() method in the TagSupport class.  Will the release() 
 method be automically called the tag lib is finished?  If 
 not, where should I call it?  Thanks!
 


It will be called by the JSP page implementation object
automatically, so you don't have to call this yourself.
Multiple invocations on doStartTag and doEndTag may have
occurred before this method is called (for example when
multiple tags of the same type occur on a page).


Regards, Ronald.

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



RE: HttpServletResponse.sendRedirect() closes the stream

2004-03-10 Thread Ronald Wildenberg
 -Oorspronkelijk bericht-
 Van: suviswan [mailto:[EMAIL PROTECTED]
 Verzonden: woensdag 10 maart 2004 10:20
 Aan: Tomcat Users List
 Onderwerp: HttpServletResponse.sendRedirect() closes the stream
 
 
 Hi
 I am using Tomcat 4.1.29. When i do
 HttpServletResponse.sendRedirect() inside my servlet doGet(), it
 automatically closes the stream
 So when i call the real close() function it throws IOException
 
 java.io.IOException: The stream has been closed
 at
 org.apache.catalina.connector.ResponseStream.close(ResponseStr
 eam.java:219)
 
 Please let me know how to solve on this.


The easiest way would be not to call close() on the response's output
stream. Is there a reason you need to call close()?

The servlet spec says that sendRedirect has the side effect of committing
the response and terminating it. If the response is terminated, its
related OutputStream is closed, so it can not be closed again.


 
 Thanks
 Surendra
 

Regards,
Ronald.

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



RE: Tomcat 4.1 hangs on File Reading

2004-03-10 Thread Ronald Wildenberg
snip

 
 public static LoginLog[] readLog()throws FileNotFoundException
 {
   Vector log = new Vector();
 
   try {
 FileReader inFile = new FileReader( /var/log/GFWlogin.log );
 BufferedReader bfFile = new BufferedReader( inFile );
   while ( bfFile.ready() ) {
 LoginLog logentry = getLogentry( bfFile );
 log.add( logentry );
   }
 bfFile.close();
} catch ( IOException e ) {} ;
return (LoginLog[])log.toArray( new LoginLog[log.size()] );
 }
 


Why not simply use:

   String line = null;
   while ((line = bfFile.readLine()) != null) {
  LoginLog logEntry = getLogEntry(line); // Create log entry from the
line just read.
  log.add(logEntry);
   }

There is no need to use 'bfFile.ready()'. This method only checks
whether the call to a read method may block, which is not a problem
at all.


Regards,
Ronald.

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



RE: Tomcat Realm Authentication + Storing Objects In The Session

2004-03-10 Thread Ronald Wildenberg
 My biggest unknown right now is, because the server handles 
 the creation
 of the session, what would it take to make the server grab a 
 user object
 from the database and store it in the session after the user 
 logs in?  
 


Can't you use an HttpSessionListener for this? It is called right
after a session is created (and when it's destroyed again). I'm
not sure though whether there's enough information in the HttpSession
object for you to be able to grab something from the database at
the time HttpSessionListener.sessionCreated() is called.

Regards,
Ronald.

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



Asynchronous messages from servlets

2002-01-22 Thread Ronald Wildenberg

Hi,

I have the following problem. A simple form submits data
to a servlet. The servlet sends a message via JMS to
another application (in another JVM). Once the message
has been sent, the 'service' method of the servlet ends.
After a while, say five seconds, the other application would
like to send back a response. How do I show this response
to the user?

Since the 'service' method has finished after sending the
message, I have lost control over the output from the other
application.

What I need is a way to push the response to the browser. I
would like the server to take the initiative in updating the browser
window, not the user. Is this possible in any way?

Thanks in advance,
Ronald Wildenberg



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]