jQuery Ajax Timeouts with Spring Security

Here’s how we handled Ajax timeouts with Spring Security.

In your login controller, set response status to 401.

	@RequestMapping(value = "login", method = RequestMethod.GET)
	public void login(HttpServletResponse response) {
		...

		response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
	}

In your Ajax error callback, check for the 401 code and redirect to a page that is not the login page. If we redirect to the login page, Spring Security might go to Ajax request right after login. You can redirect to a secure page to effectively get the login page.

	$.post(url, $('#id'))
	.success(function(result) {
		...
	})
	.error(function(xhr) {
		if (xhr.status == 401) {
			window.location = 'home';
		} else {
			...
		}
	});

JBoss Website Down?

I’m getting the following exception stack trace when I visit the JBoss website.

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
net.sf.ehcache.constructs.blocking.LockTimeoutException: Lock timeout. Waited more than 20000ms to acquire lock for key DefaultCacheKey{uri='/overview', serverName='www.jboss.org', locale='en', params={}} on blocking cache default
	net.sf.ehcache.constructs.blocking.BlockingCache.get(BlockingCache.java:532)
	info.magnolia.module.cache.ehcache.EhCacheWrapper.get(EhCacheWrapper.java:74)
	info.magnolia.module.cache.cachepolicy.Default.shouldCache(Default.java:96)
	info.magnolia.module.cache.filter.CacheFilter.doFilter(CacheFilter.java:127)
	...

I see they are using Magnolia as their CMS.


Memory Restart Firefox Add-on 1.2

We have just released version 1.2 of our Firefox Add-on called Memory Restart. If you have the habit of checking Firefox memory usage in the task manager and restarting the browser if it consumes too much memory, this add-on is for you.

So what’s new?

* We have added a toolbar button for users not using the Firefox 4 add-on bar.
* We now display a dialog box confirming if the user really wants to restart. This prevents accidental restarts.
* Users can now customize the font color. Perfect for users using a dark colored theme or persona.
* We added the much requested auto restart feature. A word of warning about auto restart. Be careful not to set the memory threshold to a very low number or that might restart Firefox as soon as it opens. If this happens to you, please change the value of extensions.memoryrestart.memorylimit in prefs.js located in your profile folder.

The add-on can be downloaded from the Mozilla website.