You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by ja...@apache.org on 2003/12/08 16:53:07 UTC
cvs commit: ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto WSRPDynamicInformationProvider.java
jacob 2003/12/08 07:53:07
Modified: src/org/apache/wsrp4j/producer/provider/pluto/driver
PortletURLProviderImpl.java PortletInvokerImpl.java
DynamicInformationProviderImpl.java
src/org/apache/wsrp4j/producer/provider/pluto
WSRPDynamicInformationProvider.java
Log:
set navigational state from render params
TODO: need portlet to test this
Revision Changes Path
1.2 +62 -62 ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto/driver/PortletURLProviderImpl.java
Index: PortletURLProviderImpl.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto/driver/PortletURLProviderImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PortletURLProviderImpl.java 3 Sep 2003 20:29:31 -0000 1.1
+++ PortletURLProviderImpl.java 8 Dec 2003 15:53:07 -0000 1.2
@@ -1,62 +1,57 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "WSRP4J", and "Apache Software
- * Foundation" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * or "WSRP4J", nor may "Apache" or "WSRP4J" appear in their name,
- * without prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
-
- */
-
-
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "WSRP4J", and "Apache Software
+ * Foundation" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * or "WSRP4J", nor may "Apache" or "WSRP4J" appear in their name,
+ * without prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.wsrp4j.producer.provider.pluto.driver;
import java.io.IOException;
@@ -77,6 +72,7 @@
import org.apache.wsrp4j.log.Logger;
import org.apache.wsrp4j.producer.provider.Provider;
import org.apache.wsrp4j.producer.provider.URLComposer;
+import org.apache.wsrp4j.producer.provider.pluto.WSRPDynamicInformationProvider;
import org.apache.wsrp4j.producer.util.Base64;
import org.apache.wsrp4j.producer.util.MapSerializer;
@@ -108,8 +104,7 @@
//clear render parameters
private boolean clearParameters = false;
- //private Map actionParameters = null;
- //private Map renderParameters = null;
+ // render params
private Map parameters = null;
//provider
@@ -126,7 +121,7 @@
// wsrp portlet context
private PortletContext portletContext = null;
-
+
/**
Default constructor
@param request as HttpServletRequest
@@ -202,6 +197,11 @@
// since we are not served correctly from the portleturl implementation
// we convert all values in the map to arrays of type string
convertToArrayMap();
+
+ // in addition store as request attribute
+ // needed to allow our portlet invoker to set navigational state after
+ // action processing returned
+ request.setAttribute(WSRPDynamicInformationProvider.RENDER_PARAMS, this.parameters);
}
/**
1.4 +19 -5 ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto/driver/PortletInvokerImpl.java
Index: PortletInvokerImpl.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto/driver/PortletInvokerImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PortletInvokerImpl.java 5 Dec 2003 15:59:31 -0000 1.3
+++ PortletInvokerImpl.java 8 Dec 2003 15:53:07 -0000 1.4
@@ -85,6 +85,7 @@
import org.apache.wsrp4j.producer.provider.pluto.WSRPDynamicInformationProvider;
import org.apache.wsrp4j.producer.util.Base64;
import org.apache.wsrp4j.producer.util.MapDeserializer;
+import org.apache.wsrp4j.producer.util.MapSerializer;
import org.apache.wsrp4j.producer.util.ServletAccess;
import org.apache.wsrp4j.util.Utility;
import org.apache.wsrp4j.util.Constants;
@@ -345,11 +346,24 @@
// new UpdateResponse
UpdateResponse updateResponse = new UpdateResponse();
- //TODO: need to set the nav state from render params of the portlet!!!!!
-
- // set navigationalState, due to mandatory attribute
- String navState = request.getMarkupParams().getNavigationalState();
- navState = navState == null ? "none" : navState;
+ // set the nav state
+ // get render params from servlet request and serialize the map
+ String navState = null;
+ Map renderParams = (Map) servletRequest.getAttribute(WSRPDynamicInformationProvider.RENDER_PARAMS);
+ if (renderParams != null)
+ {
+ try
+ {
+ navState = Base64.encode(MapSerializer.serialize(renderParams));
+ } catch (IOException e)
+ {
+ if (logger.isLogging(Logger.ERROR))
+ {
+ logger.text(Logger.ERROR, MN, e, "Could not serialize and encode render params");
+ }
+ }
+ }
+
updateResponse.setNavigationalState(navState);
// set markupContext in interactionResponse
1.3 +1 -0 ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto/driver/DynamicInformationProviderImpl.java
Index: DynamicInformationProviderImpl.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto/driver/DynamicInformationProviderImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DynamicInformationProviderImpl.java 31 Oct 2003 14:34:45 -0000 1.2
+++ DynamicInformationProviderImpl.java 8 Dec 2003 15:53:07 -0000 1.3
@@ -133,6 +133,7 @@
*/
public DynamicInformationProviderImpl(HttpServletRequest request)
{
+ this.servletRequest = request;
this.provider = (Provider)request.getAttribute(WSRPDynamicInformationProvider.PROVIDER);
request.removeAttribute(WSRPDynamicInformationProvider.PROVIDER);
1.2 +65 -60 ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto/WSRPDynamicInformationProvider.java
Index: WSRPDynamicInformationProvider.java
===================================================================
RCS file: /home/cvs/ws-wsrp4j/src/org/apache/wsrp4j/producer/provider/pluto/WSRPDynamicInformationProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WSRPDynamicInformationProvider.java 3 Sep 2003 20:29:31 -0000 1.1
+++ WSRPDynamicInformationProvider.java 8 Dec 2003 15:53:07 -0000 1.2
@@ -1,62 +1,62 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "WSRP4J", and "Apache Software
- * Foundation" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * or "WSRP4J", nor may "Apache" or "WSRP4J" appear in their name,
- * without prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
-
- */
-
-
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "WSRP4J", and "Apache Software
+ * Foundation" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * or "WSRP4J", nor may "Apache" or "WSRP4J" appear in their name,
+ * without prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/*
+
+ */
+
+
package org.apache.wsrp4j.producer.provider.pluto;
import org.apache.pluto.services.information.DynamicInformationProvider;
@@ -83,5 +83,10 @@
* Serves to store the Provider within the current ServletRequest.
*/
public static final String PROVIDER = "wsrp.provider";
-
+
+ /** String constant representing an attribute name of a servlet request.
+ * Serves to store the render params within the current ServletRequest
+ */
+ public static final String RENDER_PARAMS = "wsrp.renderParams";
+
}