Category Archives: Java

Grizzly Server: Static resources locked when server running

When I was finished setting up my neatly configured environment (grizzly, jersey, filters, static resources, …) I got annoyed when I started to work on the frontend. When the Grizzly server was running and e.g. the index.html was called, then there seems to be a file lock on that file. This prevents me from making changes to it so that I would have to stop the server, save the file and start the server to make the changes visible. This is no fun when developing!

Read more... (167 words, estimated 40 secs reading time)

Posted in Java, REST | Tagged , | Leave a comment

JSP: NoSuchMethodError when accessing

When accessing your website with JSPs and you immediately get the error about not finding some method in class:

then you should check that there are not two different versions of the jasper compiler included.

Posted in Java | Leave a comment

Servlet/Portlet Filter for Url-Rewriting

When it comes to URL rewriting the first thing that comes in mind is using the Apache config file httpd.conf. That’s generally good but has the disadvantage that your webapp cannot be installed without modifying a system file with root access, which not everyone might have. Anyway … this could look something like this:

Another nicer approach is to use this URL-RewriteFilter, which will be part of your webapp. You just need to copy the library into the lib-folder of your webapp and activate the filter in your web.xml like this:

This will filter all incoming URLs from the root, before they actually reach the webapp’s code. Check out the website for more options! If a webapp has for example the path “/my-portal/portal/default-page.psml” which points to your start page of your Jetspeed Portal, then you can access this page with “/startPage” by adding this rule to your configuration file (urlrewrite.xml) in your WEB-INF directory:

If you also want to have rewritten all your links of your website, you need to define an outbound rule. So every link within your JSP or Velocity Macro page will also point to the pretty URL. However it is important to use “response.encodeURL(…)” for all links! In other words use

for jsp-pages or

for vm-pages, otherwise they might not be send through the filter, so better mark them all :) The outbound-rule has to be defined something like this:

Posted in Apache, Java | Tagged , , | Leave a comment