tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alireza Fattahi <afatt...@yahoo.com>
Subject Re: JSP in Static Resources
Date Mon, 15 Jul 2013 06:26:27 GMT
Good point, I did not think about it !

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?!

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 <tim@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 <aw@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-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message