Wednesday, February 16, 2005

Working with settings in Appfuse

Appfuse comes with its default decorators and authentication if you want to start an application from scratch, it is highly probable that you would want to get rid of some of the settings used and add your own. Am using the struts version of Appfuse as example , but it should work for any framework.

Some of the custom settings which you might want to disable in Appfuse are the following:

  • SiteMesh - you might want to have your own decorators or simply remove site mesh capabilities

  • Authentication - you might want to by-pass the default authentication screen of Appfuse

  • Before we edit anything please add a sub-directory to your APPFUSE_APP_DIR\web dir(APPFUSE_APP_DIR being the directory where your appfuse application resides),call this sub-directory "myPages".

    All your pages will be now placed in APPFUSE_APP_DIR\web\myPages sub-directory.

    So lets start with SiteMesh which uses decorators to render every jsp or html to a page with its custom decorators. To remove this simply open the APPFUSE_APP_DIR\web\WEB-INF\decorators.xml and add the following in the excludes tag:


    Now lets hack out the authentication page so as we dont need to supply login information each time we want to access our pages found in APPFUSE_APP_DIR\web\myPages sub-directory.

    Open APPFUSE_APP_DIR\metadata\web\web-security.xml file add your struts actions in the "web-resource-collection" tag for example I have one action called "/laszlo" so this would mean that I would have the following in my web-security.xml file:


    Please note: The "/laszlo" struts action has a ".html" extension instead of the common ".do" extension this is because Appfuse does not want to show the underlying technology used behind its applications it becomes an abstraction to the user.

    And thats it we can start building right away our own application in myPages directory without having caused any damage to the existing default appfuse sample application.

    No comments: