[jboss-jira] [JBoss JIRA] Commented: (JBPORTAL-1324) Multiple portals / custom url : set the default portal name
Thomas Heute (JIRA)
jira-events at lists.jboss.org
Wed Aug 27 15:24:39 EDT 2008
[ https://jira.jboss.org/jira/browse/JBPORTAL-1324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12426988#action_12426988 ]
Thomas Heute commented on JBPORTAL-1324:
----------------------------------------
Setting up:
<property>
<name>portal.defaultObjectName</name>
<value>your_wonderful_portal</value>
</property>
at the context level declares the name of the default portal. (the comment in the XML file is wrong though)
> Multiple portals / custom url : set the default portal name
> -----------------------------------------------------------
>
> Key: JBPORTAL-1324
> URL: https://jira.jboss.org/jira/browse/JBPORTAL-1324
> Project: JBoss Portal
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: Portal Core
> Environment: JBoss Portal 2.4.0 final
> Reporter: Antoine Herzog
> Assignee: Thomas Heute
> Fix For: 2.6.2 Final, 2.8 Final
>
>
> Here the code of the jmx service class
> public class ConfigurableDefaultPortalCommandFactory extends
> DefaultPortalCommandFactory {
> private static final Log logger = LogFactory
> .getLog(ConfigurableDefaultPortalCommandFactory.class);
> /**
> * The JMX attribute for default portal name.
> */
> private String defaultPortalName;
> /**
> *
> */
> public ConfigurableDefaultPortalCommandFactory() {
> super();
> }
> /*
> * (non-Javadoc)
> *
> * @see org.jboss.portal.core.model.portal.DefaultPortalCommandFactory#doMapping(org.jboss.portal.server.ServerInvocation,
> * java.lang.String, java.lang.String)
> */
> public ControllerCommand doMapping(ServerInvocation invocation,
> String portalContextPath, String portalRequestPath) {
> // orginal code : ControllerCommand cmd =
> // nextFactory.doMapping(invocation,
> ControllerCommand cmd = getNextFactory().doMapping(invocation,
> portalContextPath, portalRequestPath);
> if (cmd == null) {
> // orginal code : Context ctx = container.getContext();
> Context ctx = getContainer().getContext();
> if (ctx == null) {
> throw new IllegalStateException(
> "Default context does not exist");
> }
> // orginal code : Portal portal = ctx.getDefaultPortal();
> PortalObject portalObject = ctx.getChild(getDefaultPortalName());
> if (portalObject == null) {
> throw new IllegalStateException(
> "PortalObject as Default Portal is not found. Default Portal name is defined to : "
> + getDefaultPortalName());
> }
> Portal portal = null;
> if (portalObject instanceof Portal) {
> portal = (Portal) portalObject;
> } else {
> throw new IllegalStateException(
> "Can't find PortalObject with default portal name : "
> + getDefaultPortalName());
> }
> // if (portal == null) {
> // throw new IllegalStateException("Default portal does not exist");
> // }
> Page page = portal.getDefaultPage();
> if (page == null) {
> throw new IllegalStateException("Default page does not exist");
> }
> String handle = page.getId();
> cmd = new RenderPageCommand(handle);
> }
> return cmd;
> }
> /**
> * The JMX attribute for default portal name.
> *
> * @return the defaultPortalName
> */
> public String getDefaultPortalName() {
> return this.defaultPortalName;
> }
> /**
> * The JMX attribute for default portal name.
> *
> * @param defaultPortalName
> * the defaultPortalName to set
> */
> public void setDefaultPortalName(String defaultPortalName) {
> this.defaultPortalName = defaultPortalName;
> }
> /**
> * Call the super method first, then check the {@link #defaultPortalName} is
> * not null and not "". Throw an exception if so.
> */
> protected void createService() throws Exception {
> super.createService();
> if (getDefaultPortalName() == null
> || getDefaultPortalName().compareTo("") == 0) {
> throw new Exception(
> "The attribute DefaultPortalName can't be null or empty string. Set it in the JMX service descriptor.");
> }
> }
> /*
> * (non-Javadoc)
> *
> * @see org.jboss.system.ServiceMBeanSupport#startService()
> */
> @Override
> protected void startService() throws Exception {
> logger.info(this.getName() + " service starting. Default portal name : getDefaultPortalName() = "+getDefaultPortalName());
> super.startService();
> }
> /*
> * (non-Javadoc)
> *
> * @see org.jboss.system.ServiceMBeanSupport#stopService()
> */
> @Override
> protected void stopService() throws Exception {
> super.stopService();
> logger.info(this.getName() + " service stoping.");
> }
> }
> And add the attribute in the jmx service descriptor :
> <!-- Default portal name : "default" is the default for native jboss portal (downloaded version). -->
> <attribute name="DefaultPortalName">MyDefaultPortalNameHere</attribute>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list