Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22293

Re: Enable java script files caching

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <20401233.DaGxT2JRNg@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Thu, 12 Dec 2013 21:39:37 +0100
User-Agent KNode/4.11.3
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: Enable java script files caching
Newsgroups comp.lang.javascript
References <498464fb-63dd-48a0-b511-01ee2efd621f@googlegroups.com>
MIME-Version 1.0
Lines 58
NNTP-Posting-Date 12 Dec 2013 21:39:44 CET
NNTP-Posting-Host d9d46353.newsspool1.arcor-online.net
X-Trace DXC=k_6\>GfRQO=85[]]\]T081ic==]BZ:af>4Fo<]lROoR1nkgeX?EC@@0IRTKiQcV`14DZm8W4\YJN<YUVHKH;GI^7CEBH]AdNf=0RG5^UWXQRj9
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:22293

Show key headers only | View raw


Swetha wrote:

> […]
> Whatevr js files i include in the index.jsp is getting cached, because
> there is no timestamp added to the js URL.

Wrong conclusion.  *No* timestamp being added to the URI would mean that the 
resource is cached on and by the client unless you have explicitly said to 
not cache it and the user agent is obeying your request, or a user 
preference says it should not be cached there.  Also, whether the index.jsp 
resource or rather, the resource generated by it, is cached, does _not_ 
directly depend on the URIs of the resources containing the client-side 
code.

> But the js files included in the subsequent jsps are not getting cached
> due to timestamp added to the js URL.

Whether a resource is cached or not does _not_ depend on its URI.  Instead, 
a potential *already cached* resource is *not used* by the HTTP client if a 
resource with potentially the same content but a *different* URI (e.g., 
different timestamp) is requested from the Web server afterwards.  It 
usually *is* used (and not requested again) if both its content and URI do 
not change.

> My question is how to get rid of timestamp added to js url?

Wrong question.  If you would get rid of the timestamp, the (HTML) content 
*generated* by your index.jsp resource might not change later at all; and 
once cached, unless you or the user said differently, it would be even more 
likely to be used from the client's cache (which you do *not* want).

As a result, the script resource URI should *at most* change when the 
content of the resource changes.

<http://mnot.net/cache-docs>
 
> i am adding the js files in the jsp like follow:
> 
> <script src="js/angular/angular.min.js"></script>
> <script src="js/angular/angular-cookies.min.js"></script>
> 
> i am using struts1. 

Use Struts 2 instead, see <http://struts.apache.org/>.

> PLease help me how to solve this issue

Wrong newsgroup.  For the ECMAScript implementation that you are using 
client-side (e.g., JavaScript), it does not matter how the code that invokes 
it is generated (server-side).  Ask (in proper language and text format) in 
a newsgroup dealing with JavaServer Pages (JSP), which is generating your 
client-side code (at least the HTML code), instead.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Enable java script files caching Swetha <swetha.ganta7@gmail.com> - 2013-12-12 11:09 -0800
  Re: Enable java script files caching Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-12 21:39 +0100

csiph-web