Alireza Fattahi wrote:
Good point, I did not think about it !
What is a good point ?
That is what Konstantin meant, when he asked you to not "top post".
If you comment or answer questions on top of your message, then someone has to scroll down
the message and try to figure out to what your comment relates, or what question you are
answering. Many people won't bother.
Insert your answers directly below the question/comment to which it relates,
please.
Please let me know this:
If I have an static html page ( like and about.html page) and I change the
extension to to jsp (about.js) , then the tomcat will not cache it any more?!
Wrong explanation. It has nothing to do with the extension.
The point is : it is only possible to cache a *static* document. That is true at the
server level, and at the browser level. If a document is generated dynamically, using
some code, then the caching logic has no way to determine if this thing changes from one
call to the next, and thus caching previous responses is useless.
A response generated by a JSP (whether it is HTML, CSS or anything else) is dynamic by
nature, and cannot/should not be cached.
In other words, the very subject of this thread does not really make sense : if you add
Java code into a static resource and thus make it into a JSP, it is not static anymore.
You can probably find a way to "trick" the caching mechanisms into "believing" that a
dynamic response is static. But then you will create severe problems in the usage of your
application, because clients will start using outdated versions of the pages, instead of
the correct ones.
I try to google tomcat caching and could not find any thing useful.
Can you please give me some references about caching?
~Regards,
~~Alireza Fattahi
________________________________
From: Tim Watts <t...@cliftonfarm.org>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Monday, 15 July 2013, 3:23
Subject: Re: JSP in Static Resources
On Sun, 2013-07-14 at 23:28 +0200, André Warnier wrote:
Alireza Fattahi wrote:
Well,
If we want to follow up that post , then we should belive that:
Tomcat is an inclusive church, and you can believe what you want.
Konstantin is one of the Tomcat developers however, so you should
probably consider what he wrote and try to understand it correctly.
Setting the mime type is not working for css
That is not what he wrote.
Setting the MIME type in (tomcat)/conf/web.xml /does/ work, for the
default servlet which is used by default in all webapps to serve
static documents. But in the case of the logic which you want to
implement, the CSS is not a static document, so it is not relevant to
your specific case.
He gave you the proper syntax for Tomcat 7, because previously you did
not mention the Tomcat version that you were using.
For Tomcat 6, that syntax doesn't work.
So
we should use other ways to solve it.
Yes. The first option would be to use Tomcat 7 instead of Tomcat 6.
Then the syntax shown by Konstantin would work.
Otherwise, he gave you one hint of how to try to solve it.
Another possibility would be to wrap your webapp with a servlet
filter, and set the content-type header there, before the content is
written to the response object.
Another possibility would be to re-think your logic, and leave you CSS
files be static documents, and just pick the one you need to include.
That you want or don't want to use a certain logic is your choice; but
if you pick a logic which is difficult to implement in the version of
the software that you are using, then the problem to implement it is
ultimately yours.
Another drawback to generating the CSS files dynamically is that you'll
have to do extra work to make them cacheable. But when served as static
resources, the default servlet does a good job of this for you. If you
don't take steps to make them cacheable, they'll be fetched every time
on every page adding extra load on your server and the network.
Is that true?!
~Regards,
~~Alireza Fattahi
________________________________
From: André Warnier <a...@ice-sa.com>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Sunday, 14 July 2013, 12:00
Subject: Re: JSP in Static Resources
Alireza Fattahi wrote:
Guys please concentrate on the main issue !!
I believe that "the main issue" was already answered thoroughly by Konstantin
earlier.
Did you not read it ?
I ask again:
When you set jsp servlet to process the css files by adding:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
The tomcat does not set the CSS file extension mime type to text/css. Although
below line is set in localhost-config/web.xml
<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
When you manually set the content mime type <%@page contentType="text/css" %>
every thing will work fine
~Regards,
~~Alireza Fattahi
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org