<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Help needed: How to realize dynamic web app creation with JBoss AS 7
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/natalia_fernandez">Natalia Fernandez</a> in <i>JBoss AS 7 Development</i> - <a href="https://community.jboss.org/message/737604#737604">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>I'm new to JEE 6 web dev, and currently considering to take JBoss AS 7 (Tomcat 7) to realize a more-than-usual <strong>dynamic</strong> 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:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>A <em>JEE 6 with JSF2</em> web app to create "mini websites" (pagesets of 2-5 pages published under new ServletContexts) for registered website owners. </p><p>Please, let me explain first:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><ol><li style="text-align: start;"><span style="font-size: 10pt;">Website owners register under <span style="font-family: courier new,courier; color: #800080;">www.myservice.com/register.xhtml</span>.</span><br/><span style="font-size: 10pt;">=> Obviously there is a main servlet context mapped on "/" (root context) and serving a JSF2 page 'register.xhtml'.</span><br/><br/></li><li style="text-align: start;"><span style="font-size: 10pt;">This RegServlet installs for each site owner a <strong>new context</strong> (owner sub-domain) with a owner-chosen name, and associates webspace to it, e.g.:</span><br/><span style="font-size: 10pt;"><span style="font-family: courier new,courier; color: #800080;">www.myservice.com/ownerX</span>    with <strong>document root  </strong><span style="font-family: courier new,courier; color: #800080;">".../webapps/ownerX/"</span> or other appropriate fs path for <strong>preserving</strong> storage. </span><br/><br/></li><li style="text-align: start;"><span style="font-size: 10pt;">The RegServlet copies(?)<span style="color: #ff0000;">(*)</span> a website editor for them to construct the pageset in their own context/webspace, accessible via: </span><br/><span style="font-family: courier new,courier; color: #800080; font-size: 10pt;">www.myservice.com/ownerX/admin/login.xhtml</span><br/><span style="font-family: courier new,courier; color: #800080; font-size: 10pt;">www.myservice.com/ownerX/admin/editor.xhtml <span style="font-family: arial,helvetica,sans-serif; color: #000000;">(**)</span><br/></span><span style="font-size: 10pt;"><span style="color: #ff0000;">(*)</span> alt.: RegServlet offers <strong>1</strong> shared editor for all owners under main RegServlet context, <span style="font-family: courier new,courier; color: #800080;">www.myservice.com/editor.xhtml</span>, which should also be accesible via the owner's context -- see (**).</span><span style="font-family: courier new,courier; color: #800080; font-size: 10pt;"><br/></span></li><li style="text-align: start;"><span style="font-size: 10pt;">With the editor, the owner constructs the pageset in his context's document root by choosing from pre-defined <em>page types</em> (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:</span><br/><span style="font-size: 10pt;"><span style="font-family: courier new,courier; color: #800080;">www.myservice.com/ownerX/index.xhtml</span>, <span style="font-family: courier new,courier; color: #800080;">about.xhtml</span>, <span style="color: #800080; font-family: courier new,courier;">mygallery.xhtml</span>, <span style="font-family: courier new,courier; color: #800080;">myshop.xhtml</span>, etc. </span><br/><br/></li><li style="text-align: start;"><span style="font-size: 10pt;">Besides the editor, each owner will also have a <em>customer manager</em> for customers "acquired" via their shop:</span><br/><span style="font-family: courier new,courier; color: #800080; font-size: 10pt;">www.myservice.com/ownerX/admin/customer-manager.xhtml<br/></span><br/><span style="font-size: 10pt;">Thus, each customerY of ownerX will have access to a pre-deployed customer reg page, which creates a customer account:</span><br/><span style="font-family: courier new,courier; color: #800080; font-size: 10pt;">www.myservice.com/ownerX/customers/registration.xhtml </span><br/><span style="font-family: courier new,courier; color: #800080; font-size: 10pt;">www.myservice.com/ownerX/customers/login.xhtml </span><br/><span style="font-family: courier new,courier; color: #800080; font-size: 10pt;">www.myservice.com/ownerX/customers/customer-account-dashboard.xhtml<br/><br/></span></li><li style="text-align: start;"><span style="font-size: 10pt;">Security: The installer app context will have an own "security realm" with roles {SysAdmin, Visitors}. Each owner context will have its own realm with roles {Website(X)Admin, Website(X)Visitor, Website(X)Customer}. </span></li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="text-align: start;"><strong>Please note:</strong> 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?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Now, my main question is:</p><ul><li style="text-align: start;"><strong>How can I realize/configure such a dynamic scenario in JBoss AS 7? </strong></li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Basically this boils down to:</p><ol><li style="text-align: start;">How can I spawn <em>new contexts</em> <strong>programmatically</strong> from within the 1st app (RegServlet)? <br/><br/></li><li style="text-align: start;">Page defs/configs would be stored in backend db where JSF pages would be generated from. <br/>Where would I store these generation results for each owner, and how could I <strong>programmatically (re-)deploy</strong> new pages or page changes, so that these get served??? <br/><br/></li><li style="text-align: start;">Would it be wise to run <strong>2</strong> 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? <br/><br/></li><li style="text-align: start;">If I finally wanted to replace "www.myservice.com" with the "ownerX" part (i.e. "www.ownerX.com"), <em><strong>virtual hosts</strong></em> will be necessary. Is it possible to do this config <strong>programmatically</strong> from the 1st web app (RegServlet)?</li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>At the moment, I'd be very thankful for any help or pointers to examples.</p><p>Thanks a million in advance, Natalia.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/737604#737604">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS 7 Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>