JBoss Portal SVN: r7408 - trunk/common/src/main/org/jboss/portal/common/net.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-12 19:09:01 -0400 (Tue, 12 Jun 2007)
New Revision: 7408
Modified:
trunk/common/src/main/org/jboss/portal/common/net/URLTools.java
Log:
- Added default value for port.
- Added logging.
Modified: trunk/common/src/main/org/jboss/portal/common/net/URLTools.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/net/URLTools.java 2007-06-12 22:35:10 UTC (rev 7407)
+++ trunk/common/src/main/org/jboss/portal/common/net/URLTools.java 2007-06-12 23:09:01 UTC (rev 7408)
@@ -25,6 +25,7 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.logging.Logger;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.util.ParameterValidation;
@@ -58,10 +59,13 @@
public static final int PROXY_PORT;
public static final String PROXY_HOST;
+ private static final Logger log = Logger.getLogger(URLTools.class);
+
static
{
PROXY_HOST = System.getProperty("http.proxyHost");
- PROXY_PORT = Integer.parseInt(System.getProperty("http.proxyPort"));
+ PROXY_PORT = Integer.parseInt(System.getProperty("http.proxyPort", "-1"));
+ log.debug("Proxy settings: host='" + PROXY_HOST + "', port='" + PROXY_PORT + "'");
}
public static boolean isURLAbsolute(String url)
18 years, 10 months
JBoss Portal SVN: r7407 - trunk/common/src/main/org/jboss/portal/common/net.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-12 18:35:10 -0400 (Tue, 12 Jun 2007)
New Revision: 7407
Modified:
trunk/common/src/main/org/jboss/portal/common/net/URLTools.java
Log:
- Added support for proxy in performGET. NOT TESTED!
Modified: trunk/common/src/main/org/jboss/portal/common/net/URLTools.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/net/URLTools.java 2007-06-12 09:59:57 UTC (rev 7406)
+++ trunk/common/src/main/org/jboss/portal/common/net/URLTools.java 2007-06-12 22:35:10 UTC (rev 7407)
@@ -28,8 +28,8 @@
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.util.ParameterValidation;
+import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
@@ -55,19 +55,27 @@
public static final String FTP_PREFIX = "ftp://";
public static final String FILE_PREFIX = "/";
+ public static final int PROXY_PORT;
+ public static final String PROXY_HOST;
+
+ static
+ {
+ PROXY_HOST = System.getProperty("http.proxyHost");
+ PROXY_PORT = Integer.parseInt(System.getProperty("http.proxyPort"));
+ }
+
public static boolean isURLAbsolute(String url)
{
return isNetworkURL(url) || url.startsWith(FILE_PREFIX);
}
/**
- * Fetches content from an HTTP server performing a GET operation. If the status code is 200
- * then it will return a byte array of the body otherwise returns null. The timeout values
- * must not be negative integers, when it is equals to zero it means that it does not setup
- * a timeout and use the default values.
+ * Fetches content from an HTTP server performing a GET operation. If the status code is 200 then it will return a
+ * byte array of the body otherwise returns null. The timeout values must not be negative integers, when it is equals
+ * to zero it means that it does not setup a timeout and use the default values.
*
- * @param url the URL the URL of the resource
- * @param soTimeoutMillis the socket connection timeout in millis
+ * @param url the URL the URL of the resource
+ * @param soTimeoutMillis the socket connection timeout in millis
* @param connTimeoutMillis the connection timeout in millis
* @return
*/
@@ -89,6 +97,8 @@
{
HttpClient client = new HttpClient();
+ client.getHostConfiguration().setProxy(PROXY_HOST, PROXY_PORT);
+
// Yes deprecated but advocated way to do will not for with 2.0.2 which is what today JBoss AS ships
if (connTimeoutMillis > 0)
{
@@ -104,6 +114,7 @@
try
{
method = new GetMethod(url.toString());
+ method.setFollowRedirects(true);
int statusCode = client.executeMethod(method);
if (statusCode == 200)
{
18 years, 10 months
JBoss Portal SVN: r7406 - trunk/core/src/main/org/jboss/portal/core/model.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-12 05:59:57 -0400 (Tue, 12 Jun 2007)
New Revision: 7406
Modified:
trunk/core/src/main/org/jboss/portal/core/model/CustomizationManager.java
Log:
minor javadoc
Modified: trunk/core/src/main/org/jboss/portal/core/model/CustomizationManager.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/CustomizationManager.java 2007-06-12 04:52:45 UTC (rev 7405)
+++ trunk/core/src/main/org/jboss/portal/core/model/CustomizationManager.java 2007-06-12 09:59:57 UTC (rev 7406)
@@ -37,7 +37,7 @@
public interface CustomizationManager
{
/**
- * Return a top level named portlet instance.
+ * Returns a top level named portlet instance.
*
* @param window the window of the portlet instance
* @return the target instance or null if it cannot be found
@@ -46,7 +46,7 @@
Instance getInstance(Window window) throws IllegalArgumentException;
/**
- * Return a contextualized portlet instance for the specified user id. If the window is in the context
+ * Returns a contextualized portlet instance for the specified user id. If the window is in the context
* of a dashboard then the portlet instance is further customized for that specific window.
*
* @param window the window of the portlet instance
@@ -66,7 +66,7 @@
Portal getDashboard(User user) throws IllegalArgumentException;
/**
- * Return true if the portal object is in a dashboard context for the specified user.
+ * Returns true if the portal object is in a dashboard context for the specified user.
*
* @param object
* @return
@@ -74,6 +74,8 @@
boolean isDashboard(PortalObject object, User user);
/**
+ * Destroys the dashboard of a specified user.
+ *
* @param userId
*/
void destroyDashboard(String userId);
18 years, 10 months
JBoss Portal SVN: r7405 - in trunk/wsrp/src/main/org/jboss/portal/test/wsrp: v1/consumer and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-12 00:52:45 -0400 (Tue, 12 Jun 2007)
New Revision: 7405
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
Log:
- Started fixing failing WSRP tests:
+ Started cleaning up TestWSRPProducerImpl to have a correct implementation of initCookie (still need to properly hook to JBoss WS).
+ Fixed incorrect assumption in testSessionHandling: a Cookie is not necessarily set by all producers when a session is created on the producer.
+ Cleaned up testInitCookie (still failing).
+ Removed TestWSRPProducer.setResponse as it's not used anymore.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2007-06-11 23:13:08 UTC (rev 7404)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducer.java 2007-06-12 04:52:45 UTC (rev 7405)
@@ -25,8 +25,6 @@
import org.jboss.portal.wsrp.WSRPProducer;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Exposes WSPRProducer test implementation methods - we inject what it returns
*
@@ -38,7 +36,5 @@
/** Resets any currently held state. */
void reset();
- void setResponse(HttpServletResponse response);
-
BehaviorRegistry getBehaviorRegistry();
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2007-06-11 23:13:08 UTC (rev 7404)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2007-06-12 04:52:45 UTC (rev 7405)
@@ -70,6 +70,10 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
import java.rmi.RemoteException;
/**
@@ -81,24 +85,28 @@
* @version $Revision$
* @since 2.4
*/
-public class TestWSRPProducerImpl extends AbstractJBossService implements TestWSRPProducer
+public class TestWSRPProducerImpl extends AbstractJBossService implements TestWSRPProducer, ServiceLifecycle
{
private int sessionExpirationTime = DEFAULT_SESSION_EXPIRATION_TIME;
private CookieProtocol requiresInitCookie = CookieProtocol.none;
- /** Used to set the cookie in initCookie */
- private HttpServletResponse response;
-
private BehaviorRegistry behaviorRegistry = new BehaviorRegistry();
public static final String USER_COOKIE = "cookie";
+ private ServletEndpointContext context;
+
public TestWSRPProducerImpl()
{
reset();
}
+ public void init(Object context) throws ServiceException
+ {
+ this.context = (ServletEndpointContext)context;
+ }
+
public BehaviorRegistry getBehaviorRegistry()
{
return behaviorRegistry;
@@ -106,12 +114,6 @@
public void reset()
{
- if (response != null)
- {
- response.reset();
- }
- response = null;
-
requiresInitCookie = null;
behaviorRegistry.clear();
}
@@ -131,18 +133,12 @@
return behaviorRegistry.getPortletManagementBehavior();
}
- public void setResponse(HttpServletResponse response)
- {
- this.response = response;
- }
-
// ServiceDescription implementation ********************************************************************************
public ServiceDescription getServiceDescription(GetServiceDescription gs)
throws InvalidRegistrationFault, OperationFailedFault, RemoteException
{
- ServiceDescription response = getServiceDescriptionBehavior().getServiceDescription(gs);
- return response;
+ return getServiceDescriptionBehavior().getServiceDescription(gs);
}
// MarkupService implementation *************************************************************************************
@@ -153,10 +149,9 @@
OperationFailedFault, MissingParametersFault, InvalidUserCategoryFault, InvalidRegistrationFault,
UnsupportedMimeTypeFault, RemoteException
{
- MarkupResponse markupResponse = getMarkupBehaviorFor(getMarkup.getPortletContext().getPortletHandle())
- .getMarkup(getMarkup);
- return markupResponse;
+ return getMarkupBehaviorFor(getMarkup.getPortletContext().getPortletHandle())
+ .getMarkup(getMarkup);
}
public BlockingInteractionResponse performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction)
@@ -165,10 +160,9 @@
InvalidRegistrationFault, MissingParametersFault, InvalidUserCategoryFault, InconsistentParametersFault,
InvalidHandleFault, InvalidCookieFault, RemoteException
{
- BlockingInteractionResponse res = getMarkupBehaviorFor(performBlockingInteraction.getPortletContext().getPortletHandle())
- .performBlockingInteraction(performBlockingInteraction);
- return res;
+ return getMarkupBehaviorFor(performBlockingInteraction.getPortletContext().getPortletHandle())
+ .performBlockingInteraction(performBlockingInteraction);
}
public ReturnAny releaseSessions(ReleaseSessions releaseSessions)
@@ -186,7 +180,9 @@
throw new OperationFailedFault();
}
- response.addCookie(new Cookie("cookieName", USER_COOKIE));
+ MessageContext msgContext = context.getMessageContext();
+ HttpServletResponse res = (HttpServletResponse)msgContext.getProperty("javax.xml.ws.servlet.response");
+ res.addCookie(new Cookie("name", "value"));
return null;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2007-06-11 23:13:08 UTC (rev 7404)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/MarkupTestCase.java 2007-06-12 04:52:45 UTC (rev 7405)
@@ -120,7 +120,6 @@
String sessionId = sessionInfo.getSessionIdForPortlet(SessionMarkupBehavior.PORTLET_HANDLE);
ExtendedAssert.assertNotNull(sessionId);
ExtendedAssert.assertEquals(SessionMarkupBehavior.SESSION_ID, sessionId);
- ExtendedAssert.assertNotNull(sessionInfo.getUserCookie());
ExtendedAssert.assertFalse(sessionInfo.isPerGroupCookies());
ExtendedAssert.assertFalse(sessionInfo.isInitCookieDone());
@@ -134,7 +133,6 @@
RenderInvocation render = createRenderInvocation(InitCookieMarkupBehavior.PORTLET_HANDLE);
TestPortletInvocationContext invocationContext = (TestPortletInvocationContext)render.getContext();
HttpSession session = invocationContext.getClientRequest().getSession();
- producer.setResponse(invocationContext.getClientResponse());
ProducerSessionInformation sessionInfo = consumer.getProducerSessionInformationFrom(session);
ExtendedAssert.assertNull(sessionInfo);
@@ -149,9 +147,6 @@
// now require cookie initialization and check that everything went well
producer.setRequiresInitCookie(CookieProtocol.perUser);
render = createRenderInvocation(InitCookieMarkupBehavior.PORTLET_HANDLE);
- invocationContext = (TestPortletInvocationContext)render.getContext();
- session = invocationContext.getClientRequest().getSession();
- producer.setResponse(invocationContext.getClientResponse());
consumer.invoke(render);
18 years, 10 months
JBoss Portal SVN: r7404 - trunk/core/src/main/org/jboss/portal/core/model/portal/control.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-11 19:13:08 -0400 (Mon, 11 Jun 2007)
New Revision: 7404
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java
trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlContext.java
Log:
minor javadoc
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java 2007-06-11 19:57:26 UTC (rev 7403)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java 2007-06-11 23:13:08 UTC (rev 7404)
@@ -23,6 +23,8 @@
package org.jboss.portal.core.model.portal.control;
/**
+ * Defines the constant for the control framework.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlContext.java 2007-06-11 19:57:26 UTC (rev 7403)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlContext.java 2007-06-11 23:13:08 UTC (rev 7404)
@@ -25,13 +25,15 @@
import org.jboss.portal.core.controller.ControllerContext;
/**
+ * Base class for the control context provided to a control policy.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public class ControlContext
{
- /** . */
+ /** We expose the controller context. */
private final ControllerContext controllerContext;
public ControlContext(ControllerContext controllerContext)
18 years, 10 months
JBoss Portal SVN: r7403 - branches.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-06-11 15:57:26 -0400 (Mon, 11 Jun 2007)
New Revision: 7403
Added:
branches/2_6_RichFaces_POC/
Log:
A branch for doing RichFaces Proof of Concept with Management application
Copied: branches/2_6_RichFaces_POC (from rev 7402, trunk/core-admin)
18 years, 10 months
JBoss Portal SVN: r7401 - in trunk/core/src/main/org/jboss/portal/core/model/portal/control: page and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-11 11:30:33 -0400 (Mon, 11 Jun 2007)
New Revision: 7401
Added:
trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/
trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/DefaultPageControlPolicy.java
trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/PageControlContext.java
trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/PageControlPolicy.java
Log:
better naming of control policies
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/DefaultPageControlPolicy.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/DefaultPageControlPolicy.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/DefaultPageControlPolicy.java 2007-06-11 15:30:33 UTC (rev 7401)
@@ -0,0 +1,188 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.control.page;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.server.config.ServerConfig;
+import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.ControllerRequestDispatcher;
+import org.jboss.portal.core.controller.command.response.ErrorResponse;
+import org.jboss.portal.core.controller.command.response.SecurityErrorResponse;
+import org.jboss.portal.core.controller.command.response.UnavailableResourceResponse;
+import org.jboss.portal.core.model.portal.command.response.MarkupResponse;
+import org.jboss.portal.core.model.portal.content.WindowRendition;
+import org.jboss.portal.core.model.portal.control.ControlConstants;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DefaultPageControlPolicy implements PageControlPolicy
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(DefaultPageControlPolicy.class);
+
+ /** . */
+ private static final Map errorTypeMapping = new HashMap();
+
+ static
+ {
+ errorTypeMapping.put(ControlConstants.PAGE_ACCESS_DENIED_CONTROL_KEY, ControlConstants.ACCESS_DENIED_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PAGE_ERROR_CONTROL_KEY, ControlConstants.ERROR_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PAGE_INTERNAL_ERROR_CONTROL_KEY, ControlConstants.INTERNAL_ERROR_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PAGE_UNAVAILABLE_CONTROL_KEY, ControlConstants.UNAVAILABLE_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PAGE_NOT_FOUND_CONTROL_KEY, ControlConstants.NOT_FOUND_ERROR_TYPE);
+ }
+
+ /** . */
+ private ServerConfig serverConfig;
+
+ /** . */
+ private PortalObjectContainer portalObjectContainer;
+
+ public ServerConfig getServerConfig()
+ {
+ return serverConfig;
+ }
+
+ public void setServerConfig(ServerConfig serverConfig)
+ {
+ this.serverConfig = serverConfig;
+ }
+
+ public PortalObjectContainer getPortalObjectContainer()
+ {
+ return portalObjectContainer;
+ }
+
+ public void setPortalObjectContainer(PortalObjectContainer portalObjectContainer)
+ {
+ this.portalObjectContainer = portalObjectContainer;
+ }
+
+ public void doControl(PageControlContext controlContext)
+ {
+ WindowRendition rendition = controlContext.getRendition();
+
+ //
+ ControllerResponse response = rendition.getControllerResponse();
+
+ //
+ String policyKey = null;
+ Throwable cause = null;
+ String message = null;
+
+ //
+ if (response instanceof ErrorResponse)
+ {
+ ErrorResponse error = (ErrorResponse)response;
+ cause = error.getCause();
+ message = error.getMessage();
+
+ //
+ if (response instanceof SecurityErrorResponse)
+ {
+ SecurityErrorResponse ser = (SecurityErrorResponse)response;
+
+ //
+ if (ser.getStatus() == SecurityErrorResponse.NOT_AUTHORIZED)
+ {
+ policyKey = ControlConstants.PAGE_ACCESS_DENIED_CONTROL_KEY;
+ }
+ }
+ else
+ {
+ policyKey = error.isInternal() ? ControlConstants.PAGE_INTERNAL_ERROR_CONTROL_KEY : ControlConstants.PAGE_ERROR_CONTROL_KEY;
+ }
+ }
+ else if (response instanceof UnavailableResourceResponse)
+ {
+ UnavailableResourceResponse unavailable = (UnavailableResourceResponse)response;
+
+ //
+ if (log.isTraceEnabled())
+ {
+ log.trace("Window not found " + unavailable.getRef());
+ }
+
+ policyKey = unavailable.isLocated() ? ControlConstants.PAGE_UNAVAILABLE_CONTROL_KEY : ControlConstants.PAGE_NOT_FOUND_CONTROL_KEY;
+ }
+
+ //
+ if (cause != null)
+ {
+ log.error("Rendering portlet window " + "" + " produced an error", cause);
+ }
+
+ //
+ if (policyKey != null)
+ {
+ Map properties = controlContext.getRendition().getProperties();
+
+ //
+ String policyValue = (String)properties.get(policyKey);
+
+ //
+ if (policyValue != null)
+ {
+ if (ControlConstants.HIDE_CONTROL_VALUE.equals(policyValue))
+ {
+ rendition.setControllerResponse(null);
+ }
+ else if (ControlConstants.JSP_CONTROL_VALUE.equals(policyValue))
+ {
+ String resourceURI = (String)properties.get(ControlConstants.PORTAL_RESOURCE_URI_CONTROL_KEY);
+ if (resourceURI != null)
+ {
+ ControllerContext controllerCtx = controlContext.getControllerContext();
+ ControllerRequestDispatcher rd = controllerCtx.getRequestDispatcher("/portal-core", resourceURI);
+ if (rd != null)
+ {
+ String errorType = (String)errorTypeMapping.get(policyKey);
+ rd.setAttribute(ControlConstants.ERROR_TYPE_ATTRIBUTE, errorType);
+ rd.setAttribute(ControlConstants.CAUSE_ATTRIBUTE, cause);
+ rd.setAttribute(ControlConstants.MESSAGE_ATTRIBUTE, message);
+
+ //
+ rd.include();
+
+ //
+ String markup = rd.getMarkup();
+ rendition.setSupportedWindowStates(Collections.EMPTY_LIST);
+ rendition.setSupportedModes(Collections.EMPTY_LIST);
+ rendition.setControllerResponse(new MarkupResponse("An error occured", markup, null));
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/PageControlContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/PageControlContext.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/PageControlContext.java 2007-06-11 15:30:33 UTC (rev 7401)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.control.page;
+
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.control.ControlContext;
+import org.jboss.portal.core.model.portal.content.WindowRendition;
+import org.jboss.portal.core.controller.ControllerContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PageControlContext extends ControlContext
+{
+
+ /** . */
+ private final PortalObjectId windowId;
+
+ /** . */
+ private final WindowRendition rendition;
+
+
+ public PageControlContext(ControllerContext controllerContext, PortalObjectId windowId, WindowRendition rendition)
+ {
+ super(controllerContext);
+ this.windowId = windowId;
+ this.rendition = rendition;
+ }
+
+ public PortalObjectId getWindowId()
+ {
+ return windowId;
+ }
+
+ public WindowRendition getRendition()
+ {
+ return rendition;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/PageControlPolicy.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/PageControlPolicy.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/page/PageControlPolicy.java 2007-06-11 15:30:33 UTC (rev 7401)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.control.page;
+
+/**
+ * Policy that controls the behavior of a portal window.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PageControlPolicy
+{
+ void doControl(PageControlContext controlContext);
+}
18 years, 10 months
JBoss Portal SVN: r7400 - in trunk: core/src/main/org/jboss/portal/core/model/portal/command/render and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-11 11:30:01 -0400 (Mon, 11 Jun 2007)
New Revision: 7400
Removed:
trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/DefaultWindowControlPolicy.java
trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/WindowControlContext.java
trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/WindowControlPolicy.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesInfo.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editProperties.xhtml
trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java
trunk/core/src/main/org/jboss/portal/core/model/portal/control/portal/DefaultPortalControlPolicy.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
Log:
better naming of control policies
Modified: trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-06-11 15:30:01 UTC (rev 7400)
@@ -33,8 +33,7 @@
import org.jboss.portal.core.controller.handler.ResponseHandler;
import org.jboss.portal.core.controller.handler.AjaxResponse;
import org.jboss.portal.core.controller.handler.ResponseHandlerException;
-import org.jboss.portal.core.model.portal.control.portal.PortalControlPolicy;
-import org.jboss.portal.core.model.portal.control.window.WindowControlPolicy;
+import org.jboss.portal.core.model.portal.control.page.PageControlPolicy;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
import org.jboss.portal.core.model.instance.InstanceContainer;
@@ -92,11 +91,8 @@
protected ServletContainerContext servletContainerContext;
/** . */
- protected PortalControlPolicy portalControlPolicy;
+ protected PageControlPolicy pageControlPolicy;
- /** . */
- protected WindowControlPolicy windowControlPolicy;
-
public ContentRendererRegistry getContentRendererRegistry()
{
return contentRendererRegistry;
@@ -202,26 +198,16 @@
return servletContainerContext;
}
- public WindowControlPolicy getWindowControlPolicy()
+ public PageControlPolicy getPageControlPolicy()
{
- return windowControlPolicy;
+ return pageControlPolicy;
}
- public void setWindowControlPolicy(WindowControlPolicy windowControlPolicy)
+ public void setPageControlPolicy(PageControlPolicy pageControlPolicy)
{
- this.windowControlPolicy = windowControlPolicy;
+ this.pageControlPolicy = pageControlPolicy;
}
- public PortalControlPolicy getPortalControlPolicy()
- {
- return portalControlPolicy;
- }
-
- public void setPortalControlPolicy(PortalControlPolicy portalControlPolicy)
- {
- this.portalControlPolicy = portalControlPolicy;
- }
-
public final void handle(ServerInvocation invocation) throws ServerException
{
// Create controller context
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/render/RenderWindowCommand.java 2007-06-11 15:30:01 UTC (rev 7400)
@@ -30,7 +30,7 @@
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.portal.content.WindowRendition;
import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.control.window.WindowControlContext;
+import org.jboss.portal.core.model.portal.control.page.PageControlContext;
import org.jboss.portal.core.model.portal.command.WindowCommand;
import org.jboss.portal.core.model.portal.content.ContentRenderer;
import org.jboss.portal.core.model.portal.content.ContentRendererRegistry;
@@ -90,8 +90,8 @@
// Apply policy behavior here
if (rendition != null)
{
- WindowControlContext wcc = new WindowControlContext(context, targetId, rendition);
- context.getController().getWindowControlPolicy().doControl(wcc);
+ PageControlContext wcc = new PageControlContext(context, targetId, rendition);
+ context.getController().getPageControlPolicy().doControl(wcc);
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java 2007-06-11 15:30:01 UTC (rev 7400)
@@ -34,40 +34,40 @@
}
/** . */
- public static final String AGGREGATION_ACCESS_DENIED_CONTROL_KEY = "control.aggregation.access_denied";
+ public static final String PAGE_ACCESS_DENIED_CONTROL_KEY = "control.page.access_denied";
/** . */
- public static final String AGGREGATION_UNAVAILABLE_CONTROL_KEY = "control.aggregation.unavailable";
+ public static final String PAGE_UNAVAILABLE_CONTROL_KEY = "control.page.unavailable";
/** . */
- public static final String AGGREGATION_ERROR_CONTROL_KEY = "control.aggregation.error";
+ public static final String PAGE_ERROR_CONTROL_KEY = "control.page.error";
/** . */
- public static final String AGGREGATION_INTERNAL_ERROR_CONTROL_KEY = "control.aggregation.internal_error";
+ public static final String PAGE_INTERNAL_ERROR_CONTROL_KEY = "control.page.internal_error";
/** . */
- public static final String AGGREGATION_NOT_FOUND_CONTROL_KEY = "control.aggregation.not_found";
+ public static final String PAGE_NOT_FOUND_CONTROL_KEY = "control.page.not_found";
/** . */
- public static final String AGGREGATION_RESOURCE_URI_CONTROL_KEY = "control.aggregation.resource_uri";
+ public static final String PAGE_RESOURCE_URI_CONTROL_KEY = "control.page.resource_uri";
/** . */
- public static final String GLOBAL_ACCESS_DENIED_CONTROL_KEY = "control.access_denied";
+ public static final String PORTAL_ACCESS_DENIED_CONTROL_KEY = "control.portal.access_denied";
/** . */
- public static final String GLOBAL_UNAVAILABLE_CONTROL_KEY = "control.unavailable";
+ public static final String PORTAL_UNAVAILABLE_CONTROL_KEY = "control.portal.unavailable";
/** . */
- public static final String GLOBAL_ERROR_CONTROL_KEY = "control.error";
+ public static final String PORTAL_ERROR_CONTROL_KEY = "control.portal.error";
/** . */
- public static final String GLOBAL_INTERNAL_ERROR_CONTROL_KEY = "control.internal_error";
+ public static final String PORTAL_INTERNAL_ERROR_CONTROL_KEY = "control.portal.internal_error";
/** . */
- public static final String GLOBAL_NOT_FOUND_CONTROL_KEY = "control.not_found";
+ public static final String PORTAL_NOT_FOUND_CONTROL_KEY = "control.portal.not_found";
/** . */
- public static final String GLOBAL_RESOURCE_URI_CONTROL_KEY = "control.resource_uri";
+ public static final String PORTAL_RESOURCE_URI_CONTROL_KEY = "control.portal.resource_uri";
/** . */
public static final String HIDE_CONTROL_VALUE = "hide";
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/control/portal/DefaultPortalControlPolicy.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/portal/DefaultPortalControlPolicy.java 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/portal/DefaultPortalControlPolicy.java 2007-06-11 15:30:01 UTC (rev 7400)
@@ -62,11 +62,11 @@
static
{
- errorTypeMapping.put(ControlConstants.GLOBAL_ACCESS_DENIED_CONTROL_KEY, ControlConstants.ACCESS_DENIED_ERROR_TYPE);
- errorTypeMapping.put(ControlConstants.GLOBAL_ERROR_CONTROL_KEY, ControlConstants.ERROR_ERROR_TYPE);
- errorTypeMapping.put(ControlConstants.GLOBAL_INTERNAL_ERROR_CONTROL_KEY, ControlConstants.INTERNAL_ERROR_ERROR_TYPE);
- errorTypeMapping.put(ControlConstants.GLOBAL_UNAVAILABLE_CONTROL_KEY, ControlConstants.UNAVAILABLE_ERROR_TYPE);
- errorTypeMapping.put(ControlConstants.GLOBAL_NOT_FOUND_CONTROL_KEY, ControlConstants.NOT_FOUND_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PORTAL_ACCESS_DENIED_CONTROL_KEY, ControlConstants.ACCESS_DENIED_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PORTAL_ERROR_CONTROL_KEY, ControlConstants.ERROR_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PORTAL_INTERNAL_ERROR_CONTROL_KEY, ControlConstants.INTERNAL_ERROR_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PORTAL_UNAVAILABLE_CONTROL_KEY, ControlConstants.UNAVAILABLE_ERROR_TYPE);
+ errorTypeMapping.put(ControlConstants.PORTAL_NOT_FOUND_CONTROL_KEY, ControlConstants.NOT_FOUND_ERROR_TYPE);
}
/** . */
@@ -107,12 +107,12 @@
//
if (ser.getStatus() == SecurityErrorResponse.NOT_AUTHORIZED)
{
- policyKey = ControlConstants.GLOBAL_ACCESS_DENIED_CONTROL_KEY;
+ policyKey = ControlConstants.PORTAL_ACCESS_DENIED_CONTROL_KEY;
}
}
else
{
- policyKey = error.isInternal() ? ControlConstants.GLOBAL_INTERNAL_ERROR_CONTROL_KEY : ControlConstants.GLOBAL_ERROR_CONTROL_KEY;
+ policyKey = error.isInternal() ? ControlConstants.PORTAL_INTERNAL_ERROR_CONTROL_KEY : ControlConstants.PORTAL_ERROR_CONTROL_KEY;
}
}
else if (response instanceof UnavailableResourceResponse)
@@ -120,7 +120,7 @@
UnavailableResourceResponse unavailable = (UnavailableResourceResponse)response;
//
- policyKey = unavailable.isLocated() ? ControlConstants.GLOBAL_UNAVAILABLE_CONTROL_KEY : ControlConstants.GLOBAL_NOT_FOUND_CONTROL_KEY;
+ policyKey = unavailable.isLocated() ? ControlConstants.PORTAL_UNAVAILABLE_CONTROL_KEY : ControlConstants.PORTAL_NOT_FOUND_CONTROL_KEY;
}
//
@@ -142,7 +142,7 @@
{
if (ControlConstants.JSP_CONTROL_VALUE.equals(policyValue))
{
- String resourceURI = object.getProperty(ControlConstants.AGGREGATION_RESOURCE_URI_CONTROL_KEY);
+ String resourceURI = object.getProperty(ControlConstants.PAGE_RESOURCE_URI_CONTROL_KEY);
if (resourceURI != null)
{
ControllerContext controllerCtx = controlContext.getControllerContext();
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/DefaultWindowControlPolicy.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/DefaultWindowControlPolicy.java 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/DefaultWindowControlPolicy.java 2007-06-11 15:30:01 UTC (rev 7400)
@@ -1,188 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.control.window;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.server.config.ServerConfig;
-import org.jboss.portal.core.controller.ControllerResponse;
-import org.jboss.portal.core.controller.ControllerContext;
-import org.jboss.portal.core.controller.ControllerRequestDispatcher;
-import org.jboss.portal.core.controller.command.response.ErrorResponse;
-import org.jboss.portal.core.controller.command.response.SecurityErrorResponse;
-import org.jboss.portal.core.controller.command.response.UnavailableResourceResponse;
-import org.jboss.portal.core.model.portal.command.response.MarkupResponse;
-import org.jboss.portal.core.model.portal.content.WindowRendition;
-import org.jboss.portal.core.model.portal.control.ControlConstants;
-import org.jboss.portal.core.model.portal.PortalObjectContainer;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class DefaultWindowControlPolicy implements WindowControlPolicy
-{
-
- /** . */
- private static final Logger log = Logger.getLogger(DefaultWindowControlPolicy.class);
-
- /** . */
- private static final Map errorTypeMapping = new HashMap();
-
- static
- {
- errorTypeMapping.put(ControlConstants.AGGREGATION_ACCESS_DENIED_CONTROL_KEY, ControlConstants.ACCESS_DENIED_ERROR_TYPE);
- errorTypeMapping.put(ControlConstants.AGGREGATION_ERROR_CONTROL_KEY, ControlConstants.ERROR_ERROR_TYPE);
- errorTypeMapping.put(ControlConstants.AGGREGATION_INTERNAL_ERROR_CONTROL_KEY, ControlConstants.INTERNAL_ERROR_ERROR_TYPE);
- errorTypeMapping.put(ControlConstants.AGGREGATION_UNAVAILABLE_CONTROL_KEY, ControlConstants.UNAVAILABLE_ERROR_TYPE);
- errorTypeMapping.put(ControlConstants.AGGREGATION_NOT_FOUND_CONTROL_KEY, ControlConstants.NOT_FOUND_ERROR_TYPE);
- }
-
- /** . */
- private ServerConfig serverConfig;
-
- /** . */
- private PortalObjectContainer portalObjectContainer;
-
- public ServerConfig getServerConfig()
- {
- return serverConfig;
- }
-
- public void setServerConfig(ServerConfig serverConfig)
- {
- this.serverConfig = serverConfig;
- }
-
- public PortalObjectContainer getPortalObjectContainer()
- {
- return portalObjectContainer;
- }
-
- public void setPortalObjectContainer(PortalObjectContainer portalObjectContainer)
- {
- this.portalObjectContainer = portalObjectContainer;
- }
-
- public void doControl(WindowControlContext controlContext)
- {
- WindowRendition rendition = controlContext.getRendition();
-
- //
- ControllerResponse response = rendition.getControllerResponse();
-
- //
- String policyKey = null;
- Throwable cause = null;
- String message = null;
-
- //
- if (response instanceof ErrorResponse)
- {
- ErrorResponse error = (ErrorResponse)response;
- cause = error.getCause();
- message = error.getMessage();
-
- //
- if (response instanceof SecurityErrorResponse)
- {
- SecurityErrorResponse ser = (SecurityErrorResponse)response;
-
- //
- if (ser.getStatus() == SecurityErrorResponse.NOT_AUTHORIZED)
- {
- policyKey = ControlConstants.AGGREGATION_ACCESS_DENIED_CONTROL_KEY;
- }
- }
- else
- {
- policyKey = error.isInternal() ? ControlConstants.AGGREGATION_INTERNAL_ERROR_CONTROL_KEY : ControlConstants.AGGREGATION_ERROR_CONTROL_KEY;
- }
- }
- else if (response instanceof UnavailableResourceResponse)
- {
- UnavailableResourceResponse unavailable = (UnavailableResourceResponse)response;
-
- //
- if (log.isTraceEnabled())
- {
- log.trace("Window not found " + unavailable.getRef());
- }
-
- policyKey = unavailable.isLocated() ? ControlConstants.AGGREGATION_UNAVAILABLE_CONTROL_KEY : ControlConstants.AGGREGATION_NOT_FOUND_CONTROL_KEY;
- }
-
- //
- if (cause != null)
- {
- log.error("Rendering portlet window " + "" + " produced an error", cause);
- }
-
- //
- if (policyKey != null)
- {
- Map properties = controlContext.getRendition().getProperties();
-
- //
- String policyValue = (String)properties.get(policyKey);
-
- //
- if (policyValue != null)
- {
- if (ControlConstants.HIDE_CONTROL_VALUE.equals(policyValue))
- {
- rendition.setControllerResponse(null);
- }
- else if (ControlConstants.JSP_CONTROL_VALUE.equals(policyValue))
- {
- String resourceURI = (String)properties.get(ControlConstants.GLOBAL_RESOURCE_URI_CONTROL_KEY);
- if (resourceURI != null)
- {
- ControllerContext controllerCtx = controlContext.getControllerContext();
- ControllerRequestDispatcher rd = controllerCtx.getRequestDispatcher("/portal-core", resourceURI);
- if (rd != null)
- {
- String errorType = (String)errorTypeMapping.get(policyKey);
- rd.setAttribute(ControlConstants.ERROR_TYPE_ATTRIBUTE, errorType);
- rd.setAttribute(ControlConstants.CAUSE_ATTRIBUTE, cause);
- rd.setAttribute(ControlConstants.MESSAGE_ATTRIBUTE, message);
-
- //
- rd.include();
-
- //
- String markup = rd.getMarkup();
- rendition.setSupportedWindowStates(Collections.EMPTY_LIST);
- rendition.setSupportedModes(Collections.EMPTY_LIST);
- rendition.setControllerResponse(new MarkupResponse("An error occured", markup, null));
- }
- }
- }
- }
- }
- }
-
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/WindowControlContext.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/WindowControlContext.java 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/WindowControlContext.java 2007-06-11 15:30:01 UTC (rev 7400)
@@ -1,60 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.control.window;
-
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.control.ControlContext;
-import org.jboss.portal.core.model.portal.content.WindowRendition;
-import org.jboss.portal.core.controller.ControllerContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class WindowControlContext extends ControlContext
-{
-
- /** . */
- private final PortalObjectId windowId;
-
- /** . */
- private final WindowRendition rendition;
-
-
- public WindowControlContext(ControllerContext controllerContext, PortalObjectId windowId, WindowRendition rendition)
- {
- super(controllerContext);
- this.windowId = windowId;
- this.rendition = rendition;
- }
-
- public PortalObjectId getWindowId()
- {
- return windowId;
- }
-
- public WindowRendition getRendition()
- {
- return rendition;
- }
-}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/WindowControlPolicy.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/WindowControlPolicy.java 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/WindowControlPolicy.java 2007-06-11 15:30:01 UTC (rev 7400)
@@ -1,34 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal.control.window;
-
-/**
- * Policy that controls the behavior of a portal window.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public interface WindowControlPolicy
-{
- void doControl(WindowControlContext controlContext);
-}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-06-11 15:30:01 UTC (rev 7400)
@@ -1030,8 +1030,8 @@
<!-- -->
<mbean
- code="org.jboss.portal.core.model.portal.control.window.DefaultWindowControlPolicy"
- name="portal:service=ControlPolicy,type=Window"
+ code="org.jboss.portal.core.model.portal.control.page.DefaultPageControlPolicy"
+ name="portal:service=ControlPolicy,type=Page"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
@@ -1088,13 +1088,8 @@
optional-attribute-name="ResponseHandler"
proxy-type="attribute">portal:service=ResponseHandler,type=Selector</depends>
<depends
- optional-attribute-name="WindowControlPolicy"
- proxy-type="attribute">portal:service=ControlPolicy,type=Window</depends>
-<!--
- <depends
- optional-attribute-name="PortalControlPolicy"
- proxy-type="attribute">portal:service=ControlPolicy,type=Window</depends>
--->
+ optional-attribute-name="PageControlPolicy"
+ proxy-type="attribute">portal:service=ControlPolicy,type=Page</depends>
</mbean>
<!-- The controller factory -->
Modified: trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core/src/resources/portal-core-sar/conf/data/default-object.xml 2007-06-11 15:30:01 UTC (rev 7400)
@@ -32,51 +32,51 @@
<context-name/>
<properties>
<property>
- <name>control.access_denied</name>
+ <name>control.portal.access_denied</name>
<value>hide</value>
</property>
<property>
- <name>control.unavailable</name>
+ <name>control.portal.unavailable</name>
<value>hide</value>
</property>
<property>
- <name>control.not_found</name>
+ <name>control.portal.not_found</name>
<value>hide</value>
</property>
<property>
- <name>control.internal_error</name>
+ <name>control.portal.internal_error</name>
<value>jsp</value>
</property>
<property>
- <name>control.error</name>
+ <name>control.portal.error</name>
<value>jsp</value>
</property>
<property>
- <name>control.resource_uri</name>
+ <name>control.portal.resource_uri</name>
<value>/WEB-INF/jsp/control/error.jsp</value>
</property>
<property>
- <name>control.aggregation.access_denied</name>
+ <name>control.page.access_denied</name>
<value>hide</value>
</property>
<property>
- <name>control.aggregation.unavailable</name>
+ <name>control.page.unavailable</name>
<value>hide</value>
</property>
<property>
- <name>control.aggregation.not_found</name>
+ <name>control.page.not_found</name>
<value>hide</value>
</property>
<property>
- <name>control.aggregation.internal_error</name>
+ <name>control.page.internal_error</name>
<value>jsp</value>
</property>
<property>
- <name>control.aggregation.error</name>
+ <name>control.page.error</name>
<value>jsp</value>
</property>
<property>
- <name>control.aggregation.resource_uri</name>
+ <name>control.page.resource_uri</name>
<value>/WEB-INF/jsp/control/aggregation_error.jsp</value>
</property>
</properties>
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesInfo.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesInfo.java 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertiesInfo.java 2007-06-11 15:30:01 UTC (rev 7400)
@@ -61,11 +61,11 @@
//
- public static final PropertyInfo CONTROL_POLICY_ACCESS_DENIED = new PropertyInfo(ControlConstants.AGGREGATION_ACCESS_DENIED_CONTROL_KEY, new LocalizedString("On window access denied"), new LocalizedString("On window access denied"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
- public static final PropertyInfo CONTROL_POLICY_UNAVAILABLE = new PropertyInfo(ControlConstants.AGGREGATION_UNAVAILABLE_CONTROL_KEY, new LocalizedString("On window unavailable"), new LocalizedString("On window unavailable"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
- public static final PropertyInfo CONTROL_POLICY_ERROR = new PropertyInfo(ControlConstants.AGGREGATION_ERROR_CONTROL_KEY, new LocalizedString("On window error"), new LocalizedString("On window error"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
- public static final PropertyInfo CONTROL_POLICY_INTERNAL_ERROR = new PropertyInfo(ControlConstants.AGGREGATION_INTERNAL_ERROR_CONTROL_KEY, new LocalizedString("On window internal error"), new LocalizedString("On window internal error"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
- public static final PropertyInfo CONTROL_POLICY_NOT_FOUND = new PropertyInfo(ControlConstants.AGGREGATION_NOT_FOUND_CONTROL_KEY, new LocalizedString("On window not found"), new LocalizedString("On window not found"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
+ public static final PropertyInfo CONTROL_POLICY_ACCESS_DENIED = new PropertyInfo(ControlConstants.PAGE_ACCESS_DENIED_CONTROL_KEY, new LocalizedString("On window access denied"), new LocalizedString("On window access denied"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
+ public static final PropertyInfo CONTROL_POLICY_UNAVAILABLE = new PropertyInfo(ControlConstants.PAGE_UNAVAILABLE_CONTROL_KEY, new LocalizedString("On window unavailable"), new LocalizedString("On window unavailable"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
+ public static final PropertyInfo CONTROL_POLICY_ERROR = new PropertyInfo(ControlConstants.PAGE_ERROR_CONTROL_KEY, new LocalizedString("On window error"), new LocalizedString("On window error"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
+ public static final PropertyInfo CONTROL_POLICY_INTERNAL_ERROR = new PropertyInfo(ControlConstants.PAGE_INTERNAL_ERROR_CONTROL_KEY, new LocalizedString("On window internal error"), new LocalizedString("On window internal error"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
+ public static final PropertyInfo CONTROL_POLICY_NOT_FOUND = new PropertyInfo(ControlConstants.PAGE_NOT_FOUND_CONTROL_KEY, new LocalizedString("On window not found"), new LocalizedString("On window not found"), "java.lang.String", PropertyInfo.READ_WRITE_ACCESS_MODE, PropertyInfo.PUBLIC_SCOPE);
/** . */
private static final Map CONTEXT_PROPERTIES = new HashMap();
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editProperties.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editProperties.xhtml 2007-06-11 15:12:39 UTC (rev 7399)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editProperties.xhtml 2007-06-11 15:30:01 UTC (rev 7400)
@@ -10,8 +10,26 @@
<ui:include src="common/editProperties.xhtml">
<ui:param name="properties" value="#{portalobjectmgr.selectedProperties}"/>
- </ui:include>
-
+ </ui:include>
+
+ <hr/>
+ <h3>Configure error handling at portal level</h3>
+ <ul>
+ <li>Access denied:</li>
+ <li>Error:</li>
+ <li>Internal error:</li>
+ <li>Not found:</li>
+ <li>Unavailable:</li>
+ </ul>
+ <hr/>
+ <h3>Configure error handling at window level</h3>
+ <ul>
+ <li>Access denied:</li>
+ <li>Error:</li>
+ <li>Internal error:</li>
+ <li>Not found:</li>
+ <li>Unavailable:</li>
+ </ul>
</ui:define>
</ui:composition>
18 years, 10 months
JBoss Portal SVN: r7399 - in trunk/core/src/main/org/jboss/portal/core/model/portal/control: window and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-11 11:12:39 -0400 (Mon, 11 Jun 2007)
New Revision: 7399
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java
trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/DefaultWindowControlPolicy.java
Log:
minor tweak
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java 2007-06-11 14:38:24 UTC (rev 7398)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/ControlConstants.java 2007-06-11 15:12:39 UTC (rev 7399)
@@ -73,7 +73,7 @@
public static final String HIDE_CONTROL_VALUE = "hide";
/** . */
- public static final String SHOW_CONTROL_VALUE = "show";
+ public static final String IGNORE_CONTROL_VALUE = "ignore";
/** . */
public static final String JSP_CONTROL_VALUE = "jsp";
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/DefaultWindowControlPolicy.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/DefaultWindowControlPolicy.java 2007-06-11 14:38:24 UTC (rev 7398)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/control/window/DefaultWindowControlPolicy.java 2007-06-11 15:12:39 UTC (rev 7399)
@@ -156,12 +156,6 @@
{
rendition.setControllerResponse(null);
}
- else if (ControlConstants.SHOW_CONTROL_VALUE.equals(policyValue))
- {
- rendition.setSupportedWindowStates(Collections.EMPTY_LIST);
- rendition.setSupportedModes(Collections.EMPTY_LIST);
- rendition.setControllerResponse(new MarkupResponse(response.toString(), response.toString(), null));
- }
else if (ControlConstants.JSP_CONTROL_VALUE.equals(policyValue))
{
String resourceURI = (String)properties.get(ControlConstants.GLOBAL_RESOURCE_URI_CONTROL_KEY);
18 years, 10 months