JBoss Portal SVN: r13578 - in branches/Enterprise_Portal_Platform_4_3: core-admin/src/main/org/jboss/portal/core/admin/ui/actions and 8 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 18:28:45 -0400 (Tue, 21 Jul 2009)
New Revision: 13578
Modified:
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/RenameAction.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/jsf/common/editPreferences.xhtml
branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java
branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java
Log:
- Renamed ManagedBean.checkNameValidity to checkValidity as it's more correct.
- JBPORTAL-2427:
+ PreferenceBean now validates value in setValue
+ inject beanContext in PortletManagerBean and InstanceManagerBean so that it can be made available to PreferenceBean via PreferencesBean
+ added error reporting in editPreferences.xhtml and fixed typo
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -86,7 +86,7 @@
public void setValue(Object value)
{
// it's currently quite difficult to retrieve the correct target for error messages, send them to "status"
- String propertyValue = checkNameValidity(value.toString(), null);
+ String propertyValue = checkValidity(value.toString(), null);
if (propertyValue != null && !inherited)
{
this.value = value.toString();
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.instance.InstanceDefinition;
import org.jboss.portal.core.model.instance.NoSuchInstanceException;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -108,6 +109,13 @@
/** . */
private AuthorizationBean auth = new InstanceAuthorizationBean();
+ private transient BeanContext beanContext;
+
+ public void setBeanContext(BeanContext beanContext)
+ {
+ this.beanContext = beanContext;
+ }
+
// Services accessors
public RoleModule getRoleModule()
@@ -218,7 +226,7 @@
{
try
{
- selectedPrefs = new PreferencesBean(true);
+ selectedPrefs = new PreferencesBean(true, beanContext);
//
PreferencesInfo prefsInfo = selectedInstance.getPortlet().getInfo().getPreferences();
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -20,12 +20,14 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
+
package org.jboss.portal.core.admin.ui;
import org.jboss.logging.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
@@ -124,6 +126,13 @@
/** . */
private transient FederatedPortletInvoker selectedPortletInvoker;
+ private transient BeanContext beanContext;
+
+ public void setBeanContext(BeanContext beanContext)
+ {
+ this.beanContext = beanContext;
+ }
+
// Wired services
public InstanceContainer getInstanceContainer()
@@ -262,7 +271,7 @@
// If the portlet has preferences info then we display them
if (prefsInfo != null)
{
- selectedPreferences = new PreferencesBean(false);
+ selectedPreferences = new PreferencesBean(false, beanContext);
for (Iterator i = prefsInfo.getKeys().iterator(); i.hasNext();)
{
String key = (String)i.next();
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferenceBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -25,8 +25,11 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.faces.el.dynamic.DynamicBean;
+import org.jboss.portal.faces.gui.BeanContext;
+import org.jboss.portal.faces.gui.ManagedBean;
import org.jboss.portal.portlet.info.PreferenceInfo;
+import javax.faces.el.EvaluationException;
import javax.faces.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
@@ -35,7 +38,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PreferenceBean implements Comparable, DynamicBean
+public class PreferenceBean extends ManagedBean implements Comparable, DynamicBean
{
/** . */
@@ -62,13 +65,14 @@
/** . */
private boolean stale;
- public PreferenceBean(PreferenceInfo prefInfo, List<String> value)
+ public PreferenceBean(PreferenceInfo prefInfo, List<String> value, BeanContext beanContext)
{
this.name = prefInfo.getKey();
this.readOnly = Boolean.TRUE.equals(prefInfo.isReadOnly());
this.displayName = prefInfo.getDisplayName();
this.description = prefInfo.getDescription();
this.value = value;
+ setBeanContext(beanContext);
}
public String getName()
@@ -197,16 +201,36 @@
public boolean setValue(Object propertyName, Object value) throws IllegalArgumentException
{
+ // if the value is invalid, throw an EvaluationException to prevent upstream processing...
if (propertyName instanceof String)
{
+ String stringValue = (String)value;
String s = (String)propertyName;
+
if (s.startsWith("index_"))
{
int index = Integer.parseInt(s.substring(6));
- this.value.set(index, (String)value);
- stale = true;
- return true;
+ stringValue = checkValidity(stringValue, "common-edit-existing-form:pref-input-" + index);
+
+ if (stringValue != null)
+ {
+ this.value.set(index, stringValue);
+ stale = true;
+ return true;
+ }
+ else
+ {
+ throw new EvaluationException("Invalid preference value: " + value);
+ }
}
+ else
+ {
+ stringValue = checkValidity(stringValue, "common-append-form:new_value");
+ if (stringValue == null)
+ {
+ throw new EvaluationException("Invalid preference value: " + value);
+ }
+ }
}
return false;
}
@@ -216,4 +240,14 @@
PreferenceBean that = (PreferenceBean)o;
return name.compareTo(that.name);
}
+
+ protected String getObjectTypeName()
+ {
+ return "PREFERENCE_TYPE";
+ }
+
+ public boolean isAlreadyExisting(String objectName)
+ {
+ return false; // not used
+ }
}
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PreferencesBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.portlet.info.PreferenceInfo;
import java.util.ArrayList;
@@ -43,12 +44,14 @@
/** . */
private boolean mutable;
+ private BeanContext beanContext;
- public PreferencesBean(boolean mutable)
+ public PreferencesBean(boolean mutable, BeanContext beanContext)
{
this.entries = new ArrayList();
this.selectedIndex = -1;
this.mutable = mutable;
+ this.beanContext = beanContext;
}
public boolean isMutable()
@@ -92,7 +95,7 @@
}
//
- addEntry(new PreferenceBean(prefInfo, null));
+ addEntry(new PreferenceBean(prefInfo, null, beanContext));
}
public void addEntry(PreferenceInfo prefInfo, List<String> value)
@@ -103,7 +106,7 @@
}
//
- addEntry(new PreferenceBean(prefInfo, value));
+ addEntry(new PreferenceBean(prefInfo, value, beanContext));
}
private void addEntry(PreferenceBean pref)
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -125,7 +125,7 @@
if (!ParameterValidation.isNullOrEmpty(propertyValue))
{
// it's currently quite difficult to retrieve the correct target for error messages, send them to "status"
- propertyValue = checkNameValidity(propertyValue, null);
+ propertyValue = checkValidity(propertyValue, null);
}
if (propertyValue != null)
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/AddPageAction.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -53,7 +53,7 @@
public void execute()
{
- pageName = checkNameValidity(pageName, messageTarget);
+ pageName = checkValidity(pageName, messageTarget);
if (pageName != null)
{
try
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -84,7 +84,7 @@
public String execute()
{
// Validate instance id
- instanceId = checkNameValidity(instanceId, MESSAGE_TARGET);
+ instanceId = checkValidity(instanceId, MESSAGE_TARGET);
if (instanceId == null)
{
return null;
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -28,8 +28,8 @@
import org.jboss.portal.common.util.ConversionException;
import org.jboss.portal.core.admin.ui.DisplayNameBean;
import org.jboss.portal.core.model.HasDisplayName;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.faces.gui.ManagedBean;
-import org.jboss.portal.faces.gui.BeanContext;
import java.util.Collection;
import java.util.HashMap;
@@ -109,7 +109,7 @@
boolean directResolved = beanContext.isTargetResolved(DISPLAY_NAME_DIRECT);
boolean inViewResolved = beanContext.isTargetResolved(DISPLAY_NAME_IN_VIEW);
- if(directResolved)
+ if (directResolved)
{
errorMessageTarget = DISPLAY_NAME_DIRECT;
}
@@ -122,7 +122,7 @@
errorMessageTarget = BeanContext.STATUS;
}
- newText = checkNameValidity(newText, errorMessageTarget);
+ newText = checkValidity(newText, errorMessageTarget);
if (newText != null)
{
HasDisplayName hasDisplayName = getTarget();
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PortalAction.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -104,7 +104,7 @@
{
PortalContainer portalContainer = (PortalContainer)pomgr.getSelectedObject();
- portalName = checkNameValidity(portalName, MESSAGE_TARGET);
+ portalName = checkValidity(portalName, MESSAGE_TARGET);
if (portalName != null)
{
Portal portal = portalContainer.createPortal(portalName);
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -97,7 +97,7 @@
String propertyName = null;
if (!ParameterValidation.isNullOrEmpty(otherPropertyName))
{
- propertyName = checkNameValidity(otherPropertyName, "common-edit-prop-form:property");
+ propertyName = checkValidity(otherPropertyName, "common-edit-prop-form:property");
}
else
{
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/RenameAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/RenameAction.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/RenameAction.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -93,7 +93,7 @@
return null;
}
- newName = checkNameValidity(newName, MESSAGE_TARGET);
+ newName = checkValidity(newName, MESSAGE_TARGET);
if (newName != null)
{
PortalObject parent = renamedObject.getParent();
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/common/PageManagerBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -20,6 +20,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
+
package org.jboss.portal.core.admin.ui.common;
import org.jboss.portal.Mode;
@@ -294,7 +295,7 @@
}
else
{
- windowName = checkNameValidity(windowName, "windowForm:windowName");
+ windowName = checkValidity(windowName, "windowForm:windowName");
if (windowName == null)
{
throw new AbortProcessingException("Duplicate window name!");
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/CoordinationManagerBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -141,7 +141,7 @@
{
if (isOldAndNewDifferent(oldName, newName))
{
- if (checkNameValidity(newName, "renameForm:newName") != null)
+ if (checkValidity(newName, "renameForm:newName") != null)
{
try
{
@@ -170,7 +170,7 @@
{
String nameForMessages = getObjectNameForMessages();
String target = "create-" + nameForMessages + "-form:" + getAdditionalFormId() + nameForMessages + "Name";
- if (checkNameValidity(getBeanName(), target) != null)
+ if (checkValidity(getBeanName(), target) != null)
{
try
{
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2009-07-21 22:28:45 UTC (rev 13578)
@@ -340,6 +340,7 @@
PROPERTY_TYPE=property
PORTAL_OBJECT_TYPE=portal object
WINDOW_TYPE=window
+PREFERENCE_TYPE=preference
MAKE_DEFAULT_SUCCESS= ''{0}'' {1} was successfully set as default {1}
DESTROY_SUCCESS=''{0}'' has successfully been destroyed
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2009-07-21 22:28:45 UTC (rev 13578)
@@ -215,6 +215,11 @@
<property-name>paginationSize</property-name>
<value>20</value>
</managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+ <property-class>org.jboss.portal.faces.gui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
</managed-bean>
<!-- The portlet manager managed bean -->
@@ -246,6 +251,11 @@
<property-name>paginationSize</property-name>
<value>20</value>
</managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+ <property-class>org.jboss.portal.faces.gui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/jsf/common/editPreferences.xhtml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/jsf/common/editPreferences.xhtml 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/jsf/common/editPreferences.xhtml 2009-07-21 22:28:45 UTC (rev 13578)
@@ -1,3 +1,26 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
<div
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
@@ -5,11 +28,11 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
-<c:choose>
- <c:when test="#{not empty prefs.entries}">
- <h:form id="common-edit-pref-form">
- <table class="full-width datatable">
- <thead class="portlet-section-header" style="text-align:left;">
+ <c:choose>
+ <c:when test="#{not empty prefs.entries}">
+ <h:form id="common-edit-pref-form">
+ <table class="full-width datatable">
+ <thead class="portlet-section-header" style="text-align:left;">
<tr>
<th>#{bundle.COMMON_KEY}</th>
<th>#{bundle.COMMON_NAME}</th>
@@ -18,16 +41,16 @@
<th>#{bundle.COMMON_VALUE}</th>
</c:if>
</tr>
- </thead>
- <tbody>
+ </thead>
+ <tbody>
<c:forEach items="#{prefs.entries}" var="pref" varStatus="status">
<tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
<td>
<c:choose>
<c:when test="#{prefs.mutable and pref.readOnly == false}">
<h:commandLink id="pref-link-#{status.index}"
- rendered="#{pref.readOnly == false}"
- action="#{pref.select}">#{pref.name}</h:commandLink>
+ rendered="#{pref.readOnly == false}"
+ action="#{pref.select}">#{pref.name}</h:commandLink>
</c:when>
<c:otherwise>#{pref.name}</c:otherwise>
</c:choose>
@@ -36,7 +59,8 @@
<h:outputText value="#{pref.displayName.value}"/>
</td>
<td>
- <h:selectBooleanCheckbox id="pref-check-#{status.index}" disabled="true" value="#{pref.readOnly}"/>
+ <h:selectBooleanCheckbox id="pref-check-#{status.index}" disabled="true"
+ value="#{pref.readOnly}"/>
</td>
<c:if test="#{prefs.mutable}">
<td>
@@ -45,30 +69,32 @@
</c:if>
</tr>
</c:forEach>
- </tbody>
- </table>
- </h:form>
- </c:when>
- <c:otherwise>
- <p>#{bundle.COMMON_NO_DEFINED_PREFERENCES}.</p>
- </c:otherwise>
-</c:choose>
+ </tbody>
+ </table>
+ </h:form>
+ </c:when>
+ <c:otherwise>
+ <p>#{bundle.COMMON_NO_DEFINED_PREFERENCES}.</p>
+ </c:otherwise>
+ </c:choose>
-<c:if test="#{prefs.selectedEntry != null}">
- <h:form id="common-edit-exisiting-form" style="padding: 1em 0 1em 0">
- <fieldset style="border: 1px solid;">
- <legend>#{bundle.COMMON_EDIT_EXISTING_VALUES}</legend>
- <table>
- <tbody>
+ <c:if test="#{prefs.selectedEntry != null}">
+ <h:form id="common-edit-existing-form" style="padding: 1em 0 1em 0">
+ <fieldset style="border: 1px solid;">
+ <legend>#{bundle.COMMON_EDIT_EXISTING_VALUES}</legend>
+ <table>
+ <tbody>
<c:forEach items="#{prefs.selectedEntry.indices}" var="index" varStatus="status">
<tr>
<td>
<h:outputLabel for="row_#{status.index}">
- <h:outputText value="#{bundle.COMMON_VALUE} #{status.index}: " styleClass="portlet-form-field-label"/>
+ <h:outputText value="#{bundle.COMMON_VALUE} #{status.index}: "
+ styleClass="portlet-form-field-label"/>
</h:outputLabel>
</td>
<td>
- <h:inputText id="pref-input-#{status.index}" value="#{prefs.selectedEntry[index]}" styleClass="portlet-form-input-field"/>
+ <h:inputText id="pref-input-#{status.index}" value="#{prefs.selectedEntry[index]}"
+ styleClass="portlet-form-input-field"/>
</td>
<td>
<h:commandButton
@@ -76,6 +102,7 @@
actionListener="#{prefs.selectedEntry.deleteLine}"
value="#{bundle.COMMON_DELETE}"
styleClass="portlet-form-button"/>
+ <h:message for="pref-input-#{status.index}" errorClass="portlet-msg-error"/>
</td>
</tr>
</c:forEach>
@@ -84,23 +111,25 @@
<h:commandButton id="update" value="#{bundle.COMMON_UPDATE}" styleClass="portlet-form-button"/>
</td>
</tr>
- </tbody>
- </table>
- </fieldset>
- </h:form>
+ </tbody>
+ </table>
+ </fieldset>
+ </h:form>
- <h:form id="common-append-form">
- <fieldset style="border: 1px solid;">
- <legend>#{bundle.COMMON_APPEND_VALUE}</legend>
- <h:outputLabel for="new_value">
- <h:outputText value="#{bundle.COMMON_NEW_VALUE}: " styleClass="portlet-form-field-label"/>
- </h:outputLabel>
- <h:inputText id="new_value" value="#{prefs.selectedEntry.line}" styleClass="portlet-form-input-field"/>
- <h:commandButton id="append-button" action="#{prefs.selectedEntry.appendLine}" value="#{bundle.COMMON_APPEND}"
- styleClass="portlet-form-button"/>
- </fieldset>
- </h:form>
+ <h:form id="common-append-form">
+ <fieldset style="border: 1px solid;">
+ <legend>#{bundle.COMMON_APPEND_VALUE}</legend>
+ <h:outputLabel for="new_value">
+ <h:outputText value="#{bundle.COMMON_NEW_VALUE}: " styleClass="portlet-form-field-label"/>
+ </h:outputLabel>
+ <h:inputText id="new_value" value="#{prefs.selectedEntry.line}" styleClass="portlet-form-input-field"/>
+ <h:commandButton id="append-button" action="#{prefs.selectedEntry.appendLine}"
+ value="#{bundle.COMMON_APPEND}"
+ styleClass="portlet-form-button"/>
+ <h:message for="new_value" errorClass="portlet-msg-error"/>
+ </fieldset>
+ </h:form>
-</c:if>
+ </c:if>
</div>
Modified: branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -20,6 +20,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
+
package org.jboss.portal.core.identity.ui.actions;
import org.jboss.portal.core.identity.ui.UIRole;
@@ -39,10 +40,10 @@
{
String name = this.uiRole.getName();
String displayName = this.uiRole.getDisplayName();
- name = checkNameValidity(name, "create-role-form:rolename");
+ name = checkValidity(name, "create-role-form:rolename");
// check display name validity for XSS injection but check duplicate separately due to limitation to how ManagedBean works
- displayName = checkNameValidity(displayName, "create-role-form:roledisplayname", displayNameValidator);
+ displayName = checkValidity(displayName, "create-role-form:roledisplayname", displayNameValidator);
if (name != null && displayName != null)
{
Modified: branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -20,6 +20,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
+
package org.jboss.portal.core.identity.ui.actions;
import org.jboss.portal.common.text.FastURLDecoder;
@@ -73,7 +74,7 @@
log.error("Couldn't get current role " + roleDisplayName);
}
- roleDisplayName = checkNameValidity(roleDisplayName, "edit-role-link:display-name", displayNameValidator); // display names are unique as well
+ roleDisplayName = checkValidity(roleDisplayName, "edit-role-link:display-name", displayNameValidator); // display names are unique as well
if (roleDisplayName != null)
{
try
Modified: branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -128,7 +128,7 @@
// need to check that the new id is valid
if (isOldAndNewDifferent(oldId, id))
{
- id = checkNameValidity(id, "edit-cons-form:id");
+ id = checkValidity(id, "edit-cons-form:id");
if (id != null)
{
info.setId(id);
Modified: branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -170,7 +170,7 @@
public String createConsumer()
{
- selectedId = checkNameValidity(selectedId, MESSAGE_TARGET);
+ selectedId = checkValidity(selectedId, MESSAGE_TARGET);
if (selectedId != null)
{
try
Modified: branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -148,7 +148,7 @@
public void setRegistrationPolicyClassName(String className)
{
- className = checkNameValidity(className, "producer-form:registrationPolicy");
+ className = checkValidity(className, "producer-form:registrationPolicy");
if (className != null)
{
policyClassName = className;
@@ -176,7 +176,7 @@
public void setValidatorClassName(String className)
{
- className = checkNameValidity(className, "producer-form:validator");
+ className = checkValidity(className, "producer-form:validator");
if (className != null)
{
validatorClassName = className;
Modified: branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java 2009-07-21 22:22:05 UTC (rev 13577)
+++ branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java 2009-07-21 22:28:45 UTC (rev 13578)
@@ -73,31 +73,31 @@
this.beanContext = beanContext;
}
- public String checkNameValidity(String name, String targetForErrorMessage)
+ public String checkValidity(String value, String targetForErrorMessage)
{
- return checkNameValidity(name, targetForErrorMessage, validator);
+ return checkValidity(value, targetForErrorMessage, validator);
}
- public String checkNameValidity(String name, String targetForErrorMessage, PropertyValidator validator)
+ public String checkValidity(String value, String targetForErrorMessage, PropertyValidator validator)
{
ParameterValidation.throwIllegalArgExceptionIfNull(validator, "PropertyValidator");
String objectTypeName = validator.getObjectTypeName();
- if (ParameterValidation.isNullOrEmpty(name))
+ if (ParameterValidation.isNullOrEmpty(value))
{
- beanContext.createTargetedErrorMessage(targetForErrorMessage, validator.getErrorMessageKey(), name, getLocalizedType(objectTypeName));
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, validator.getErrorMessageKey(), value, getLocalizedType(objectTypeName));
return null;
}
else
{
- String original = name;
+ String original = value;
// Trim name
- name = name.trim();
+ value = value.trim();
// we got an invalid name after simple checks, fail!
- name = validator.doSimpleChecks(name);
- if (name == null)
+ value = validator.doSimpleChecks(value);
+ if (value == null)
{
beanContext.createTargetedErrorMessage(targetForErrorMessage, validator.getErrorMessageKey(), original, getLocalizedType(objectTypeName));
return null;
@@ -105,23 +105,23 @@
// "sanitize" name: if it's invalid, return null and output message
- name = ParameterValidation.sanitizeFromPatternWithHandler(name, validator.getValidationPattern(),
- validator.getValidationErrorHandler(name, targetForErrorMessage));
+ value = ParameterValidation.sanitizeFromPatternWithHandler(value, validator.getValidationPattern(),
+ validator.getValidationErrorHandler(value, targetForErrorMessage));
// we got an invalid name, fail!
- if (name == null)
+ if (value == null)
{
return null;
}
// Check for duplicate
- if (validator.checkForDuplicates() && validator.isAlreadyExisting(name))
+ if (validator.checkForDuplicates() && validator.isAlreadyExisting(value))
{
- getDuplicateErrorMessage(name, targetForErrorMessage, objectTypeName);
+ getDuplicateErrorMessage(value, targetForErrorMessage, objectTypeName);
return null;
}
- return name;
+ return value;
}
}
16 years, 9 months
JBoss Portal SVN: r13577 - in branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal: wsrp and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 18:22:05 -0400 (Tue, 21 Jul 2009)
New Revision: 13577
Modified:
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java
Log:
- JBPORTAL-2425:
+ WSRPPortletURL.create is now able to handle extra characters in an uninterpreted way to allow for concatenation
+ Adapted toString methods.
- Fixed a bug in WSRPResourceURL.dealWithSpecificParams that wasn't properly removing consumed parameters.
Modified: branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2009-07-21 22:14:43 UTC (rev 13576)
+++ branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2009-07-21 22:22:05 UTC (rev 13577)
@@ -132,6 +132,21 @@
checkInvalidURL(stillInvalid, "Should have detected missing end token", WSRPRewritingConstants.END_WSRP_REWRITE);
}
+ public void testExtraRelaxedValidation()
+ {
+ String valid = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite/helloworld.jar";
+ WSRPPortletURL url = WSRPPortletURL.create(valid);
+ assertEquals("http://localhost:8080/helloworld/helloworld.jar", url.toString());
+
+ String invalid = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite&foo=bar/helloworld.jar";
+ checkInvalidURL(invalid, "Should have detected improper position of end token", WSRPRewritingConstants.END_WSRP_REWRITE);
+
+ WSRPPortletURL.setStrict(false);
+ String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite&foo=bar/helloworld.jar";
+ url = WSRPPortletURL.create(validInRelaxedMode);
+ assertEquals("http://localhost:8080/helloworld&foo=bar/helloworld.jar", url.toString());
+ }
+
public void testExtraParameters()
{
String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
Modified: branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2009-07-21 22:14:43 UTC (rev 13576)
+++ branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2009-07-21 22:22:05 UTC (rev 13577)
@@ -65,9 +65,11 @@
private WindowState windowState;
/** Are we using strict rewriting parameters validation mode? */
- private static boolean strict = true;
+ protected static boolean strict = true;
/** Holds extra parameters if we are in relaxed validation mode */
private Map<String, String> extraParams;
+ /** Holds extra data after URL in relaxed mode */
+ protected String extra;
/** Remember position of extra parameters wrt end token */
private boolean extraParamsAfterEndToken = false;
@@ -115,6 +117,7 @@
{
WSRPPortletURL other = (WSRPPortletURL)portletURL;
url.setParams(other.extraParams, other.toString());
+ url.setExtra(other.extra);
}
return url;
@@ -131,6 +134,7 @@
String originalURL = encodedURL;
boolean extraAfterEnd = false;
+ String extra = null;
// URL needs to start wsrp_rewrite? and end with /wsrp_rewrite in strict validation mode
if (!encodedURL.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
@@ -139,25 +143,44 @@
}
if (!encodedURL.endsWith(WSRPRewritingConstants.END_WSRP_REWRITE))
{
- if (strict)
+ // first remove prefix only (as suffix is not at the end of the string)
+ encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH);
+
+ // end token should be marked by the first / in the URL and extract it
+ int endTokenIndex = encodedURL.indexOf('/');
+ if (endTokenIndex < 0)
{
- throw new IllegalArgumentException(encodedURL + " does not end with " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ throw new IllegalArgumentException(originalURL + " does not contain " + WSRPRewritingConstants.END_WSRP_REWRITE);
}
+
+ encodedURL = encodedURL.substring(0, endTokenIndex)
+ + encodedURL.substring(endTokenIndex + WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
+
+ /*
+ we need to deal with the case when a WSRP URL is concatenated to a context path using something similar to:
+ renderResponse.encodeURL(renderRequest.getContextPath()) in which case, there should be a slash still present.
+ How to process further depends on whether we're in strict mode or not...
+ */
+ int concatenationIndex = encodedURL.indexOf('/');
+
+ if (strict && concatenationIndex != endTokenIndex)
+ {
+ // in strict mode, the only character available after the end token is the concatenating slash
+ throw new IllegalArgumentException(encodedURL + " does not end with "
+ + WSRPRewritingConstants.END_WSRP_REWRITE + " or does not appear to be a valid concatenation of URLs.");
+ }
else
{
- // first remove prefix only (as suffix is not at the end of the string)
- encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH);
-
- // find end token and extract it
- int endTokenIndex = encodedURL.indexOf('/');
- if (endTokenIndex < 0)
+ // deal with extra characters: this should only happen when the URL is concatenated to form a longer one
+ // hence, it should be possible to have param-value pairs followed by a slash '/' then characters.
+ // Anything after the slash will be kept as is, uninterpreted.
+ if (concatenationIndex != -1)
{
- throw new IllegalArgumentException(originalURL + " does not contain " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ String tmp = encodedURL;
+ encodedURL = encodedURL.substring(0, concatenationIndex);
+ extra = tmp.substring(concatenationIndex);
}
- encodedURL = encodedURL.substring(0, endTokenIndex)
- + encodedURL.substring(endTokenIndex + WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
-
// remember that we should position the extra params after the end token
extraAfterEnd = true;
}
@@ -228,6 +251,7 @@
url.setParams(params, originalURL);
url.setExtraParamsAfterEndToken(extraAfterEnd);
+ url.setExtra(extra);
return url;
}
@@ -379,10 +403,7 @@
if (extraParams != null && !extraParams.isEmpty())
{
extras = new StringBuffer();
- for (Map.Entry<String, String> entry : extraParams.entrySet())
- {
- createURLParameter(extras, entry.getKey(), entry.getValue());
- }
+ appendExtraParams(extras);
}
// if we had extra params, we need to figure out where thwy should be positioned wrt end token
@@ -392,6 +413,10 @@
{
sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
sb.append(extras);
+ if (extra != null)
+ {
+ sb.append(extra);
+ }
}
else
{
@@ -403,6 +428,17 @@
return sb.toString();
}
+ protected void appendExtraParams(StringBuffer buffer)
+ {
+ if (extraParams != null)
+ {
+ for (Map.Entry<String, String> entry : extraParams.entrySet())
+ {
+ createURLParameter(buffer, entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
protected abstract void appendEnd(StringBuffer sb);
protected final void createURLParameter(StringBuffer sb, String name, String value)
@@ -522,4 +558,9 @@
{
this.extraParamsAfterEndToken = extraParamsAfterEndToken;
}
+
+ public void setExtra(String extra)
+ {
+ this.extra = extra;
+ }
}
Modified: branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java 2009-07-21 22:14:43 UTC (rev 13576)
+++ branches/Enterprise_Portal_Platform_4_3/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java 2009-07-21 22:22:05 UTC (rev 13577)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -104,11 +104,12 @@
if (paramValue != null)
{
requiresRewrite = Boolean.valueOf(paramValue);
+ params.remove(WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE);
}
else
{
throw new IllegalArgumentException("The parsed parameters don't contain a value for the required "
- + WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE + " parameter in " + originalURL);
+ + WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE + " parameter in " + originalURL);
}
paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.RESOURCE_URL);
@@ -135,10 +136,11 @@
catch (MimeTypeParseException e)
{
log.debug("Couldn't determine (based on extension) MIME type of file: " + file
- + "\nRetrieving the associated resource will probably fail.");
+ + "\nRetrieving the associated resource will probably fail.");
}
isSupported(mediaType);
+ params.remove(WSRPRewritingConstants.RESOURCE_URL);
}
catch (MalformedURLException e)
{
@@ -148,7 +150,7 @@
else
{
throw new IllegalArgumentException("The parsed parameters don't contain a value for the required "
- + WSRPRewritingConstants.RESOURCE_URL + " parameter in " + originalURL);
+ + WSRPRewritingConstants.RESOURCE_URL + " parameter in " + originalURL);
}
}
@@ -161,7 +163,7 @@
if (!type.isAllowedSubType(mediaType))
{
log.debug("MIME type '" + mediaType
- + "' is not currently supported. Retrieving the associated resource will probably fail.");
+ + "' is not currently supported. Retrieving the associated resource will probably fail.");
return;
}
}
@@ -171,6 +173,16 @@
public String toString()
{
- return resourceURL.toExternalForm();
+ StringBuffer result = new StringBuffer(resourceURL.toExternalForm());
+
+ appendExtraParams(result);
+
+ // append extra characters if we have some
+ if (extra != null)
+ {
+ result.append(extra);
+ }
+
+ return result.toString();
}
}
16 years, 9 months
JBoss Portal SVN: r13576 - in branches/Enterprise_Portal_Platform_4_3/core-cms/src: resources/portal-cms-war/WEB-INF/classes and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 18:14:43 -0400 (Tue, 21 Jul 2009)
New Revision: 13576
Modified:
branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties
Log:
- JBPORTAL-2417: hopefully fixed the incorrect saving of invalid data.
Modified: branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-07-21 22:08:34 UTC (rev 13575)
+++ branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-07-21 22:14:43 UTC (rev 13576)
@@ -920,7 +920,7 @@
String sFolderName = aReq.getParameter("newcollectionname");
String sFolderDescription = aReq.getParameter("newcollectiondescription");
sFolderDescription = ParameterValidation.sanitizeFromPattern(sFolderDescription, CHECK_FOR_XSS_PATTERN, "");
-
+
if (!"".equals(sCreatePath) && !"".equals(sFolderName) && !"".equals(sFolderDescription))
{
String sNewPath = FileUtil.cleanDoubleSlashes(sCreatePath + SLASH + sFolderName);
@@ -1518,21 +1518,17 @@
sLanguage = ParameterValidation.sanitizeFromPattern(sLanguage, CHECK_FOR_XSS_PATTERN, INVALID_LANG);
boolean invalidLang = INVALID_LANG.equals(sLanguage);
- if (invalidLang)
-
+ if (invalidTitle || invalidDesc || invalidLang)
{
- if (invalidTitle || invalidDesc || invalidLang)
- {
- aRes.setRenderParameter("op", CMSAdminConstants.OP_EDIT);
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_EDIT);
- // output error message
- aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_INVALID_PARAMETER);
+ // output error message
+ aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_INVALID_PARAMETER);
- aRes.setRenderParameter("path", aReq.getParameter("savetopath"));
- aRes.setRenderParameter("language", aReq.getParameter("language"));
+ aRes.setRenderParameter("path", aReq.getParameter("savetopath"));
+ aRes.setRenderParameter("language", aReq.getParameter("language"));
- return;
- }
+ return;
}
Locale locale = new Locale(sLanguage);
Modified: branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2009-07-21 22:08:34 UTC (rev 13575)
+++ branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2009-07-21 22:14:43 UTC (rev 13576)
@@ -1,6 +1,6 @@
################################################################################
# JBoss, a division of Red Hat #
-# Copyright 2006, Red Hat Middleware, LLC, and individual #
+# Copyright 2009, Red Hat Middleware, LLC, and individual #
# contributors as indicated by the @authors tag. See the #
# copyright.txt in the distribution for a full listing of #
# individual contributors. #
@@ -143,7 +143,7 @@
CMS_FILENAME_INVALID=File Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '>', ,'<', '(', ')', '|' or any whitespace character.
CMS_FOLDERNAME_INVALID=Folder Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '>', ,'<', '(', ')', '|' or any whitespace character.
-CMS_INVALID_PARAMETER=A value below is invalid. It may not contain illegal characters such as '\\', '<', '>', '(', ')', '=' or '%5c'.
+CMS_INVALID_PARAMETER=A value below was invalid. It may not contain illegal characters such as '\\', '<', '>', '(', ')', '=' or '%5c'.
CMS_MSG_DESTINATION_ALREADY_EXISTS=The command was not performed, because the destination already exists.
CMS_CANT_MOVE_SAME_DESTINATION=You cannot move a folder to the same location
Modified: branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties 2009-07-21 22:08:34 UTC (rev 13575)
+++ branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties 2009-07-21 22:14:43 UTC (rev 13576)
@@ -1,7 +1,6 @@
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
################################################################################
# JBoss, a division of Red Hat #
-# Copyright 2006, Red Hat Middleware, LLC, and individual #
+# Copyright 2009, Red Hat Middleware, LLC, and individual #
# contributors as indicated by the @authors tag. See the #
# copyright.txt in the distribution for a full listing of #
# individual contributors. #
@@ -160,4 +159,4 @@
CMS_MISSING_DOCUMENT=404 - Page non trouv\u00e9e
CMS_MISSING_DOCUMENT_DESCRIPTION=Le document auquel vous avez tent\u00e9 d'acc\u00e9der est introuvable
-CMS_INVALID_PARAMETER=Une valeur ci-dessous est invalide car elle contient des caract\u00e8rs invalides '\\', '<', '>', '(', ')', '=' ou '%5c'.
\ No newline at end of file
+CMS_INVALID_PARAMETER=Une valeur ci-dessous \u00e9tait invalide car elle contenait des caract\u00e8rs invalides '\\', '<', '>', '(', ')', '=' ou '%5c'.
\ No newline at end of file
16 years, 9 months
JBoss Portal SVN: r13575 - in branches/Enterprise_Portal_Platform_4_3: core-admin/src/resources/portal-admin-war/WEB-INF/classes and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 18:08:34 -0400 (Tue, 21 Jul 2009)
New Revision: 13575
Modified:
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java
branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java
branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java
Log:
- Use bean context to output messages in PortalObjectManagerBean, improving localization.
- Made getErrorSeverity, getInfoSeverity and createLocalizedMessage methods public on BeanContext.
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2009-07-21 22:02:59 UTC (rev 13574)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2009-07-21 22:08:34 UTC (rev 13575)
@@ -58,7 +58,6 @@
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.ThemeService;
-import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
@@ -128,9 +127,6 @@
private String selectedContentURI;
/** . */
-// private Map selectedContentParameters = new HashMap();
-
- /** . */
private Map<String, String[]> renderParameters;
// Runtime state
@@ -340,16 +336,6 @@
this.renderParameters = renderParameters;
}
- /*public Map getSelectedContentParameters()
- {
- return selectedContentParameters;
- }
-
- public void setSelectedContentParameters(Map selectedContentParameters)
- {
- this.selectedContentParameters = selectedContentParameters;
- }*/
-
public DomainConfigurator getDomainConfigurator()
{
return domainConfigurator;
@@ -480,10 +466,7 @@
String name = object.getName();
parent.setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, name);
-
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Success",
- "'" + name + "' " + typeName + " was successfully set as default " + typeName);
- FacesContext.getCurrentInstance().addMessage("status", message);
+ beanContext.createLocalizedMessage(BeanContext.STATUS, "MAKE_DEFAULT_SUCCESS", beanContext.getInfoSeverity(), name, typeName);
}
}
@@ -619,22 +602,17 @@
{
selectObject(object.getParent());
- String stringMessage = object.getName() + " has successfully been destroyed";
+ String name = object.getName();
- //
- object.getParent().destroyChild(object.getName());
+ object.getParent().destroyChild(name);
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, stringMessage, stringMessage);
- FacesContext.getCurrentInstance().addMessage("status", message);
+ beanContext.createLocalizedMessage(BeanContext.STATUS, "DESTROY_SUCCESS", beanContext.getInfoSeverity(), name);
selectedDeletingObject = null;
}
else
{
- String stringMessage = "Cannot delete this already deleted object";
-
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, stringMessage, stringMessage);
- FacesContext.getCurrentInstance().addMessage("status", message);
+ beanContext.createLocalizedMessage(BeanContext.STATUS, "DESTROY_FAILURE", beanContext.getInfoSeverity(), id);
}
}
}
@@ -784,9 +762,7 @@
public String submit()
{
- String stringMessage = "Security has been correctly updated on the page";
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, stringMessage, stringMessage);
- FacesContext.getCurrentInstance().addMessage("status", message);
+ beanContext.createInfoMessage("SECURITY_UPDATED");
//
return "objects";
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2009-07-21 22:02:59 UTC (rev 13574)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2009-07-21 22:08:34 UTC (rev 13575)
@@ -340,3 +340,8 @@
PROPERTY_TYPE=property
PORTAL_OBJECT_TYPE=portal object
WINDOW_TYPE=window
+
+MAKE_DEFAULT_SUCCESS= ''{0}'' {1} was successfully set as default {1}
+DESTROY_SUCCESS=''{0}'' has successfully been destroyed
+DESTROY_FAILURE=Couldn''t delete inexisting object with id ''{0}''
+SECURITY_UPDATED=Security has been correctly updated on the page
Modified: branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java 2009-07-21 22:02:59 UTC (rev 13574)
+++ branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java 2009-07-21 22:08:34 UTC (rev 13575)
@@ -85,12 +85,12 @@
// ignore for tests
}
- protected Object getErrorSeverity()
+ public Object getErrorSeverity()
{
return null;
}
- protected Object getInfoSeverity()
+ public Object getInfoSeverity()
{
return null;
}
Modified: branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java 2009-07-21 22:02:59 UTC (rev 13574)
+++ branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java 2009-07-21 22:08:34 UTC (rev 13575)
@@ -74,9 +74,9 @@
*/
protected abstract void createMessage(String target, String message, Object severity);
- protected abstract Object getErrorSeverity();
+ public abstract Object getErrorSeverity();
- protected abstract Object getInfoSeverity();
+ public abstract Object getInfoSeverity();
protected abstract Locale getLocale();
@@ -99,7 +99,7 @@
* @param severity an object representing the severity of the message (typically FacesMessage.Severity)
* @param params additional parameters to be passed to replace tokens in localized strings
*/
- protected void createLocalizedMessage(String target, String localizedMessageId, Object severity, Object... params)
+ public void createLocalizedMessage(String target, String localizedMessageId, Object severity, Object... params)
{
createMessage(target, getMessageFromBundle(localizedMessageId, params), severity);
}
Modified: branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-07-21 22:02:59 UTC (rev 13574)
+++ branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-07-21 22:08:34 UTC (rev 13575)
@@ -85,7 +85,7 @@
// Get the component id from the target
FacesContext facesContext = FacesContext.getCurrentInstance();
target = resolveTargetId(target, facesContext);
- if(target == null)
+ if (target == null)
{
// if we couldn't find the component, default to STATUS
log.info("Couldn't resolve component target: " + target + ". Using '" + STATUS + "' instead.");
@@ -120,20 +120,20 @@
public static void outputLocalizedMessage(String target, String localizationKey, Object severity, String resourceName, Object... params)
{
- if(severity == null)
+ if (severity == null)
{
severity = FacesMessage.SEVERITY_ERROR;
}
-
+
outputMessage(target, getLocalizedMessage(localizationKey, getRequestLocale(), resourceName, params), severity);
}
- protected Object getErrorSeverity()
+ public Object getErrorSeverity()
{
return FacesMessage.SEVERITY_ERROR;
}
- protected Object getInfoSeverity()
+ public Object getInfoSeverity()
{
return FacesMessage.SEVERITY_INFO;
}
16 years, 9 months
JBoss Portal SVN: r13574 - in branches/Enterprise_Portal_Platform_4_3: core-admin/src/resources/portal-admin-war/jsf and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 18:02:59 -0400 (Tue, 21 Jul 2009)
New Revision: 13574
Modified:
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java
branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/jsf/displayNameObject.xhtml
branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java
branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java
branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java
Log:
- Added isTargetResolved to BeanContext to be able to check that a given target String can be used to display error message.
- JBPORTAL-2419:
+ DisplayNameAction now switches the error target as it varies on context (defaults to status if cannot be resolved)
+ Added missing message in displayNameObject.xhtml
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java 2009-07-21 21:58:46 UTC (rev 13573)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/DisplayNameAction.java 2009-07-21 22:02:59 UTC (rev 13574)
@@ -29,6 +29,7 @@
import org.jboss.portal.core.admin.ui.DisplayNameBean;
import org.jboss.portal.core.model.HasDisplayName;
import org.jboss.portal.faces.gui.ManagedBean;
+import org.jboss.portal.faces.gui.BeanContext;
import java.util.Collection;
import java.util.HashMap;
@@ -49,6 +50,8 @@
protected DisplayNameBean displayNameBean;
protected HasDisplayName target;
protected static final String DISPLAY_NAME_TYPE = "DISPLAY_NAME_TYPE";
+ private static final String DISPLAY_NAME_DIRECT = "display-name-form:newName";
+ private static final String DISPLAY_NAME_IN_VIEW = "display-names-view:add-display-name-form:newName";
public Object getManagerBean()
{
@@ -102,7 +105,24 @@
public void addDisplayName() throws ConversionException
{
- newText = checkNameValidity(newText, "display-names-view:add-display-name-form:newName");
+ String errorMessageTarget;
+ boolean directResolved = beanContext.isTargetResolved(DISPLAY_NAME_DIRECT);
+ boolean inViewResolved = beanContext.isTargetResolved(DISPLAY_NAME_IN_VIEW);
+
+ if(directResolved)
+ {
+ errorMessageTarget = DISPLAY_NAME_DIRECT;
+ }
+ else if (inViewResolved)
+ {
+ errorMessageTarget = DISPLAY_NAME_IN_VIEW;
+ }
+ else
+ {
+ errorMessageTarget = BeanContext.STATUS;
+ }
+
+ newText = checkNameValidity(newText, errorMessageTarget);
if (newText != null)
{
HasDisplayName hasDisplayName = getTarget();
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/jsf/displayNameObject.xhtml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/jsf/displayNameObject.xhtml 2009-07-21 21:58:46 UTC (rev 13573)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/resources/portal-admin-war/jsf/displayNameObject.xhtml 2009-07-21 22:02:59 UTC (rev 13574)
@@ -20,6 +20,7 @@
</h:selectOneMenu>
<h:commandButton id="add-display" value="#{addDisplayNameAction.newText ne null ? 'Modify' : 'Add'} Name" action="#{addDisplayNameAction.addDisplayName}"
styleClass="portlet-form-button"/>
+ <h:message for="newName" errorClass="portlet-msg-error"/>
</div>
</h:form>
</div>
Modified: branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java 2009-07-21 21:58:46 UTC (rev 13573)
+++ branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerBeanTestCase.java 2009-07-21 22:02:59 UTC (rev 13574)
@@ -104,5 +104,11 @@
{
throw new NotYetImplemented();
}
+
+ @Override
+ public boolean isTargetResolved(String target)
+ {
+ throw new NotYetImplemented();
+ }
}
}
Modified: branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java 2009-07-21 21:58:46 UTC (rev 13573)
+++ branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java 2009-07-21 22:02:59 UTC (rev 13574)
@@ -284,4 +284,6 @@
return expectedClass.cast(result);
}
+
+ public abstract boolean isTargetResolved(String target);
}
Modified: branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-07-21 21:58:46 UTC (rev 13573)
+++ branches/Enterprise_Portal_Platform_4_3/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-07-21 22:02:59 UTC (rev 13574)
@@ -84,6 +84,20 @@
// Get the component id from the target
FacesContext facesContext = FacesContext.getCurrentInstance();
+ target = resolveTargetId(target, facesContext);
+ if(target == null)
+ {
+ // if we couldn't find the component, default to STATUS
+ log.info("Couldn't resolve component target: " + target + ". Using '" + STATUS + "' instead.");
+ target = STATUS;
+ }
+
+ FacesMessage msg = new FacesMessage(jsfSeverity, message, message);
+ facesContext.addMessage(target, msg);
+ }
+
+ protected static String resolveTargetId(String target, FacesContext facesContext)
+ {
UIViewRoot viewRoot = facesContext.getViewRoot();
UIComponent component = viewRoot.findComponent(target);
if (component != null)
@@ -92,12 +106,16 @@
}
else
{
- // todo: do something better here
- log.info("Couldn't resolve component target: " + target);
+ target = null;
}
+ return target;
+ }
- FacesMessage msg = new FacesMessage(jsfSeverity, message, message);
- facesContext.addMessage(target, msg);
+ @Override
+ public boolean isTargetResolved(String target)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return resolveTargetId(target, facesContext) != null;
}
public static void outputLocalizedMessage(String target, String localizationKey, Object severity, String resourceName, Object... params)
16 years, 9 months
JBoss Portal SVN: r13573 - in branches/Enterprise_Portal_Platform_4_3/core-cms/src: resources/portal-cms-war/WEB-INF/jsp/cms/admin and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 17:58:46 -0400 (Tue, 21 Jul 2009)
New Revision: 13573
Modified:
branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp
Log:
- JBPORTAL-2416: validate folder description and output correct error message.
Modified: branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-07-21 21:54:36 UTC (rev 13572)
+++ branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-07-21 21:58:46 UTC (rev 13573)
@@ -919,7 +919,9 @@
String sCreatePath = aReq.getParameter("destination");
String sFolderName = aReq.getParameter("newcollectionname");
String sFolderDescription = aReq.getParameter("newcollectiondescription");
- if (!"".equals(sCreatePath) && !"".equals(sFolderName))
+ sFolderDescription = ParameterValidation.sanitizeFromPattern(sFolderDescription, CHECK_FOR_XSS_PATTERN, "");
+
+ if (!"".equals(sCreatePath) && !"".equals(sFolderName) && !"".equals(sFolderDescription))
{
String sNewPath = FileUtil.cleanDoubleSlashes(sCreatePath + SLASH + sFolderName);
@@ -968,7 +970,7 @@
aRes.setRenderParameter("path", aReq.getParameter("destination"));
//used to remember the data already submitted by the user
- aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_FOLDERNAME_INVALID);
+ aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_INVALID_PARAMETER);
aRes.setRenderParameter("error:newcollectionname", aReq.getParameter("newcollectionname"));
aRes.setRenderParameter("error:newcollectiondescription", aReq.getParameter("newcollectiondescription"));
}
Modified: branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp 2009-07-21 21:54:36 UTC (rev 13572)
+++ branches/Enterprise_Portal_Platform_4_3/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp 2009-07-21 21:58:46 UTC (rev 13573)
@@ -1,3 +1,4 @@
+<%@ page import="org.jboss.portal.core.cms.CMSConstants" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
@@ -27,15 +28,32 @@
<h3 class="sectionTitle-blue">${n:i18n("TITLE_CREATECOLLCONFIRM")}</h3>
<div class=" cms-tab-container">
<table width="100%">
- <%if(errorMessage != null){%>
- <tr>
- <td colspan="2">
- <font color="red">${n:i18n("CMS_FOLDERNAME_INVALID")}</font>
- </td>
- </tr>
- <%}%>
-
+ <%
+ if (CMSAdminConstants.CMS_FOLDERNAME_INVALID.equals(errorMessage))
+ {
+ %>
<tr>
+ <td colspan="2">
+ <span style="color: red">${n:i18n("CMS_FOLDERNAME_INVALID")}</span>
+ </td>
+ </tr>
+ <%
+ }
+ %>
+ <%
+ if (CMSAdminConstants.CMS_INVALID_PARAMETER.equals(errorMessage))
+ {
+ %>
+ <tr>
+ <td colspan="2">
+ <span style="color: red">${n:i18n("CMS_INVALID_PARAMETER")}</span>
+ </td>
+ </tr>
+ <%
+ }
+ %>
+
+ <tr>
<td valign="top" width="250" class="portlet-section-alternate">
<%@ include file="folderlist.jsp" %>
</td>
16 years, 9 months
JBoss Portal SVN: r13572 - branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 17:54:36 -0400 (Tue, 21 Jul 2009)
New Revision: 13572
Modified:
branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
Log:
- JBPORTAL-2415: properly handle the empty search string (it really should be done at the search level though).
Modified: branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-07-21 21:52:12 UTC (rev 13571)
+++ branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-07-21 21:54:36 UTC (rev 13572)
@@ -82,6 +82,7 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
@@ -439,26 +440,27 @@
rRes.setContentType("text/html");
String textQuery = rReq.getParameter("search");
- FederatedQuery query = new FederatedQuery(textQuery);
+ List files = Collections.emptyList();
+ if (!ParameterValidation.isNullOrEmpty(textQuery))
+ {
+ FederatedQuery query = new FederatedQuery(textQuery);
- JCRQueryConverter converter = new JCRQueryConverter();
+ JCRQueryConverter converter = new JCRQueryConverter();
- List files;
- try
- {
- Command searchCommand = CMSService.getCommandFactory().createSearchCommand((JCRQuery)converter.convert(query));
- files = (List)CMSService.execute(searchCommand);
+ try
+ {
+ Command searchCommand = CMSService.getCommandFactory().createSearchCommand((JCRQuery)converter.convert(query));
+ files = (List)CMSService.execute(searchCommand);
+ }
+ catch (CMSException e)
+ {
+ e.printStackTrace();
+ }
+ catch (QueryConversionException e)
+ {
+ rReq.setAttribute("conversionError", Boolean.TRUE);
+ }
}
- catch (CMSException e)
- {
- e.printStackTrace();
- files = new ArrayList();
- }
- catch (QueryConversionException e)
- {
- files = new ArrayList();
- rReq.setAttribute("conversionError", Boolean.TRUE);
- }
rReq.setAttribute("files", files);
rReq.setAttribute("textQuery", textQuery);
@@ -1508,25 +1510,27 @@
// check title and description for XSS injection... If one found, re-display page with old values
sTitle = ParameterValidation.sanitizeFromPattern(sTitle, CHECK_FOR_XSS_PATTERN, INVALID_TITLE);
boolean invalidTitle = INVALID_TITLE.equals(sTitle);
-
+
sDescription = ParameterValidation.sanitizeFromPattern(sDescription, CHECK_FOR_XSS_PATTERN, INVALID_DESCRIPTION);
boolean invalidDesc = INVALID_DESCRIPTION.equals(sDescription);
sLanguage = ParameterValidation.sanitizeFromPattern(sLanguage, CHECK_FOR_XSS_PATTERN, INVALID_LANG);
boolean invalidLang = INVALID_LANG.equals(sLanguage);
- if(invalidLang)
+ if (invalidLang)
- if (invalidTitle || invalidDesc || invalidLang)
{
- aRes.setRenderParameter("op", CMSAdminConstants.OP_EDIT);
+ if (invalidTitle || invalidDesc || invalidLang)
+ {
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_EDIT);
- // output error message
- aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_INVALID_PARAMETER);
+ // output error message
+ aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_INVALID_PARAMETER);
- aRes.setRenderParameter("path", aReq.getParameter("savetopath"));
- aRes.setRenderParameter("language", aReq.getParameter("language"));
+ aRes.setRenderParameter("path", aReq.getParameter("savetopath"));
+ aRes.setRenderParameter("language", aReq.getParameter("language"));
- return;
+ return;
+ }
}
Locale locale = new Locale(sLanguage);
16 years, 9 months
JBoss Portal SVN: r13571 - branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 17:52:12 -0400 (Tue, 21 Jul 2009)
New Revision: 13571
Modified:
branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
Log:
- JBPORTAL-2410: report error instead of saving configuration with old values (which is correct but confusing for users).
Modified: branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2009-07-21 21:48:49 UTC (rev 13570)
+++ branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2009-07-21 21:52:12 UTC (rev 13571)
@@ -55,9 +55,12 @@
private static final String PROPERTY = "property";
private static final String PRODUCER = "producer";
private String selectedProp;
+ private boolean invalidPolicy;
+ private boolean invalidValidator;
// todo: use ParameterValidation.VALID_ASCII_CLASS_NAME when available...
public final static Pattern VALID_ASCII_CLASS_NAME = Pattern.compile("([a-z][a-z0-9_]*\\.)*[A-Z][A-Za-z0-9_$]*");
+ private static final String INVALID_CLASS_NAME_ERROR = "INVALID_CLASS_NAME_ERROR";
public ProducerBean()
{
@@ -84,7 +87,7 @@
@Override
public String getErrorMessageKey()
{
- return "INVALID_CLASS_NAME_ERROR";
+ return INVALID_CLASS_NAME_ERROR;
}
});
@@ -149,7 +152,12 @@
if (className != null)
{
policyClassName = className;
+ invalidPolicy = false;
}
+ else
+ {
+ invalidPolicy = true;
+ }
}
public boolean isDefaultRegistrationPolicy()
@@ -172,7 +180,12 @@
if (className != null)
{
validatorClassName = className;
+ invalidValidator = false;
}
+ else
+ {
+ invalidValidator = true;
+ }
}
public boolean isStrictMode()
@@ -215,12 +228,19 @@
{
try
{
- if (!ProducerRegistrationRequirements.DEFAULT_POLICY_CLASS_NAME.equals(policyClassName))
+ if (!invalidPolicy && !invalidValidator)
{
- getRegRequirements().reloadPolicyFrom(policyClassName, validatorClassName);
+ if (!ProducerRegistrationRequirements.DEFAULT_POLICY_CLASS_NAME.equals(policyClassName))
+ {
+ getRegRequirements().reloadPolicyFrom(policyClassName, validatorClassName);
+ }
+ configurationService.saveConfiguration();
+ beanContext.createInfoMessage("bean_producer_save_success");
}
- configurationService.saveConfiguration();
- beanContext.createInfoMessage("bean_producer_save_success");
+ else
+ {
+ beanContext.createErrorMessage("bean_producer_cannot_save", "Invalid class name.");
+ }
}
catch (Exception e)
{
16 years, 9 months
JBoss Portal SVN: r13570 - branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 17:48:49 -0400 (Tue, 21 Jul 2009)
New Revision: 13570
Modified:
branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java
Log:
- JBPORTAL-2413: Fixed issue with predefined properties. Values should also be properly validated now.
Modified: branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java 2009-07-21 21:44:32 UTC (rev 13569)
+++ branches/Enterprise_Portal_Platform_4_3/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/PropertyAction.java 2009-07-21 21:48:49 UTC (rev 13570)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.admin.ui.actions;
+import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.core.admin.ui.PortalObjectManagerBean;
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
import org.jboss.portal.faces.gui.ManagedBean;
@@ -51,6 +52,14 @@
public PropertyAction(PortalObjectManagerBean pomgr)
{
this.pomgr = pomgr;
+ setValidator(new DefaultPropertyValidator()
+ {
+ @Override
+ public String doSimpleChecks(String name)
+ {
+ return name.indexOf('/') != -1 ? null : name;
+ }
+ });
}
public String getSelectedProperty()
@@ -85,14 +94,21 @@
public void updateProperty()
{
- String propertyName = checkNameValidity(otherPropertyName, "common-edit-prop-form:property");
- if (propertyName != null)
+ String propertyName = null;
+ if (!ParameterValidation.isNullOrEmpty(otherPropertyName))
{
- if (propertyName.length() == 0 && selectedProperty != null)
+ propertyName = checkNameValidity(otherPropertyName, "common-edit-prop-form:property");
+ }
+ else
+ {
+ if (selectedProperty != null)
{
propertyName = selectedProperty.trim();
}
+ }
+ if (propertyName != null)
+ {
if (propertyName.length() > 0)
{
String value = "";
16 years, 9 months
JBoss Portal SVN: r13569 - branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-07-21 17:44:32 -0400 (Tue, 21 Jul 2009)
New Revision: 13569
Modified:
branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
Log:
- JBPORTAL-2410: fixed error reporting.
Modified: branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2009-07-21 21:42:00 UTC (rev 13568)
+++ branches/Enterprise_Portal_Platform_4_3/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2009-07-21 21:44:32 UTC (rev 13569)
@@ -28,6 +28,7 @@
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
+import org.jboss.portal.wsrp.consumer.RefreshResult;
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import org.jboss.portal.wsrp.consumer.RegistrationProperty;
@@ -427,7 +428,11 @@
// if the registration is locally modified, bypass the refresh as it will not yield a proper result
if (!isRegistrationLocallyModified())
{
- manager.refresh(consumer);
+ RefreshResult refreshResult = manager.refresh(consumer);
+ if (refreshResult == null)
+ {
+ return null;
+ }
}
else
{
16 years, 9 months