title: Ways to specifying "Routes" and "URIGroups" in WebSphere AS
body: <p>Environment: WebSphere Network Deployment edition v6.1 (on Linux)</p>
  
  <p>We have 2 applications <strong>"Main"</strong> and <strong>"Dynamic"</strong> that each run on a server cluster. Each of these applications is set to run from its unique domain name. So <strong>www.main.com/</strong> is serviced by the <strong>Main</strong> application while <strong>www.dynamic.com/</strong> is serviced by the <strong>Dynamic</strong> application.</p>
  
  <p>The configurations required for this have been pretty simple. So no problem so far.</p>
  
  <p>Dynamic application is related to Main and going forward, we want to be able to do the following:</p>
  
  <p>We want to be able to serve the Dynamic application from:
  <strong>www.dynamic.com/</strong> as well as
  <strong>www.main.com/d/</strong></p>
  
  <p>In order to achieve this, we have the following configuration specified in <strong>plugin-cfg.xml</strong>. </p>
  
  <pre><code>&lt;URIGroup Name="MainURIs"&gt;
    &lt;URI Name="/*" /&gt;
  &lt;/URIGroup&gt;
  
  &lt;URIGroup Name="DynamicURIs"&gt;
    &lt;URI Name="/*" /&gt;
  &lt;/URIGroup&gt;
  
  &lt;URIGroup Name="Main_DynamicURIs"&gt;
    &lt;URI Name="/d/*" /&gt;
  &lt;/URIGroup&gt;
  </code></pre>
  
  <p>2 server clusters namely "<strong>MainCluster</strong>" and "<strong>DynamicCluster</strong>" have already been defined in plugin-cfg.xml. Similarly we have <strong>virtual host groups</strong> defined for www.main.com (virtual host name) and www.dynamic.com as "<strong>MainVH</strong>" and "<strong>DynamicVH</strong>" respectively. We have the routing rules specified as follows:</p>
  
  <pre><code>&lt;Route UriGroup="MainURIs" VirtualHostGroup="MainVH" ServerCluster="MainCluster"/&gt;
  &lt;Route UriGroup="DynamicURIs" VirtualHostGroup="DynamicVH" ServerCluster="DynamicCluster"/&gt;
  
  &lt;Route UriGroup="Main_DynamicURIs" ServerCluster="DynamicCluster"/&gt;
  </code></pre>
  
  <p>Please note that we don't specify a virtual host group for the third route rule.</p>
  
  <p>This seems to work fine for our purpose. However, we had to make the above change to plugin-cfg.xml by hand. Every time the plugin-cfg.xml file in regenerated, the <strong>changes are lost</strong> and we have to make them again. This is frowned upon by our clients and they don't want that to be the case going forward.</p>
  
  <p>Is there a way we can overcome this problem of hand-editing the plugin-cfg.xml file?</p>
  
  <p>Some vague ways I was thinking of:<br>
  1) Some how making this change using the admin console of WebSphere so that even if the xml file is regenerated, it would have the relevant routing rules automatically.<br>
  2) Writing a wsadmin JACL/Jython script that could be run each time after the plugin file is regenerated. This script should be able to update the above routing rules in the configuration. I have searched quite a lot for this approach but haven't found an encouraging reply to this approach.</p>
  
  <p>Any helpful tips are highly appreciated.</p>