Friday, 1 March 2013

How to reload changes in web.xml etc. dynamically?

You may change a security-constraint in web.xml, which is normally applied by the container when it is deployed. To undeploy/deploy an app can apply the changes made in the web.xml, but this is not ideal in some cases. Here is a simple way.

How to setup a WebDAV based document repository on GlassFish?

WebDAV has several advantages over others, and here are some of them:

  • It is HTTP extension, so it should be firewall friendly, and it can make use HTTPS
  • It is supported by main stream OS, and application servers such as GlassFish
  • It supports check-in/check-out of a document (locking)

To setup a WebDAV based document repository on GlassFish, follow steps below:

  1. create a web app project in NetBeans;
  2. add web.xml and glassfish-web.xml files to the project;
  3. configure the WebdavServlet follow the GF manual;
  4. add File Realm users via GF admin console if necessary;
  5. deploy the project onto GF;

To edit a file in the repository, you need a client. Windows' 'Web Folder' has problem in performance, and difficulty on Windows 7 (unless you install a patch originally for XP). I choose BitKinex, and here is how to:

  1. download and install BitKinex on your PC;
  2. create a new WebDAV connection;
  3. set your server address and port;
  4. set security to SSL;
  5. put your credential in places;
  6. in Site Map, set path to /<webapp>/webdav/
Once you have connected, you will see your whole webapp mounted under webdav node, which is editable.