Hi,
We’ve installed the new 5.7 release and we’ve noticed that you don’t see the new buttons until you clear your Temporary Internet Files. Is there a setting to force the new buttons to display and update the users cache?
Hi,
We’ve installed the new 5.7 release and we’ve noticed that you don’t see the new buttons until you clear your Temporary Internet Files. Is there a setting to force the new buttons to display and update the users cache?
Browsers have native caching behaviors for various file types. Without special settings, images are typically cached for the duration of the browser session and thereafter the browser makes “conditional get” (CGET) requests to ask the server to send the image if it has changed since the last time the browser has fetched it.
The SmartClient java server includes the FileDownload servlet which can be used to set “Expires” HTTP headers which force the browser to cache various assets for longer periods of time. For development, emptying the browser cache or hitting Ctrl-R to reload your page is usually sufficient to flush the cache. In terms of setting up your production system for cache expiration, see this doc item:
http://www.smartclient.com/docs/5.6/a/b/c/go.html#group..caching
In 5.7 final, there is extra content that describes how to manage caching for SmartClient images in particular. Here’s that content:
The recommended approach is to move as much content as possible into cacheable assets (these can be images, html, css, and js) and tell the browser to cache those for as long as possible (ideally indefinitely). Clearly, most things can’t simply be cached permanently - new versions of the application will often require changes to these assets. To allow for this, the pages that direct the loading of the cached assets should be dynamic and should create version-specific URLs to these cacheable assets. This can be done by tacking the version number as a query parameter or as a path component. Here’s an example of loading a javascript file versioned with a query parameter:
<script src=‘/foo/bar.js?version=13’></script>
Generally, the version number wouldn’t be hard-coded into the dynamic page, but would instead pick up the value of a variable, such that you can simply bump up the value in one configuration file and have all versioned URLs change dynamically.
Because SmartClient performs the assembly of image URLs dynamically, versioning of SmartClient skins must be done with a path component. You can do this by changing the base skinDir using Page.setSkinDir() - e.g:
isc.Page.setSkinDir(‘/version/5.6/isomorphic/skins/SmartClient/’);
You can then either deploy the new skins under the versioned directory above or use a URL rewriting engine such as mod_rewrite for Apache to map all such versions into a single deploy directory.
To actually tell the browser to cache images for a longer length of time than the browser session, you need to set the HTTP ‘Expires’ header. If you’re not using the SmartClient Java back-end there are several caching solutions available, depending on your server of choice. Microsoft’s IIS has built-in caching capability, please check the reference manual for details. If you’re using Apache, you can use mod_expires. Some servlet containers also natively support the setting of caching headers.
Hi, thanks for all the detail.
You say it’s ideal cache your cacheable assets indefinitely but how would you configure that in web.xml to be indefinite?
You reference using isc.Page.setSkinDir() but isn’t Isomorphic already loaded by the time this is executed? I’m not clear on how that would work. Wouldn’t we instead need to set the skinDir attribute on the loadISC tag? Or, is that a suitable alternative? Perhaps it would make more sense to put each new version of Iso in a version specific directory and set the isomorphicURI attribute to a version specific value and this would also encompass the skinDir? Or, would skinDir need to also be set in addition to any change in isomorphicURI?
This depends on the mechanism you’re using to set the expires header. Using Apache’s mod_expires, for example, you can do something like:
ExpiresByType image/gif "access plus 5 years"
With the SmartClient FileDownload servlet, you have to multiply seconds out. So e.g. 5 years would be 6060243655 = 157680000 seconds. So:
<servlet>
<servlet-name>FileDownload</servlet-name>
<init-param>
<param-name>expires</param-name>
<param-value>image/gif:157680000</param-value>
</init-param>
<servlet-class>com.isomorphic.servlet.FileDownload</servlet-class>
</servlet>
You can call isc.Page.setSkinDir() right after SmartClient is loaded. You’r ok so long as you change it before you start creating components.
Changing the isomorphicURI to a version-specific URL would also work and could be a slightly cleaner approach.
Hi, I’m working on doing version specific deploys. The issue I’m seeing now is with loading the datasources. My datasources logic looks like this:
<%@ taglib uri="/WEB-INF/iscTaglib.xml" prefix="isomorphic" %>
<isomorphic:XML>
<jsp:include page="/shared/ds/Fund.ds.xml"></jsp:include>
<jsp:include page="/shared/ds/StatusOptions.ds.xml"></jsp:include>
<jsp:include page="/shared/ds/ATUser.ds.xml"></jsp:include>
<jsp:include page="/shared/ds/FundAsset.ds.xml"></jsp:include>
<jsp:include page="/shared/ds/AssetScenario.ds.xml"></jsp:include>
<jsp:include page="/shared/ds/FundAssetTradeHistory.ds.xml"></jsp:include>
<jsp:include page="/shared/ds/AnalysisConfidenceOptions.ds.xml"></jsp:include>
<jsp:include page="/shared/ds/ExpectedReturnCalculationOptions.ds.xml"></jsp:include>
<jsp:include page="/shared/ds/AnnualizeReturnOptions.ds.xml"></jsp:include>
</isomorphic:XML>
The problem is that the datasource code is rendered differently when using a version specific IsomorphicURI. It now looks like this:
xsi:"nativeType",
DataSource:[
{
ID:"Fund",
spring:"urn:jsptld:/WEB-INF/spring.tld",
fields:{
field:[
{name:"fundID", primaryKey:"true", title:"", type:"integer"},
{name:"portfolioManagerID", required:"true", type:"integer",
title:"\n Portfolio Manager\n "},
{name:"adminID", type:"integer", title:"\n Administrator\n "},
{name:"companyID", title:"", type:"integer"},
{name:"companyName", title:"", type:"text"},
{name:"deptartmentID", title:"", type:"integer"},
{name:"deptName", title:"", type:"text"},
{
name:"fundName",
required:"true",
type:"text",
title:"\n Fund Name\n ",
validators:{
validator:{max:"15", min:"1", type:"lengthRange"}
}
},
....
…which is different than the output before using a version specific IsomorphicURI and which is causing the Datasources to be undefined. Without the version specific IsomorphicURI, it will say isc.CreateDatasources() at the top of my datasource logic after being rendered by the tag. Any ideas how to fix this?
Interesting - so when you say you’re using version-specific isomorphicURIs, are you specifying an isomorphicURI to the loadISC tag or doing it some other way? What’s the JSP source that actually produces the bogus output?
The jsp source is what you see above using the isomorphic:XML tags. But, yes, I mean specifying an isomorphicURI to the loadISC tag like this:
<isomorphic:loadISC skin=“SmartClient” isomorphicURI=“isoversion/5.7/isomorphic/”/>
Ok, I see what’s happening. The <isomorphic:XML> tag requires the SmartClient schema definitions in order to do a schema-driven transform of the XML - this is required for us to derive correct JS types from the XML declaration, among other things.
These schema files are read from /isomorphic/system/schema by default (you can see a bunch of .ds.xml files in there). So the SmartClient server needs to know where you moved this directory.
In you WEB-INF/classes directory, you should have a server.properties file. If you don’t, you can copy the one from the isomorphicRuntime/WEB-INF/classes directory. In that file you should see this:
# if you've moved the isomorphic directory from its default location in webRoot,
# set the root-relative path to it here
#
# For example, if in your deployment the 'isomorphic' dir is in /foo/bar, then set
# then you'll need to set this to foo/bar/isomorphic
isomorphicPathRootRelative: isomorphic
Change this to isoversion/5.7/isomorphic. This should actually be all you need to do. The default isomorphicURI will be derived by the loadISC tag as the relative path back to webRoot from wherever your JSP is residing plus this value. So, in other words, you shouldn’t have to explicitly specify an isomorphicURI after setting this configuration parameter.
Let me know how that works for you.
Worked perfectly, thanks