Topic
2 replies Latest Post - ‏2013-03-27T10:30:57Z by SystemAdmin
SystemAdmin
SystemAdmin
1192 Posts
ACCEPTED ANSWER

Pinned topic Cache-control in HATS

‏2013-03-15T14:05:02Z |
Hi All,
I want in my HATS web project that all the JS and CSS file must be cached for improving the response time of the application but when I see the source code of my JSPs I find that HATS its self include following line of code in the header of each JSPs

<meta http-equiv="Cache-control" content="no-cache">
How can I remove this line of code form my HATS application for making sure that my application is doing cache to JS, CSS and image files.

Thanks
Sami
Updated on 2013-03-27T10:30:57Z at 2013-03-27T10:30:57Z by SystemAdmin
  • SanthiRamala
    SanthiRamala
    34 Posts
    ACCEPTED ANSWER

    Re: Cache-control in HATS

    ‏2013-03-25T15:38:04Z  in response to SystemAdmin
    Hi Sami,

    For my application I have used below approach to make cache enabled:

    -> Know the template which you have chosen in HATS application. For example if you have Finance as your template then open the Finance.jsp ( HATSProject\Web Content\templates\Finance.jsp )

    To know the template which you have selected in HATS project, go to HATS project view expand to <HATSProject> -> Web Content -> Templates-> which ever is selected as default is the template

    -> In <template> jsp file, in our example in Finanace.jsp after line <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> add <meta http-equiv="Cache-control" content="private">

    You will find duplicate meta cache-control tags but recent(later) one would be considered always.
    Hence this would allow browser to cache the js, css and image files.

    Best Regards
    Santhi
    • SystemAdmin
      SystemAdmin
      1192 Posts
      ACCEPTED ANSWER

      Re: Cache-control in HATS

      ‏2013-03-27T10:30:57Z  in response to SanthiRamala
      Hi Sami;

      You can remove the cache control and can edit the meta cache tag as per your requirement,
      Here is the way
      1)Remove below HATS tag from the template
      <HATS:Util type="baseHref" />

      2) Add below line of code which is editable as per your requirements, make cache private, public or what you want.
      <BASE href="http://localhost:port/prentFolder/templates/defaultTemplate.jsp"
      <meta http-equiv="Pragma" content="Public">
      <meta http-equiv="Cache-control" content="Public">
      <META http-equiv="Content-Script-Type" content="text/javascript">

      Remember on thing on <BASE href="put the path of your template">

      Enjoy HATS