0 Replies Latest reply on May 24, 2012 5:27 AM by Natalia Fernandez

    Help needed: How to realize dynamic web app creation with JBoss AS 7

    Natalia Fernandez Newbie

      I'm new to JEE 6 web dev, and currently considering to take JBoss AS 7 (Tomcat 7) to realize a more-than-usual dynamic scenario (as I was told that JBoss AS 7 has abundant declarative as well as programmatic config power). Unfortunately, after reading 2 books on JBoss AS 7 and Tomcat 7, I still don't know how to realize this scenario:


      A JEE 6 with JSF2 web app to create "mini websites" (pagesets of 2-5 pages published under new ServletContexts) for registered website owners.

      Please, let me explain first:


      1. Website owners register under www.myservice.com/register.xhtml.
        => Obviously there is a main servlet context mapped on "/" (root context) and serving a JSF2 page 'register.xhtml'.

      2. This RegServlet installs for each site owner a new context (owner sub-domain) with a owner-chosen name, and associates webspace to it, e.g.:
        www.myservice.com/ownerX  with document root  ".../webapps/ownerX/" or another appropriate fs path for preserving storage.

      3. The RegServlet copies(?)(*) a website editor for them to construct the pageset in their own context/webspace, accessible via:
        www.myservice.com/ownerX/admin/editor.xhtml (**)
        (*) alt.: RegServlet offers 1 shared editor for all owners under main RegServlet context, www.myservice.com/editor.xhtml, which should also be accesible via the owner's context -- see (**).

      4. With the editor, the owner constructs the pageset in his context's document root by choosing from pre-defined page types (e.g., static/dyn. html page, gallery page, ...) as well as templates and themes available for these page types. The editor stores all page defs, generated JSF pages, JSF beans, CSS, etc. in the owner's webspace. Result:
        www.myservice.com/ownerX/index.xhtml, about.xhtml, mygallery.xhtml, myshop.xhtml, etc.

      5. Besides the editor, each owner will also have a customer manager for customers "acquired" via their shop:

        Thus, each customerY of ownerX will have access to a pre-deployed customer reg page, which creates a customer account:

      6. Security: The installer app context will have an own "security realm" with roles {SysAdmin, Visitor, WebsiteOwner}. Each owner context will have its own realm with roles {Website(X)Admin, Website(X)Visitor, Website(X)Customer}.


      Please note: I know that for such kind of apps a CMS would be more suitable, but is such a system - with only basic functionality - also realizable in pure JEE 6 techs?



      Now, my main question is:

      • How can I realize/configure such a dynamic scenario in JBoss AS 7?


      Basically this boils down to:

      1. How can I spawn new contexts programmatically from within the 1st app (RegServlet)?

      2. Page defs/configs would be stored in backend db where JSF pages would be generated from.
        Where would I store these generation results for each owner, and how could I programmatically (re-)deploy new pages or page changes, so that these get served???

      3. Would it be wise to run 2 AppServers, an *embedded* one (I read about Tomcat 7 Embedded) for the definition & testing phase, and a *standalone* one for the final site pubs? Is *embedded* possible for JBoss AS 7?

      4. How could I programatically configure these separated security realms?

      5. If I finally wanted to replace "www.myservice.com" with the "ownerX" part (i.e. "www.ownerX.com"), virtual hosts will be necessary. Is it possible to do this config programmatically from the 1st web app (RegServlet)?


      At the moment, I'd be very thankful for any help or pointers to examples.

      Thanks a million in advance, Natalia.