Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

This is a proposal to enable simple multi-domain support in Roller. It is based on code that I have in production, which enables me to run http://rollerweblogger.org and http://photophys.com via of the very same Roller instance.

Requirements

  • Allow once one Roller instance to specify different URLs for different weblogs
  • Ensure that each weblog is only access by one root URL

Issues

Is this simple design what we want to support in Roller?

Design

  • different URLs for different weblogs
  • Ensure that each weblog is only accessed by one root URL

Issues

Is this simple design what we want to support in Roller?

Patches

There are two "patches" attached to Jira ROL-1670. One uploaded by Dave Johnson, the other by Sean Gilligan. They are described in the next two sections.

Dave's Patch

Dave's Patch (changedfiles-rol-1670.tgz) is actually a tarball containing all files that were changed or modified.

Sean's Patch

Sean's Patch (sean_simple_multidomain_support.patch) is a real patch. It has one other difference: rather than add the new files in the org.rollerweblogger.roller package they are in org.apache packages where their related classes live. This means that JPAMultiDomainWebloggerModule.java is the name of the Guice binding file, since it lives in the same package as JPAWebloggerModule.java that it is based upon.

Design

From the administratorFrom the user's point of view, once this proposal is implemented in Roller, all you have to do to enable multi-domain support in Roller is to add one configuration property to Roller for each blog that you would like to give it's own unique domain name to.

...

Weblog.java

In this class, the only changes change is to return the correct URL if the weblog is one for which a weblog.absolute.* URL is specified. The proposal is to make these changes directly to Roller's Weblog.java.

...

Code Block
Index: src/java/org/apache/roller/weblogger/pojos/Weblog.java
===================================================================
--- src/java/org/apache/roller/weblogger/pojos/Weblog.java	(revision 618002)
+++ src/java/org/apache/roller/weblogger/pojos/Weblog.java	(working copy)
@@ -30,7 +30,6 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TimeZone;
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.builder.EqualsBuilder;
 import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.roller.weblogger.WebloggerException;
@@ -45,6 +44,7 @@
 import org.apache.roller.weblogger.business.themes.ThemeManager;
 import org.apache.roller.weblogger.business.WeblogManager;
 import org.apache.roller.util.UUIDGenerator;
+import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.util.I18nUtils;
 
 
@@ -838,10 +838,14 @@
      * @roller.wrapPojoMethod type="simple"
      */
     public String getAbsoluteURL() {
-        // TODO: ATLAS reconcile entry.getPermaLink() with new URLs
-        String relPath = WebloggerRuntimeConfig.getAbsoluteContextURL();
-        return relPath + "/" + getHandle();
-        //return URLUtilities.getWeblogURL(this, null, true);
+        String weblogAbsoluteURL = 
+            WebloggerConfig.getProperty("weblog.absoluteurl." + getHandle()); 
+        if (weblogAbsoluteURL != null) {
+            return weblogAbsoluteURL + "/" + getHandle();
+        } else {
+            String relPath = WebloggerRuntimeConfig.getAbsoluteContextURL();
+            return relPath + "/" + getHandle();
+        }
     }
     public void setAbsoluteURL(String url) {
         // noop

...

MultiDomainURLModel.java

In this class, the only changes change is to return the correct URL if the weblog is one for which a weblog.absolute.* URL is specified.

...

MultiDomainURLStrategy.java

In this class, the only changes change is to return the correct URL if the weblog is one for which a weblog.absolute.* URL is specified. The proposal is to make these changes directly to Roller's URLStrategy.

...

Please comment on the Roller dev mailing list.

Mailing list comments have led to an alternate proposal: Proposal Configurable Domain Resolution