JBoss Portal SVN: r10648 - branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-04-18 17:20:50 -0400 (Fri, 18 Apr 2008)
New Revision: 10648
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
Log:
- getAttachment returns null instead of throwing an exception (was breaking viewing of remote portlets).
- More generification.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-04-18 15:04:47 UTC (rev 10647)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-04-18 21:20:50 UTC (rev 10648)
@@ -106,14 +106,14 @@
groupId = other.groupId; // should be duplicate group id?
WSRPCapabilitiesInfo otherCapabilities = (WSRPCapabilitiesInfo)other.getCapabilities();
- capabilities = new WSRPCapabilitiesInfo(new HashMap(otherCapabilities.mediaTypes),
- new HashSet(otherCapabilities.modes), new HashSet(otherCapabilities.windowStates),
- new HashSet(otherCapabilities.locales));
+ capabilities = new WSRPCapabilitiesInfo(new HashMap<MediaType, MediaTypeInfo>(otherCapabilities.mediaTypes),
+ new HashSet<ModeInfo>(otherCapabilities.modes), new HashSet<WindowStateInfo>(otherCapabilities.windowStates),
+ new HashSet<Locale>(otherCapabilities.locales));
WSRPMetaInfo otherMeta = (WSRPMetaInfo)other.getMeta();
- metaInfo = new WSRPMetaInfo(new HashMap(otherMeta.metaInfos));
+ metaInfo = new WSRPMetaInfo(new HashMap<String, org.jboss.portal.common.i18n.LocalizedString>(otherMeta.metaInfos));
WSRPPreferencesInfo otherPref = (WSRPPreferencesInfo)other.getPreferences();
- prefInfo = new WSRPPreferencesInfo(new HashMap(otherPref.preferences));
+ prefInfo = new WSRPPreferencesInfo(new HashMap<String, PreferenceInfo>(otherPref.preferences));
originatingProducer = other.originatingProducer;
portletHandle = newHandle;
@@ -141,7 +141,7 @@
if (prefInfo == null)
{
PortletPropertyDescriptionResponse propertyDescs = originatingProducer.getPropertyDescriptionsFor(portletHandle);
- Map prefInfos = null;
+ Map<String, PreferenceInfo> prefInfos = null;
if (propertyDescs != null)
{
@@ -151,10 +151,9 @@
PropertyDescription[] descs = modelDesc.getPropertyDescriptions();
if (descs != null)
{
- prefInfos = new HashMap(descs.length);
- for (int i = 0; i < descs.length; i++)
+ prefInfos = new HashMap<String, PreferenceInfo>(descs.length);
+ for (PropertyDescription desc : descs)
{
- PropertyDescription desc = descs[i];
String key = desc.getName();
prefInfos.put(key, new WSRPPreferenceInfo(key, getPortalLocalizedStringOrNullFrom(desc.getLabel()),
getPortalLocalizedStringOrNullFrom(desc.getHint())));
@@ -162,14 +161,14 @@
}
else
{
- prefInfos = Collections.EMPTY_MAP;
+ prefInfos = Collections.emptyMap();
}
}
}
if (prefInfos == null)
{
- prefInfos = Collections.EMPTY_MAP;
+ prefInfos = Collections.emptyMap();
}
prefInfo = new WSRPPreferencesInfo(prefInfos);
@@ -210,7 +209,7 @@
public <T> T getAttachment(Class<T> tClass) throws IllegalArgumentException
{
- throw new UnsupportedOperationException("Implement if needed!");
+ return null;
}
public boolean isUsesMethodGet()
@@ -447,7 +446,7 @@
this.mediaTypes = mediaTypes;
}
- public WSRPCapabilitiesInfo(Map<MediaType, MediaTypeInfo> mediaTypes, Set<ModeInfo> modes, Set windowStates, Set locales)
+ public WSRPCapabilitiesInfo(Map<MediaType, MediaTypeInfo> mediaTypes, Set<ModeInfo> modes, Set<WindowStateInfo> windowStates, Set<Locale> locales)
{
this.mediaTypes = mediaTypes;
this.modes = modes;
@@ -562,16 +561,16 @@
private static class WSRPMetaInfo implements MetaInfo
{
- private final Map metaInfos;
+ private final Map<String, org.jboss.portal.common.i18n.LocalizedString> metaInfos;
- public WSRPMetaInfo(Map metaInfos)
+ public WSRPMetaInfo(Map<String, org.jboss.portal.common.i18n.LocalizedString> metaInfos)
{
this.metaInfos = metaInfos;
}
public org.jboss.portal.common.i18n.LocalizedString getMetaValue(String key)
{
- return (org.jboss.portal.common.i18n.LocalizedString)metaInfos.get(key);
+ return metaInfos.get(key);
}
}
18 years
JBoss Portal SVN: r10647 - in modules/portlet/trunk: controller/src/main/java/org/jboss/portal/portlet/controller/impl and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-18 11:04:47 -0400 (Fri, 18 Apr 2008)
New Revision: 10647
Modified:
modules/portlet/trunk/build/pom.xml
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestFactory.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java
Log:
use web snapshot into portlet module with the new endpoint feature
Modified: modules/portlet/trunk/build/pom.xml
===================================================================
--- modules/portlet/trunk/build/pom.xml 2008-04-18 13:23:00 UTC (rev 10646)
+++ modules/portlet/trunk/build/pom.xml 2008-04-18 15:04:47 UTC (rev 10647)
@@ -34,7 +34,7 @@
<version.jbossxb>2.0.0.CR5</version.jbossxb>
<version.jboss-remoting>2.2.1.GA</version.jboss-remoting>
<version.jboss.portal.common>1.2.0-SNAPSHOT</version.jboss.portal.common>
- <version.jboss.portal.web>1.2.0.Beta3</version.jboss.portal.web>
+ <version.jboss.portal.web>1.2.0-SNAPSHOT</version.jboss.portal.web>
<version.jboss.unit>1.2.0.Beta2</version.jboss.unit>
<version.log4j>1.2.14</version.log4j>
<version.apache.commons-logging>1.1.1</version.apache.commons-logging>
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestFactory.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestFactory.java 2008-04-18 13:23:00 UTC (rev 10646)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestFactory.java 2008-04-18 15:04:47 UTC (rev 10647)
@@ -70,17 +70,28 @@
*/
public ControllerRequest decode(WebRequest req)
{
+ return decode(req.getQueryParameterMap(), req.getBody());
+ }
+
+ /**
+ * Create a controller request.
+ *
+ * @param queryParameters the query parameters
+ * @param body the body
+ * @return the decoded controller request
+ */
+ public ControllerRequest decode(Map<String, String[]> queryParameters, Body body)
+ {
Map<String, String[]> bodyParameters = null;
//
- Body body = req.getBody();
if (body instanceof Body.Form)
{
bodyParameters = ((Body.Form)body).getParameters();
}
//
- return decode(req.getQueryParameterMap(), bodyParameters);
+ return decode(queryParameters, bodyParameters);
}
/**
Modified: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java 2008-04-18 13:23:00 UTC (rev 10646)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java 2008-04-18 15:04:47 UTC (rev 10647)
@@ -46,7 +46,7 @@
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.io.SerializationFilter;
import org.jboss.portal.common.util.Base64;
-import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.util.RequestDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -117,10 +117,12 @@
PortletPageNavigationalState pageNavigationalState = null;
if (URLParameterConstants.PORTLET_TYPE.equals(type))
{
- WebRequest wr = new WebRequest(req);
ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
- ControllerRequest request = factory.decode(wr);
+ RequestDecoder decoder = new RequestDecoder(req);
+
+ ControllerRequest request = factory.decode(decoder.getQueryParameters(), decoder.getBody());
+
ControllerResponse controllerResponse;
try
{
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-04-18 13:23:00 UTC (rev 10646)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-04-18 15:04:47 UTC (rev 10647)
@@ -34,21 +34,20 @@
import org.jboss.portal.portlet.test.controller.Renderer;
import org.jboss.portal.portlet.test.controller.RendererContextImpl;
import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.WebResponse;
+import org.jboss.portal.web.endpoint.EndPointServlet;
import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class PortalServlet extends HttpServlet
+public class PortalServlet extends EndPointServlet
{
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ protected void service(WebRequest req, WebResponse resp) throws ServletException, IOException
{
try
{
@@ -72,7 +71,7 @@
}
}
- protected void _service(HttpServletRequest req, HttpServletResponse resp) throws Exception
+ protected void _service(WebRequest req, WebResponse resp) throws Exception
{
PortletControllerContextImpl context = new PortletControllerContextImpl(req, resp, getServletContext());
@@ -84,9 +83,8 @@
//
if (URLParameterConstants.PORTLET_TYPE.equals(type))
{
- WebRequest wr = new WebRequest(req);
ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
- ControllerRequest request = factory.decode(wr);
+ ControllerRequest request = factory.decode(req);
//
ControllerResponse response = controller.process(context, request);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java 2008-04-18 13:23:00 UTC (rev 10646)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java 2008-04-18 15:04:47 UTC (rev 10647)
@@ -33,10 +33,9 @@
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.WebResponse;
+import org.jboss.portal.web.endpoint.EndPointServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServlet;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.Collection;
@@ -47,13 +46,13 @@
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class TCKServlet extends HttpServlet
+public class TCKServlet extends EndPointServlet
{
/** . */
public static String TCK_PORTLET_NAME = "portletName";
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ protected void service(WebRequest req, WebResponse resp) throws ServletException, IOException
{
try
{
@@ -77,7 +76,7 @@
}
}
- protected void _service(HttpServletRequest req, HttpServletResponse resp) throws Exception
+ protected void _service(WebRequest req, WebResponse resp) throws Exception
{
TCKPortletControllerContext context = new TCKPortletControllerContext(req, resp, getServletContext());
@@ -90,9 +89,8 @@
//
if (URLParameterConstants.PORTLET_TYPE.equals(type))
{
- WebRequest wr = new WebRequest(req);
ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
- ControllerRequest request = factory.decode(wr);
+ ControllerRequest request = factory.decode(req);
// We must have one!!!
TCKPortletPageNavigationalState tckPageNavigationalState = (TCKPortletPageNavigationalState)request.getPageNavigationalState();
18 years
JBoss Portal SVN: r10646 - in modules/web/trunk/web/src/main/java/org/jboss/portal/web: impl and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-18 09:23:00 -0400 (Fri, 18 Apr 2008)
New Revision: 10646
Added:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/util/
modules/web/trunk/web/src/main/java/org/jboss/portal/web/util/RequestDecoder.java
Modified:
modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/AbstractWebRequest.java
Log:
factor our usefull request decoder into a decoder class
Modified: modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/AbstractWebRequest.java
===================================================================
--- modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/AbstractWebRequest.java 2008-04-18 12:32:38 UTC (rev 10645)
+++ modules/web/trunk/web/src/main/java/org/jboss/portal/web/impl/AbstractWebRequest.java 2008-04-18 13:23:00 UTC (rev 10646)
@@ -22,18 +22,15 @@
******************************************************************************/
package org.jboss.portal.web.impl;
-import org.jboss.portal.common.http.QueryStringParser;
-import org.jboss.portal.common.net.media.ContentType;
import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.web.Body;
import org.jboss.portal.web.IllegalRequestException;
import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.util.RequestDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.Map;
-import java.util.Collections;
-import java.util.HashMap;
import java.nio.charset.Charset;
import java.io.UnsupportedEncodingException;
@@ -86,93 +83,15 @@
throw new IllegalRequestException("HTTP Method " + req.getMethod() + " not accepted");
}
- // Compute the media type in the content type
- MediaType mediaType = null;
- if (req.getContentType() != null)
- {
- ContentType contentType = ContentType.create(req.getContentType());
- mediaType = contentType.getMediaType();
- }
+ //
+ RequestDecoder decoder = new RequestDecoder(req);
- // Parse the query string to have the get parameters
- // The resulting map has its parameters decoded from the x-www-form-url encoding
- Map<String, String[]> queryParameterMap;
- String queryString = req.getQueryString();
- if (queryString != null)
- {
- queryParameterMap = QueryStringParser.getInstance().parseQueryString(queryString);
- }
- else
- {
- queryParameterMap = Collections.emptyMap();
- }
- // Only affect the charset encoding if the servlet container will decode the request
- Body body = null;
- if (verb == Verb.POST)
- {
- if (APPLICATION_X_WWW_FORM_URLENCODED_MEDIA_TYPE.equals(mediaType))
- {
- // Now we must ensure that we have either an equals or a trailing space after the media-type
- String characterEncoding = req.getCharacterEncoding();
- if (characterEncoding == null)
- {
- // Set out charset for the request
- req.setCharacterEncoding(UTF_8_CHARSET.name());
- }
- else
- {
- Charset charset = Charset.forName(characterEncoding);
- if (!UTF_8_CHARSET.equals(charset))
- {
- throw new IllegalRequestException("Charset " + characterEncoding + " not accepted, it should be UTF8");
- }
- }
-
- //
- Map<String, String[]> bodyParameterMap = new HashMap<String, String[]>();
- for (Map.Entry<String, String[]> entry : ((Map<String, String[]>)req.getParameterMap()).entrySet())
- {
- // Get param name
- String paramName = entry.getKey();
-
- // Values that are aggregated from the query string and the body
- String[] paramValues = entry.getValue();
-
- // Values decoded from the query string
- String[] queryValues = queryParameterMap.get(paramName);
-
- //
- if (queryValues != null)
- {
- int bodyValuesLength = paramValues.length - queryValues.length;
- if (bodyValuesLength > 0)
- {
- String[] bodyValues = new String[bodyValuesLength];
- System.arraycopy(paramValues, queryValues.length, bodyValues, 0, bodyValuesLength);
- bodyParameterMap.put(paramName, bodyValues);
- }
- }
- else
- {
- bodyParameterMap.put(paramName, paramValues);
- }
- }
-
- //
- body = new Body.Form(req.getCharacterEncoding(), bodyParameterMap);
- }
- else
- {
- body = new Body.Raw(req.getCharacterEncoding(), req);
- }
- }
-
//
this.verb = verb;
- this.queryParameterMap = queryParameterMap;
- this.body = body;
- this.mediaType = mediaType;
+ this.queryParameterMap = decoder.getQueryParameters();
+ this.body = decoder.getBody();
+ this.mediaType = decoder.getMediaType();
}
public Verb getVerb()
Added: modules/web/trunk/web/src/main/java/org/jboss/portal/web/util/RequestDecoder.java
===================================================================
--- modules/web/trunk/web/src/main/java/org/jboss/portal/web/util/RequestDecoder.java (rev 0)
+++ modules/web/trunk/web/src/main/java/org/jboss/portal/web/util/RequestDecoder.java 2008-04-18 13:23:00 UTC (rev 10646)
@@ -0,0 +1,167 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.web.util;
+
+import org.jboss.portal.web.Body;
+import org.jboss.portal.web.IllegalRequestException;
+import org.jboss.portal.common.http.QueryStringParser;
+import org.jboss.portal.common.net.media.MediaType;
+import org.jboss.portal.common.net.media.ContentType;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+import java.util.Collections;
+import java.util.HashMap;
+import java.nio.charset.Charset;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Useful request decoder.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RequestDecoder
+{
+
+ /** . */
+ private static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
+
+ /** . */
+ private final MediaType mediaType;
+
+ /** . */
+ private final Map<String, String[]> queryParameters;
+
+ /** . */
+ private final Body body;
+
+ public RequestDecoder(HttpServletRequest request) throws UnsupportedEncodingException
+ {
+ if (request == null)
+ {
+ throw new IllegalArgumentException("No null http request accepted");
+ }
+
+ // Parse the query string to have the get parameters
+ // The resulting map has its parameters decoded from the x-www-form-url encoding
+ String queryString = request.getQueryString();
+ if (queryString != null)
+ {
+ queryParameters = QueryStringParser.getInstance().parseQueryString(queryString);
+ }
+ else
+ {
+ queryParameters = Collections.emptyMap();
+ }
+
+ if (request.getContentType() != null)
+ {
+ ContentType contentType = ContentType.create(request.getContentType());
+ mediaType = contentType.getMediaType();
+ }
+ else
+ {
+ mediaType = null;
+ }
+
+ //
+ if ("POST".equals(request.getMethod()))
+ {
+ if (MediaType.APPLICATION_X_WWW_FORM_URLENCODED.equals(mediaType))
+ {
+ // Now we must ensure that we have either an equals or a trailing space after the media-type
+ String characterEncoding = request.getCharacterEncoding();
+ if (characterEncoding == null)
+ {
+ // Set out charset for the request
+ request.setCharacterEncoding(UTF_8_CHARSET.name());
+ }
+ else
+ {
+ Charset charset = Charset.forName(characterEncoding);
+ if (!UTF_8_CHARSET.equals(charset))
+ {
+ throw new IllegalRequestException("Charset " + characterEncoding + " not accepted, it should be UTF8");
+ }
+ }
+
+ //
+ Map<String, String[]> bodyParameterMap = new HashMap<String, String[]>();
+ for (Map.Entry<String, String[]> entry : ((Map<String, String[]>)request.getParameterMap()).entrySet())
+ {
+ // Get param name
+ String paramName = entry.getKey();
+
+ // Values that are aggregated from the query string and the body
+ String[] paramValues = entry.getValue();
+
+ // Values decoded from the query string
+ String[] queryValues = queryParameters.get(paramName);
+
+ //
+ if (queryValues != null)
+ {
+ int bodyValuesLength = paramValues.length - queryValues.length;
+ if (bodyValuesLength > 0)
+ {
+ String[] bodyValues = new String[bodyValuesLength];
+ System.arraycopy(paramValues, queryValues.length, bodyValues, 0, bodyValuesLength);
+ bodyParameterMap.put(paramName, bodyValues);
+ }
+ }
+ else
+ {
+ bodyParameterMap.put(paramName, paramValues);
+ }
+ }
+
+ //
+ body = new Body.Form(request.getCharacterEncoding(), bodyParameterMap);
+ }
+ else
+ {
+ body = new Body.Raw(request.getCharacterEncoding(), request);
+ }
+ }
+ else
+ {
+ body = null;
+ }
+ }
+
+ public MediaType getMediaType()
+ {
+ return mediaType;
+ }
+
+ public Map<String, String[]> getQueryParameters()
+ {
+ return queryParameters;
+ }
+
+ public Body getBody()
+ {
+ return body;
+ }
+}
18 years
JBoss Portal SVN: r10645 - in modules/portlet/trunk: controller/src/main/java/org/jboss/portal/portlet/controller/impl and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-18 08:32:38 -0400 (Fri, 18 Apr 2008)
New Revision: 10645
Added:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestFactory.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestParameterMapFactory.java
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestParameterNames.java
Removed:
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/
Modified:
modules/portlet/trunk/build/pom.xml
modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/PortletURLRenderer.java
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java
Log:
uncommited change
Modified: modules/portlet/trunk/build/pom.xml
===================================================================
--- modules/portlet/trunk/build/pom.xml 2008-04-18 12:05:32 UTC (rev 10644)
+++ modules/portlet/trunk/build/pom.xml 2008-04-18 12:32:38 UTC (rev 10645)
@@ -33,7 +33,7 @@
<version.jboss-logging>2.0.3.GA</version.jboss-logging>
<version.jbossxb>2.0.0.CR5</version.jbossxb>
<version.jboss-remoting>2.2.1.GA</version.jboss-remoting>
- <version.jboss.portal.common>1.2.0.Beta3</version.jboss.portal.common>
+ <version.jboss.portal.common>1.2.0-SNAPSHOT</version.jboss.portal.common>
<version.jboss.portal.web>1.2.0.Beta3</version.jboss.portal.web>
<version.jboss.unit>1.2.0.Beta2</version.jboss.unit>
<version.log4j>1.2.14</version.log4j>
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestFactory.java (from rev 10614, modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestFactory.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestFactory.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestFactory.java 2008-04-18 12:32:38 UTC (rev 10645)
@@ -0,0 +1,199 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.controller.impl;
+
+import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
+import org.jboss.portal.portlet.controller.state.PortletWindowNavigationalState;
+import org.jboss.portal.portlet.controller.request.ControllerRequest;
+import org.jboss.portal.portlet.controller.request.PortletActionRequest;
+import org.jboss.portal.portlet.controller.request.PortletRenderRequest;
+import org.jboss.portal.portlet.controller.request.PortletResourceRequest;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.cache.CacheLevel;
+import org.jboss.portal.common.util.Base64;
+import org.jboss.portal.common.util.MapAdapters;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+
+import java.util.Map;
+
+/**
+ * A factory that provides a way to create ControllerRequest. This factory is just a default implementation
+ * and is not an authority which means that any client of the controller framework is free to determine how
+ * a controller request is created.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerRequestFactory
+{
+
+ /** . */
+ private final Serialization<PortletPageNavigationalState> serialization;
+
+ public ControllerRequestFactory(Serialization<PortletPageNavigationalState> serialization)
+ {
+ this.serialization = serialization;
+ }
+
+ /**
+ * Create a controller request.
+ *
+ * @param req the web request
+ * @return the decoded controller request
+ */
+ public ControllerRequest decode(WebRequest req)
+ {
+ Map<String, String[]> bodyParameters = null;
+
+ //
+ Body body = req.getBody();
+ if (body instanceof Body.Form)
+ {
+ bodyParameters = ((Body.Form)body).getParameters();
+ }
+
+ //
+ return decode(req.getQueryParameterMap(), bodyParameters);
+ }
+
+ /**
+ * Create a controller request.
+ *
+ * @param queryParameterMap the query parameter map
+ * @param formParameterMap the optional form parameter map
+ * @return the decoded controller request
+ */
+ public ControllerRequest decode(Map<String, String[]> queryParameterMap, Map<String, String[]> formParameterMap)
+ {
+ Map<String, String> queryParameters = MapAdapters.adapt(queryParameterMap);
+
+ // The nav state provided with the request
+ // Unmarshall portal navigational state if it is provided
+ PortletPageNavigationalState pageNavigationalState = null;
+ String context = queryParameters.get(ControllerRequestParameterNames.PAGE_NAVIGATIONAL_STATE);
+ if (context != null)
+ {
+ byte[] bytes = Base64.decode(context, true);
+ pageNavigationalState = IOTools.unserialize(serialization, SerializationFilter.COMPRESSOR, bytes);
+ }
+
+ // Get the window id
+ String windowId = queryParameters.get(ControllerRequestParameterNames.WINDOW_ID);
+
+ //
+ Mode mode = null;
+ if (queryParameters.get(ControllerRequestParameterNames.MODE) != null)
+ {
+ mode = Mode.create(queryParameters.get(ControllerRequestParameterNames.MODE));
+ }
+
+ //
+ WindowState windowState = null;
+ if (queryParameters.get(ControllerRequestParameterNames.WINDOW_STATE) != null)
+ {
+ windowState = WindowState.create(queryParameters.get(ControllerRequestParameterNames.WINDOW_STATE));
+ }
+
+ //
+ String navigationalStateString = queryParameters.get(ControllerRequestParameterNames.NAVIGATIONAL_STATE);
+ StateString navigationalState = null;
+ if (navigationalStateString != null)
+ {
+ navigationalState = ParametersStateString.create(navigationalStateString);
+ }
+
+ //
+ PortletWindowNavigationalState windowNavigationalState = new PortletWindowNavigationalState(navigationalState, mode, windowState);
+
+ //
+ String phase = queryParameters.get(ControllerRequestParameterNames.LIFECYCLE_PHASE);
+ if (ControllerRequestParameterNames.RESOURCE_PHASE.equals(phase))
+ {
+ StateString resourceState = ParametersStateString.create(queryParameters.get(ControllerRequestParameterNames.RESOURCE_STATE));
+ String resourceId = queryParameters.get(ControllerRequestParameterNames.RESOURCE_ID);
+
+ //
+ CacheLevel resourceCacheLevel = CacheLevel.valueOf(queryParameters.get(ControllerRequestParameterNames.RESOURCE_CACHEABILITY));
+
+ //
+ PortletResourceRequest.Scope scope;
+ switch (resourceCacheLevel)
+ {
+ case FULL:
+ scope = new PortletResourceRequest.FullScope();
+ break;
+ case PORTLET:
+ scope = new PortletResourceRequest.PortletScope(windowNavigationalState);
+ break;
+ case PAGE:
+ scope = new PortletResourceRequest.PageScope(windowNavigationalState, pageNavigationalState);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ return new PortletResourceRequest(
+ windowId,
+ resourceId,
+ resourceState,
+ formParameterMap,
+ scope);
+ }
+ else
+ {
+ if (ControllerRequestParameterNames.ACTION_PHASE.equals(phase))
+ {
+ StateString interactionState = ParametersStateString.create(queryParameters.get(ControllerRequestParameterNames.INTERACTION_STATE));
+
+ //
+ return new PortletActionRequest(
+ windowId,
+ interactionState,
+ formParameterMap,
+ windowNavigationalState,
+ pageNavigationalState);
+ }
+ else
+ {
+ byte[] bytes = Base64.decode(queryParameters.get(ControllerRequestParameterNames.PUBLIC_NAVIGATIONAL_STATE_CHANGES), true);
+ Map<String, String[]> publicNavigationalStateChanges = IOTools.unserialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, bytes);
+
+ //
+ return new PortletRenderRequest(
+ windowId,
+ windowNavigationalState,
+ publicNavigationalStateChanges,
+ pageNavigationalState);
+ }
+ }
+ }
+
+}
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestParameterMapFactory.java (from rev 10614, modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterMapFactory.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestParameterMapFactory.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestParameterMapFactory.java 2008-04-18 12:32:38 UTC (rev 10645)
@@ -0,0 +1,196 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.controller.impl;
+
+import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.ResourceURL;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.cache.CacheLevel;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.io.Serialization;
+import org.jboss.portal.common.util.Base64;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerRequestParameterMapFactory
+{
+
+ /** . */
+ private final Serialization<PortletPageNavigationalState> serialization;
+
+ public ControllerRequestParameterMapFactory(Serialization<PortletPageNavigationalState> serialization)
+ {
+ this.serialization = serialization;
+ }
+
+ public Map<String, String> encode(PortletPageNavigationalState pageNS, String windowId, ContainerURL containerURL)
+ {
+ Map<String, String> parameters = new HashMap<String, String>();
+
+ //
+ parameters.put(ControllerRequestParameterNames.WINDOW_ID, windowId);
+
+ //
+ String type;
+ if (containerURL instanceof ActionURL)
+ {
+ type = ControllerRequestParameterNames.ACTION_PHASE;
+ }
+ else if (containerURL instanceof RenderURL)
+ {
+ type = ControllerRequestParameterNames.RENDER_PHASE;
+ }
+ else if (containerURL instanceof ResourceURL)
+ {
+ type = ControllerRequestParameterNames.RESOURCE_PHASE;
+ }
+ else
+ {
+ throw new Error();
+ }
+ parameters.put(ControllerRequestParameterNames.LIFECYCLE_PHASE, type);
+
+
+ //
+ String pageNavigationalState = null;
+ if (pageNS != null)
+ {
+ byte[] bytes = IOTools.serialize(serialization, SerializationFilter.COMPRESSOR, pageNS);
+ pageNavigationalState = Base64.encodeBytes(bytes, true);
+ }
+
+ //
+ if (containerURL instanceof PortletURL)
+ {
+ PortletURL portletURL = (PortletURL)containerURL;
+
+ if (portletURL.getMode() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.MODE, portletURL.getMode().toString());
+ }
+
+ //
+ if (portletURL.getWindowState() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.WINDOW_STATE, portletURL.getWindowState().toString());
+ }
+
+ //
+ if (pageNavigationalState != null)
+ {
+ parameters.put(ControllerRequestParameterNames.PAGE_NAVIGATIONAL_STATE, pageNavigationalState);
+ }
+
+ //
+ if (containerURL instanceof ActionURL)
+ {
+ ActionURL actionURL = (ActionURL)containerURL;
+
+ //
+ if (actionURL.getNavigationalState() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, actionURL.getNavigationalState().getStringValue());
+ }
+
+ //
+ StateString interactionState = actionURL.getInteractionState();
+ parameters.put(ControllerRequestParameterNames.INTERACTION_STATE, interactionState.getStringValue());
+ }
+ else
+ {
+ RenderURL renderURL = (RenderURL)containerURL;
+
+ //
+ Map<String, String[]> changes = renderURL.getPublicNavigationalStateChanges();
+ byte[] bytes = IOTools.serialize(Serialization.PARAMETER_MAP, SerializationFilter.COMPRESSOR, changes);
+ String ns = Base64.encodeBytes(bytes, true);
+ parameters.put(ControllerRequestParameterNames.PUBLIC_NAVIGATIONAL_STATE_CHANGES, ns);
+
+ //
+ StateString navigationalState = renderURL.getNavigationalState();
+ if (navigationalState != null)
+ {
+ parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, navigationalState.getStringValue());
+ }
+ }
+ }
+ else
+ {
+ ResourceURL resourceURL = (ResourceURL)containerURL;
+
+ //
+ StateString resourceState = resourceURL.getResourceState();
+ parameters.put(ControllerRequestParameterNames.RESOURCE_STATE, resourceState.getStringValue());
+
+ //
+ String resourceId = resourceURL.getResourceId();
+ if (resourceId != null)
+ {
+ parameters.put(ControllerRequestParameterNames.RESOURCE_ID, resourceId);
+ }
+
+ //
+ CacheLevel cacheability = resourceURL.getCacheability();
+ parameters.put(ControllerRequestParameterNames.RESOURCE_CACHEABILITY, cacheability.name());
+
+ //
+ if (cacheability != CacheLevel.FULL)
+ {
+ if (resourceURL.getNavigationalState() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.NAVIGATIONAL_STATE, resourceURL.getNavigationalState().getStringValue());
+ }
+
+ //
+ if (resourceURL.getMode() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.MODE, resourceURL.getMode().toString());
+ }
+
+ //
+ if (resourceURL.getWindowState() != null)
+ {
+ parameters.put(ControllerRequestParameterNames.WINDOW_STATE, resourceURL.getWindowState().toString());
+ }
+
+ if (cacheability == CacheLevel.PAGE && pageNavigationalState != null)
+ {
+ parameters.put(ControllerRequestParameterNames.PAGE_NAVIGATIONAL_STATE, pageNavigationalState);
+ }
+ }
+ }
+
+ //
+ return parameters;
+ }
+}
Copied: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestParameterNames.java (from rev 10614, modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/request/ControllerRequestParameterNames.java)
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestParameterNames.java (rev 0)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/ControllerRequestParameterNames.java 2008-04-18 12:32:38 UTC (rev 10645)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.controller.impl;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerRequestParameterNames
+{
+ /**
+ * The life cycle type of the invocation. The values accepted are <code>ACTION_LIFECYCLE</code>,
+ * <code>RENDER_LIFECYCLE</code> and <code>RESOURCE_LIFECYCLE</code>.
+ */
+ public static final String LIFECYCLE_PHASE = "phase";
+
+ /** The window id. */
+ public static final String WINDOW_ID = "windowid";
+
+ /** The portlet mode. */
+ public static final String MODE = "mode";
+
+ /** The window state. */
+ public static final String WINDOW_STATE = "windowstate";
+
+ /** The portlet navigational state for any type of lifecycle. */
+ public static final String NAVIGATIONAL_STATE = "navigationalstate";
+
+ /** The portlet resource state for lifecycle of type <code>RENDER_LIFECYCLE</code>. */
+ public static final String RESOURCE_STATE = "resourcestate";
+
+ /** The portlet interaction state for lifecycle of type <code>ACTION_LIFECYCLE</code>. */
+ public static final String INTERACTION_STATE = "interactionstate";
+
+ /** The page state for any kind of lifecycle. */
+ public static final String PAGE_NAVIGATIONAL_STATE = "pagenavigationalstate";
+
+ /** The public navigational state changes of a portlet for lifecycle of type <code>RENDER_LIFECYCLE</code>. */
+ public static final String PUBLIC_NAVIGATIONAL_STATE_CHANGES = "publicnavigationalstatechanges";
+
+ /** The resource id for lifecycle of type <code>RESOURCE_LIFECYCLE</code>. */
+ public static final String RESOURCE_ID = "resourceid";
+
+ /** The resource cacheability for lifecycle of type <code>RESOURCE_LIFECYCLE</code>. */
+ public static final String RESOURCE_CACHEABILITY = "resourcecacheability";
+
+ /** Denotes an action lifecycle operation. */
+ public static final String ACTION_PHASE = "action";
+
+ /** Denotes a render lifecycle operation. */
+ public static final String RENDER_PHASE = "render";
+
+ /** Denotes a resource lifecycle operation. */
+ public static final String RESOURCE_PHASE = "resource";
+}
Modified: modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/PortletURLRenderer.java
===================================================================
--- modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/PortletURLRenderer.java 2008-04-18 12:05:32 UTC (rev 10644)
+++ modules/portlet/trunk/controller/src/main/java/org/jboss/portal/portlet/controller/impl/PortletURLRenderer.java 2008-04-18 12:32:38 UTC (rev 10645)
@@ -32,8 +32,8 @@
import org.jboss.portal.portlet.ContainerURL;
import org.jboss.portal.portlet.URLFormat;
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
-import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
-import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterMapFactory;
+import org.jboss.portal.portlet.controller.impl.ControllerRequestParameterNames;
+import org.jboss.portal.portlet.controller.impl.ControllerRequestParameterMapFactory;
import static org.jboss.portal.portlet.controller.impl.URLParameterConstants.*;
import javax.servlet.http.HttpServletRequest;
@@ -141,7 +141,7 @@
ControllerRequestParameterMapFactory factory = new ControllerRequestParameterMapFactory(serialization);
//
- Map<String, String> parameters = factory.blah(pageNS, windowId, containerURL);
+ Map<String, String> parameters = factory.encode(pageNS, windowId, containerURL);
//
parameters.put(TYPE, PORTLET_TYPE);
Modified: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java 2008-04-18 12:05:32 UTC (rev 10644)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java 2008-04-18 12:32:38 UTC (rev 10645)
@@ -24,6 +24,7 @@
import org.jboss.portal.portlet.controller.impl.PortletURLRenderer;
import org.jboss.portal.portlet.controller.impl.URLParameterConstants;
+import org.jboss.portal.portlet.controller.impl.ControllerRequestFactory;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.URLFormat;
@@ -34,9 +35,8 @@
import org.jboss.portal.portlet.invocation.response.UnavailableResponse;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.request.PortletActionRequest;
-import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
+import org.jboss.portal.portlet.controller.impl.ControllerRequestParameterNames;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
-import org.jboss.portal.portlet.controller.impl.request.ControllerRequestParameterNames;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
import org.jboss.portal.portlet.controller.response.ResourceResponse;
@@ -119,7 +119,7 @@
{
WebRequest wr = new WebRequest(req);
ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
- ControllerRequest request = factory.createRequest(wr);
+ ControllerRequest request = factory.decode(wr);
ControllerResponse controllerResponse;
try
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-04-18 12:05:32 UTC (rev 10644)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortalServlet.java 2008-04-18 12:32:38 UTC (rev 10645)
@@ -23,7 +23,7 @@
package org.jboss.portal.portlet.test;
import org.jboss.portal.portlet.controller.PortletController;
-import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
+import org.jboss.portal.portlet.controller.impl.ControllerRequestFactory;
import org.jboss.portal.portlet.controller.impl.URLParameterConstants;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
@@ -86,7 +86,7 @@
{
WebRequest wr = new WebRequest(req);
ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
- ControllerRequest request = factory.createRequest(wr);
+ ControllerRequest request = factory.decode(wr);
//
ControllerResponse response = controller.process(context, request);
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java 2008-04-18 12:05:32 UTC (rev 10644)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/tck/TCKServlet.java 2008-04-18 12:32:38 UTC (rev 10645)
@@ -26,10 +26,10 @@
import org.jboss.portal.portlet.test.controller.ControllerResponseRendererFactory;
import org.jboss.portal.portlet.test.controller.PageRenderer;
import org.jboss.portal.portlet.controller.impl.URLParameterConstants;
+import org.jboss.portal.portlet.controller.impl.ControllerRequestFactory;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.request.ControllerRequest;
-import org.jboss.portal.portlet.controller.impl.request.ControllerRequestFactory;
import org.jboss.portal.portlet.invocation.response.ResponseProperties;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.web.WebRequest;
@@ -92,7 +92,7 @@
{
WebRequest wr = new WebRequest(req);
ControllerRequestFactory factory = new ControllerRequestFactory(context.getPageNavigationalStateSerialization());
- ControllerRequest request = factory.createRequest(wr);
+ ControllerRequest request = factory.decode(wr);
// We must have one!!!
TCKPortletPageNavigationalState tckPageNavigationalState = (TCKPortletPageNavigationalState)request.getPageNavigationalState();
18 years
JBoss Portal SVN: r10644 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-18 08:05:32 -0400 (Fri, 18 Apr 2008)
New Revision: 10644
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvokerInterceptor.java
Log:
uncommited change
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvokerInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvokerInterceptor.java 2008-04-18 12:02:38 UTC (rev 10643)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/invocation/PortletInvokerInterceptor.java 2008-04-18 12:05:32 UTC (rev 10644)
@@ -1,143 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.portlet.invocation;
-
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.portlet.PortletContext;
-import org.jboss.portal.portlet.state.DestroyCloneFailure;
-import org.jboss.portal.portlet.state.PropertyMap;
-import org.jboss.portal.portlet.state.PropertyChange;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-
-import java.util.Set;
-import java.util.List;
-
-/**
- * A base class for {@link org.jboss.portal.portlet.PortletInvoker} interface interceptors. The subclasses
- * extends it and override the intercepted methods. The next interceptor in the chain is wired in the field
- * {@link #next} of the interceptor. When the interceptor wants to give control to the next interceptor, it must
- * invoke the same method on the super class. If no next interceptor is configured the invocation of the parent
- * method will throw an {@link IllegalStateException}.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PortletInvokerInterceptor implements PortletInvoker
-{
-
- /** . */
- private PortletInvoker next;
-
- public PortletInvokerInterceptor()
- {
- }
-
- public PortletInvokerInterceptor(PortletInvoker next)
- {
- this.next = next;
- }
-
- public PortletInvoker getNext()
- {
- return next;
- }
-
- public void setNext(PortletInvoker next)
- {
- this.next = next;
- }
-
- public Set<Portlet> getPortlets() throws PortletInvokerException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.getPortlets();
- }
-
- public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.getPortlet(portletContext);
- }
-
- public PortletInvocationResponse invoke(PortletInvocation invocation) throws IllegalArgumentException, PortletInvokerException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.invoke(invocation);
- }
-
- public PortletContext createClone(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.createClone(portletContext);
- }
-
- public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.destroyClones(portletContexts);
- }
-
- public PropertyMap getProperties(PortletContext portletContext, Set<String> keys) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.getProperties(portletContext, keys);
- }
-
- public PropertyMap getProperties(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.getProperties(portletContext);
- }
-
- public PortletContext setProperties(PortletContext portletContext, PropertyChange[] changes) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
- {
- if (next == null)
- {
- throw new IllegalStateException("No next invoker");
- }
- return next.setProperties(portletContext, changes);
- }
-}
18 years
JBoss Portal SVN: r10643 - modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-18 08:02:38 -0400 (Fri, 18 Apr 2008)
New Revision: 10643
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java
Log:
move presentation server impl to presentation package so it can be reused by ajax client
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/PresentationServerImpl.java 2008-04-18 12:02:38 UTC (rev 10643)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.presentation.impl.server;
+
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.impl.state.structural.StructuralNode;
+import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
+import org.jboss.portal.presentation.impl.state.structural.WindowNode;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.protocol.ErrorResponse;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+import org.jboss.portal.presentation.protocol.UIObjectAction;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.server.PresentationRequest;
+import org.jboss.portal.presentation.server.PresentationResponse;
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.presentation.state.structural.StructuralStateContext;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PresentationServerImpl implements PresentationServer
+{
+
+ /** . */
+ private StructuralStateContextImpl structuralStateContext;
+
+ public PresentationServerImpl(StructuralStateContextImpl structuralStateContext)
+ {
+ this.structuralStateContext = structuralStateContext;
+ }
+
+ public StructuralStateContext getStructuralStateContext()
+ {
+ return structuralStateContext;
+ }
+
+ public String render(ProtocolAction action) throws IllegalArgumentException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
+ {
+ StructuralNode node = structuralStateContext.getNode(windowId);
+
+ //
+ if (node instanceof WindowNode)
+ {
+ WindowNode window = (WindowNode)node;
+
+
+
+
+
+
+
+ return new WindowContent(0, "Window " + window.getName(), window.getContent());
+ }
+ else
+ {
+ throw new PresentationServerException("No such window " + windowId);
+ }
+ }
+
+ public PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException
+ {
+ ProtocolAction action = request.getProtocolAction();
+
+ if (action instanceof UIObjectAction)
+ {
+ UIObjectAction objectAction = (UIObjectAction)action;
+
+ //
+ String targetId = objectAction.getTargetId();
+
+ //
+ StructuralNode targetNode = structuralStateContext.getNode(targetId);
+
+ //
+ if (targetNode == null)
+ {
+ return new PresentationResponse(new ErrorResponse(404));
+ }
+
+ //
+ if (objectAction instanceof ViewUIObjectAction)
+ {
+ return new PresentationResponse(new ShowUIObjectResponse(targetId));
+ }
+ }
+
+ //
+ throw new UnsupportedOperationException();
+ }
+}
18 years
JBoss Portal SVN: r10642 - in modules/presentation/trunk: classic/src/main/java/org/jboss/portal/presentation and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-18 08:01:57 -0400 (Fri, 18 Apr 2008)
New Revision: 10642
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/
Removed:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
Modified:
modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
Log:
move presentation server impl to presentation package so it can be reused by ajax client
Modified: modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml 2008-04-18 11:49:40 UTC (rev 10641)
+++ modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml 2008-04-18 12:01:57 UTC (rev 10642)
@@ -31,7 +31,7 @@
</bean>
<bean
name="PresentationServer"
- class="org.jboss.portal.presentation.PresentationServerImpl">
+ class="org.jboss.portal.presentation.impl.server.PresentationServerImpl">
<constructor>
<parameter><inject bean="StructuralStateContext"/></parameter>
</constructor>
Deleted: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-18 11:49:40 UTC (rev 10641)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-18 12:01:57 UTC (rev 10642)
@@ -1,119 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.presentation;
-
-import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.impl.state.structural.StructuralNode;
-import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
-import org.jboss.portal.presentation.impl.state.structural.WindowNode;
-import org.jboss.portal.presentation.model.content.WindowContent;
-import org.jboss.portal.presentation.protocol.ErrorResponse;
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
-import org.jboss.portal.presentation.protocol.UIObjectAction;
-import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
-import org.jboss.portal.presentation.server.PresentationRequest;
-import org.jboss.portal.presentation.server.PresentationResponse;
-import org.jboss.portal.presentation.server.PresentationServer;
-import org.jboss.portal.presentation.server.PresentationServerException;
-import org.jboss.portal.presentation.state.structural.StructuralStateContext;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationServerImpl implements PresentationServer
-{
-
- /** . */
- private StructuralStateContextImpl structuralStateContext;
-
- public PresentationServerImpl(StructuralStateContextImpl structuralStateContext)
- {
- this.structuralStateContext = structuralStateContext;
- }
-
- public StructuralStateContext getStructuralStateContext()
- {
- return structuralStateContext;
- }
-
- public String render(ProtocolAction action) throws IllegalArgumentException
- {
- throw new UnsupportedOperationException();
- }
-
- public WindowContent renderWindow(PresentationClient client, String windowId) throws PresentationServerException
- {
- StructuralNode node = structuralStateContext.getNode(windowId);
-
- //
- if (node instanceof WindowNode)
- {
- WindowNode window = (WindowNode)node;
-
-
-
-
-
-
-
- return new WindowContent(0, "Window " + window.getName(), window.getContent());
- }
- else
- {
- throw new PresentationServerException("No such window " + windowId);
- }
- }
-
- public PresentationResponse process(PresentationClient client, PresentationRequest request) throws PresentationServerException
- {
- ProtocolAction action = request.getProtocolAction();
-
- if (action instanceof UIObjectAction)
- {
- UIObjectAction objectAction = (UIObjectAction)action;
-
- //
- String targetId = objectAction.getTargetId();
-
- //
- StructuralNode targetNode = structuralStateContext.getNode(targetId);
-
- //
- if (targetNode == null)
- {
- return new PresentationResponse(new ErrorResponse(404));
- }
-
- //
- if (objectAction instanceof ViewUIObjectAction)
- {
- return new PresentationResponse(new ShowUIObjectResponse(targetId));
- }
- }
-
- //
- throw new UnsupportedOperationException();
- }
-}
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-18 11:49:40 UTC (rev 10641)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-18 12:01:57 UTC (rev 10642)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.classic;
import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.presentation.PresentationServerImpl;
+import org.jboss.portal.presentation.impl.server.PresentationServerImpl;
import org.jboss.portal.presentation.impl.state.structural.ContextNode;
import org.jboss.portal.presentation.impl.state.structural.NodeImporter;
import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
18 years
JBoss Portal SVN: r10641 - modules/common/trunk/common/src/main/java/org/jboss/portal/common/io.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-18 07:49:40 -0400 (Fri, 18 Apr 2008)
New Revision: 10641
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java
Log:
replace on IOTools safeClose(reader/inputstream/outputstream/writer) with safeClose(Closeable)
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java 2008-04-18 11:49:14 UTC (rev 10640)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java 2008-04-18 11:49:40 UTC (rev 10641)
@@ -136,7 +136,7 @@
}
catch (IOException e)
{
- log.error("Error while closing outstream", e);
+ log.error("Error while closing closeable " + out, e);
}
}
}
18 years
JBoss Portal SVN: r10640 - modules/common/trunk/common/src/main/java/org/jboss/portal/common/io.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-04-18 07:49:14 -0400 (Fri, 18 Apr 2008)
New Revision: 10640
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java
Log:
replace on IOTools safeClose(reader/inputstream/outputstream/writer) with safeClose(Closeable)
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java 2008-04-18 10:41:57 UTC (rev 10639)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/io/IOTools.java 2008-04-18 11:49:14 UTC (rev 10640)
@@ -41,6 +41,7 @@
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ObjectStreamClass;
+import java.io.Closeable;
/**
* IO tools.
@@ -120,12 +121,12 @@
}
/**
- * <p>Attempt to close an <code>OutputStream</code>. Null argument value is authorized and no operation will be performed in that
- * use case.</p>
+ * <p>Attempt to close an {@link Closeable} object. Null argument value is authorized and no operation will be performed in that
+ * use case. {@link IOException} thrown are logged using the <code>error</code> level but not propagated.</p>
*
* @param out the stream to close
*/
- public static void safeClose(OutputStream out)
+ public static void safeClose(Closeable out)
{
if (out != null)
{
@@ -141,69 +142,6 @@
}
/**
- * <p>Attempt to close an <code>InputStream</code>. Null argument value is authorized and no operation will be performed in that
- * use case.</p>
- *
- * @param in the stream to close
- */
- public static void safeClose(InputStream in)
- {
- if (in != null)
- {
- try
- {
- in.close();
- }
- catch (IOException e)
- {
- log.error("Error while closing inputstream", e);
- }
- }
- }
-
- /**
- * <p>Attempt to close an <code>Reader</code>. Null argument value is authorized and no operation will be performed in that
- * use case.</p>
- *
- * @param reader the stream to close
- */
- public static void safeClose(Reader reader)
- {
- if (reader != null)
- {
- try
- {
- reader.close();
- }
- catch (IOException e)
- {
- log.error("Error while closing reader", e);
- }
- }
- }
-
- /**
- * <p>Attempt to close an <code>Writer</code>. Null argument value is authorized and no operation will be performed in that
- * use case.</p>
- *
- * @param writer the stream to close
- */
- public static void safeClose(Writer writer)
- {
- if (writer != null)
- {
- try
- {
- writer.close();
- }
- catch (IOException e)
- {
- log.error("Error while closing writer", e);
- }
- }
- }
-
- /**
* @see #getBytes(java.io.InputStream, int)
* @param in the input stream
* @return the bytes read from the stream
18 years
JBoss Portal SVN: r10639 - modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-04-18 06:41:57 -0400 (Fri, 18 Apr 2008)
New Revision: 10639
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
Log:
fix connection pooling settings
Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2008-04-18 08:59:41 UTC (rev 10638)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2008-04-18 10:41:57 UTC (rev 10639)
@@ -110,27 +110,31 @@
env.put(CONNECTION_POOL, "true");
if (getPoolingDebug() != null)
{
- env.put(CONNECTION_POOL_DEBUG, getPoolingDebug());
+ System.setProperty(CONNECTION_POOL_DEBUG, getPoolingDebug());
}
if (getPoolingInitsize() != null)
{
- env.put(CONNECTION_POOL_INITSIZE, getPoolingInitsize());
+ System.setProperty(CONNECTION_POOL_INITSIZE, getPoolingInitsize());
}
if (getPoolingMaxsize() != null)
{
- env.put(CONNECTION_POOL_MAXSIZE, getPoolingMaxsize());
+ System.setProperty(CONNECTION_POOL_MAXSIZE, getPoolingMaxsize());
}
if (getPoolingPrefsize() != null)
{
- env.put(CONNECTION_POOL_PREFSIZE, getPoolingPrefsize());
+ System.setProperty(CONNECTION_POOL_PREFSIZE, getPoolingPrefsize());
}
if (getPoolingProtocol() != null)
{
- env.put(CONNECTION_POOL_PROTOCOL, getPoolingProtocol());
+ System.setProperty(CONNECTION_POOL_PROTOCOL, getPoolingProtocol());
}
+ else
+ {
+ System.setProperty(CONNECTION_POOL_PROTOCOL, "plain ssl");
+ }
if (getPoolingTimeout() != null)
{
- env.put(CONNECTION_POOL_TIMEOUT, getPoolingTimeout());
+ System.setProperty(CONNECTION_POOL_TIMEOUT, getPoolingTimeout());
}
}
18 years