Caching: refreshing external content - jsf-2

in a web project using myFaces 2.1.8, I use the following line of code in a composite component in order to include external content (located at the application server, outside of the webapp-folder):
<ui:include src="file:/#{someSingletonBean.externalContentDir}/#{cc.attrs.externalContentFilename}" />
The FACELETS_REFRESH_PERIOD context param is set to 2 hours.
Changes made to the external content files are however not refreshed until the server gets restarted.
Is there a way to populate these changes to myFaces without restarting the server?

There is a bug recently found and fixed in 2.2.4 that cause the problem. See MYFACES-3890 for details.

Related

How to make sure to have fresh copy of files after each release of application (my website ) to the end user

I am having really some strange issue for js,images & css files related to caching.
I am using IIS 8.5 & asp.net MVC for my application, to overcome cache issue after each production release i have added version in web config and i use it mention below way. (for some common files i m using bundling)
web.config
<add key="Config.Version" value="1.0.0.0.65" />
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
some.cshtml
<script src="#Url.Content("~/Scripts/somefolder/some.js?v=" + Config.Version)" type="text/javascript"></script>
I have also enabled dynamic compression in IIS.
I wants to make sure after each Release /Publish of the application, The end user /client side update files should be loaded instated of older one.
(Here issue is that even though sever has latest updated files some time client needs to hard refresh(ctrl + F5) or similar techniques ).
My main question how can i make sure each time everyone gets the latest file version.
Note: I also don't want to compromise with cache to get performance.
Can anyone show me best practice or general guideline for this ?
Adding a query string param is enough to invalidate all client-side caching. Based on the HTTP spec, the query string is part of the URL and any change makes it a completely different URL. A browser that didn't reload the CSS/scripts would be broken. I know of no major browser that wouldn't reload, though.
One thing to consider, however, is that the HTML page itself may be getting cached. If the client is just loading the old HTML, then the old reference to the CSS/scripts is the same and are also loaded from cache. Make sure you're not allowing HTML documents to be cached if you want to ensure that the user always gets the latest version.

icefaces 3 - Cannot reach the backing bean from pages inside WEB-INF

I upgraded icefaces version from 1.8 to 3 and I'm facing the following problem:
everytime I call a method in a backing bean form pages inside WEB-INF, I have the error "Network connection interrupted" and, in firefox I see when I hover the button, POST mypage.jsf , STATUS 404 Not Found.
Can anybody help me, please?
If I move the pages outside WEB-INF it works, but I wouldn't change all the structure of my project...
Thank you very much
I suggest you to move pages outside WEB-INF. This directory has a specific meaning in web application deployment. It holds configuration and (e.g.) classes used by servlet.
Web container should not serve the content of this directory, if in 1.8 this happen, probably it's a bug that has been fixed.

JSF 2 Mojarra and Primefaces in WebSphere 7+

I have been struggling with the unholy alliance that is WebSphere 7+ and Mojarra 2.0.4 and have run into something of a showstopper.
I followed the directions as specified at this forum post and got Mojarra 2.0.4 initializing properly: http://forum.primefaces.org/viewtopic.php?f=3&t=6860
Basically I created an isolated classloader shared library that refers externally to the Mojarra and Primefaces jars, added the shared library to the webapp and reversed the classloader to go PARENT_LAST. All of that works.
When I attempt to access my web app http://server:port/context/index.xhtml it is hitting the FacesServlet correctly but then instantly the Request Dispatcher is redirecting to index.jsp???
I don't have any JSP specified ANYWHERE in my code, my app, my web.xml, and in fact I specified DEFAULT-SUFFIX to be .xhtml and that didn't help. All my web pages are .xhtml extension and FacesServlet is mapped correctly to *.xhtml.
I have tried adding XHTML as a mime type to WebSphere, disabling the Request Dispatcher, all to no avail. I have been able to get this running correctly on Tomcat 6-7, JBoss 6 and Glassfish 3 with no problems but for some reason WebSphere insists on a JSP file extension?
I appreciate any help you might have.
WAS7 sometimes does not undeploy the web applications properly. Clearing WAS_PROFILE_HOME/temp and WAS_PROFILE_HOME/wstemp may help.

Grails - Plugin view pages issue

I have a plugin with domain, controller and view pages. (Using grails 1.3.6)
I run the plugin as standalone, the views work fine. URL: http://localhost:8080/sample-plugin/gp/list. I am able to view the list page.
I installed the plugin into a main application i.e. plugin-test. Start as run-app within STS and browse to http://localhost:8080/plugin-test/gp/list. I am able to view the list page.
I bundle the application as war i.e. plugin-test.war and deploy to tomcat. When I browse to http://localhost:8181/plugin-test/gp/list I get a 404 error! I am not sure what I am doing wrong.
I have been trying to resolve it for quite sometime now and still no luck. The same main application works fine in STS but not in tomcat.
HTTP Status 404 - /plugin-test/WEB-INF/grails-app/views/gp/list.jsp
type Status report
message /plugin-test/WEB-INF/grails-app/views/gp/list.jsp
description The requested resource (/plugin-test/WEB-INF/grails-app/views/gp/list.jsp) is not available.
Please help.
Thank you.
Jay Chandran.
This sounds worryingly familiar, as I spent a while figuring out this (or a very similar) issue. I ended up raising this Grails bug report:
Plugin layout not found in war when installed from BuildConfig.groovy
Have you installed the plugin as using the new BuidConfig dependency technique? The JIRA documents my workaround.
Sharing some of my lessons learned after experiencing the same exact issue (1.3.7):
Double check your HTML source to make sure that your template really isn't being included. Mine was being included, but my CSS/image URLs were wrong (only while running as a war)...so I wrongly assumed that my template wasn't there.
Don't use the ui performance tags for referencing your static content...doesn't appear to work, even if the plugin attribute is specified.
Don't name your layout main.gsp. You're guaranteed to have conflicts.
Don't use absolute=true on your g:resource tags. This doesn't appear to append the pluginContextPath to the absolute url, even if you specify dir="${pluginContextPath}"
Don't use pluginContextPath, as it's no longer required: http://grails.org/doc/latest/guide/single.html#6.3%20Tag%20Libraries (search "Plugin Paths")
In your g:resource tags in your plugin layout, make sure you specify the plugin attribute. Set it to the name of your plugin.
Move your static images/css from your plugin to a web server. If each application using your plugin has its own copy, your users aren't going to benefit from caching when bouncing between apps.
Note that all of the above applies to the layout gsp in your plugin project, not your consuming application.

Umbraco running on a Load Balanced IIS 7.5 configuration

I have an Umbraco website that is running on IIS7.5 and is Load Balanced. The users are updating via one side only so that we don't get any issues whilst updating the site. The problem is, each day we have to force a restart of the website by touching the web.config file. If we don't touch the web.config file, the users are displayed with an Object reference not set to an instance of an object error. I have configured the DistributedCall element in the umbracoSettings config file, but can't figure out why I have to keep restarting the website.
Any ideas?
It's not a perfect solution, but I've managed to get this working by changing the Regular Interval Time in the Application Pool.

Resources