Author: ate
Date: Fri Apr 9 10:40:08 2010
New Revision: 932344
URL: http://svn.apache.org/viewvc?rev=932344&view=rev
Log:
PB-102: Move bridges-velocity out in a separate bridges-velocity svn project
Added:
portals/bridges/bridges-velocity/trunk/pom.xml (with props)
portals/bridges/bridges-velocity/trunk/src/main/java/
portals/bridges/bridges-velocity/trunk/src/main/java/org/
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/AbstractVelocityMessagingPortlet.java
(with props)
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/BridgesVelocityViewServlet.java
(with props)
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
(with props)
Removed:
portals/bridges/trunk/velocity/pom.xml
portals/bridges/trunk/velocity/src/java/
Added: portals/bridges/bridges-velocity/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/portals/bridges/bridges-velocity/trunk/pom.xml?rev=932344&view=auto
==============================================================================
--- portals/bridges/bridges-velocity/trunk/pom.xml (added)
+++ portals/bridges/bridges-velocity/trunk/pom.xml Fri Apr 9 10:40:08 2010
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE
+ file distributed with this work for additional information regarding
copyright ownership. The ASF licenses this file
+ to You under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with
+ the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language
+ governing permissions and limitations under the License. $Id$
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- POM Identification -->
+ <parent>
+ <groupId>org.apache.portals</groupId>
+ <artifactId>bridges-pom</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-velocity</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Portals Bridges Velocity Bridge</name>
+ <version>2.0-SNAPSHOT</version>
+ <description>Apache Portals Bridges Velocity Bridge</description>
+
+ <properties>
+ <javax.servlet.version>2.4</javax.servlet.version>
+ <portals.portlet2-api-spec.version>1.0</portals.portlet2-api-spec.version>
+
<org.apache.portals.bridges.common.version>2.0-SNAPSHOT</org.apache.portals.bridges.common.version>
+ <velocity-tools.version>1.3</velocity-tools.version>
+ <velocity.version>1.5</velocity.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.portals</groupId>
+ <artifactId>portlet-api_2.0_spec</artifactId>
+ <version>${portals.portlet2-api-spec.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${javax.servlet.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>${velocity.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>velocity-tools</groupId>
+ <artifactId>velocity-tools</artifactId>
+ <version>${velocity-tools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-common</artifactId>
+ <version>${org.apache.portals.bridges.common.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <scm>
+
<connection>scm:svn:http://svn.apache.org/repos/asf/portals/bridges/bridges-velocity/trunk</connection>
+
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/portals/bridges/bridges-velocity/trunk</developerConnection>
+
<url>http://svn.apache.org/viewcvs.cgi/portals/bridges/bridges-velocity/trunk/</url>
+ </scm>
+
+</project>
\ No newline at end of file
Propchange: portals/bridges/bridges-velocity/trunk/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/bridges/bridges-velocity/trunk/pom.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/AbstractVelocityMessagingPortlet.java
URL:
http://svn.apache.org/viewvc/portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/AbstractVelocityMessagingPortlet.java?rev=932344&view=auto
==============================================================================
---
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/AbstractVelocityMessagingPortlet.java
(added)
+++
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/AbstractVelocityMessagingPortlet.java
Fri Apr 9 10:40:08 2010
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.bridges.velocity;
+
+import javax.portlet.PortletRequest;
+
+import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
+import org.apache.portals.messaging.PortletMessaging;
+
+/**
+ * velocity abstract messaging portlet
+ *
+ * @author <a href="mailto:[email protected]">David Sean Taylor</a>
+ * @version $Id$
+ */
+public abstract class AbstractVelocityMessagingPortlet extends
GenericVelocityPortlet
+{
+ private String topic = null;
+ public static final String STATUS_MESSAGE = "statusMsg";
+
+ protected boolean isEmpty(String s)
+ {
+ if (s == null)
+ return true;
+
+ if (s.trim().length() == 0)
+ return true;
+
+ return false;
+ }
+
+ protected String getTopic()
+ {
+ return topic;
+ }
+ protected void setTopic(String topic)
+ {
+ this.topic = topic;
+ }
+
+ protected void cancelRenderMessage(PortletRequest request, String message)
+ {
+ try
+ {
+ if (topic == null)
+ PortletMessaging.cancel(request, message);
+ else
+ PortletMessaging.cancel(request, topic, message);
+ }
+ catch (Exception e)
+ {}
+ }
+
+ protected Object receiveRenderMessage(PortletRequest request, String
message)
+ {
+ try
+ {
+ if (topic == null)
+ return PortletMessaging.receive(request, message);
+ else
+ return PortletMessaging.receive(request, topic, message);
+ }
+ catch (Exception e)
+ {}
+ return null;
+ }
+
+ protected Object consumeRenderMessage(PortletRequest request, String
message)
+ {
+ try
+ {
+ if (topic == null)
+ return PortletMessaging.consume(request, message);
+ else
+ return PortletMessaging.consume(request, topic, message);
+ }
+ catch (Exception e)
+ {}
+ return null;
+ }
+
+ protected void publishRenderMessage(PortletRequest request, String
message, Object value)
+ {
+ try
+ {
+ if (topic == null)
+ PortletMessaging.publish(request, message, value);
+ else
+ PortletMessaging.publish(request, topic, message, value);
+ }
+ catch (Exception e)
+ {}
+ }
+
+}
Propchange:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/AbstractVelocityMessagingPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/AbstractVelocityMessagingPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/BridgesVelocityViewServlet.java
URL:
http://svn.apache.org/viewvc/portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/BridgesVelocityViewServlet.java?rev=932344&view=auto
==============================================================================
---
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/BridgesVelocityViewServlet.java
(added)
+++
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/BridgesVelocityViewServlet.java
Fri Apr 9 10:40:08 2010
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.bridges.velocity;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletRequest;
+import javax.portlet.RenderResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.context.Context;
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.velocity.io.VelocityWriter;
+import org.apache.velocity.tools.view.servlet.VelocityViewServlet;
+import org.apache.velocity.util.SimplePool;
+
+/**
+ * @author <a href="mailto:[email protected]">Scott T. Weaver</a>
+ * @version $Id$
+ */
+public class BridgesVelocityViewServlet extends VelocityViewServlet
+{
+ public final static String PORTLET_REQUEST = "javax.portlet.request";
+ public final static String PORTLET_RESPONSE = "javax.portlet.response";
+ public final static String PORTLET_CONFIG = "javax.portlet.config";
+
+ public static final String VELOCITY_WRITER_ATTR =
"org.apache.velocity.io.VelocityWriter";
+ /** Cache of writers */
+ private static SimplePool writerPool = new SimplePool(40);
+
+ public static final String VELOCITY_CONTEXT_ATTR =
"org.apache.velocity.Context";
+ /**
+ * Adds the RenderRequest, RenderResponse and PortletConfig to the context
+ *
+ * @see
org.apache.velocity.tools.view.servlet.VelocityViewServlet#handleRequest(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, org.apache.velocity.context.Context)
+ */
+ protected Template handleRequest(HttpServletRequest request,
HttpServletResponse response, Context ctx) throws Exception
+ {
+ PortletRequest renderRequest = (PortletRequest)
request.getAttribute(PORTLET_REQUEST);
+ RenderResponse renderResponse = (RenderResponse)
request.getAttribute(PORTLET_RESPONSE);
+ PortletConfig portletConfig = (PortletConfig)
request.getAttribute(PORTLET_CONFIG);
+
+ if (renderRequest != null)
+ {
+ renderRequest.setAttribute(VELOCITY_CONTEXT_ATTR, ctx);
+ Context portletContext =
(Context)renderRequest.getAttribute(GenericVelocityPortlet.PORTLET_BRIDGE_CONTEXT);
+ if (portletContext != null)
+ {
+ // merge in portletContext
+ Object[] keys = portletContext.getKeys();
+ for (int ix = 0; ix < keys.length; ix++)
+ {
+ // is this api f'd in the head or what
+ ctx.put((String)keys[ix],
portletContext.get((String)keys[ix]));
+ }
+ }
+
+ }
+
+
+ // standard render request and response also available in context
+ ctx.put(PORTLET_REQUEST, renderRequest);
+ ctx.put(PORTLET_RESPONSE, renderResponse);
+
+ return super.handleRequest(request, response, ctx);
+ }
+
+ /**
+ * @see
org.apache.velocity.tools.view.servlet.VelocityViewServlet#mergeTemplate(org.apache.velocity.Template,
org.apache.velocity.context.Context, javax.servlet.http.HttpServletResponse)
+ */
+ protected void mergeTemplate(Template template, Context context,
HttpServletResponse response)
+ throws
+ ResourceNotFoundException,
+ ParseErrorException,
+ MethodInvocationException,
+ IOException,
+ UnsupportedEncodingException,
+ Exception
+ {
+ PrintWriter pw = response.getWriter();
+ VelocityWriter vw = null;
+
+ try
+ {
+ vw = (VelocityWriter) writerPool.get();
+
+ if (vw == null)
+ {
+ vw = new VelocityWriter(pw, 4 * 1024, true);
+ }
+ else
+ {
+ vw.recycle(pw);
+ }
+
+ // Place the VelocityWriter into the Context
+ context.put(VELOCITY_WRITER_ATTR, vw);
+ template.merge(context, vw);
+ }
+ catch (Exception e)
+ {
+ throw e;
+ }
+ finally
+ {
+ try
+ {
+ if (vw != null)
+ {
+ // flush and put back into the pool
+ // don't close to allow us to play
+ // nicely with others.
+ vw.flush();
+ /* This hack sets the VelocityWriter's internal ref to the
+ * PrintWriter to null to keep memory free while
+ * the writer is pooled. See bug report #18951 */
+ vw.recycle(null);
+ writerPool.put(vw);
+ }
+ }
+ catch (Exception e)
+ {
+ // do nothing
+ }
+ }
+ }
+}
Propchange:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/BridgesVelocityViewServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/BridgesVelocityViewServlet.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
URL:
http://svn.apache.org/viewvc/portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java?rev=932344&view=auto
==============================================================================
---
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
(added)
+++
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
Fri Apr 9 10:40:08 2010
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.bridges.velocity;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.portals.bridges.common.GenericServletPortlet;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.context.Context;
+
+/**
+ * <p>
+ * Generic Velocity Portlet emulating basic functionality provided in the
+ * Portlet API (for JSPs) to Velocity portlets and templates. Provides the
+ * following Velocity context variables emulating PLT.22 JSP request
variables: *
+ * <ul>
+ * <li>$renderRequest
+ * <li>$renderResponse
+ * <li>$portletConfig
+ * </ul>
+ * </p>
+ * <p>
+ * PLT.22 Tags:
+ * <ul>
+ * <li>$actionURL -- use renderResponse.createActionURL()
+ * <li>$renderURL -- use renderResponse.createRenderURL()
+ * <li>$namespace -- use rennderResponse.getNamespace() (Namespace)
+ * </ul>
+ * Beware that Param tags cannot be added incrementally i.e.
+ * $renderURL.setParameter("name","value").setParameter("name","value") since
+ * the portlet api returns void on setParameter (or setWindowState,
+ * setPortletMode) Thus it is required to set each param or state on a single
+ * line:
+ * </p>
+ * <p>
+ * #set($max = $renderResponse.createRenderURL())
+ * $max.setWindowState($STATE_MAX) $max.setParameter("bush", "war")
+ * </p>
+ * <p>
+ * Constants: $MODE_EDIT, $MODE_HELP, $MODE_VIEW, $STATE_NORMAL, $STATE_MIN,
+ * $STATE_MAX, $USER_INFO
+ *
+ * @author <a href="mailto:[email protected]">David Sean Taylor </a>
+ * @version $Id: GenericVelocityPortlet.java,v 1.1 2004/10/29 01:29:50 taylor
+ * Exp $
+ */
+public class GenericVelocityPortlet extends GenericServletPortlet
+{
+
+ public final static String PORTLET_BRIDGE_CONTEXT =
"portals.bridges.velocity.context";
+
+ public GenericVelocityPortlet()
+ {
+ }
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ super.init(config);
+ }
+
+ /**
+ * Execute the servlet as define by the init parameter or preference
+ * PARAM_ACTION_PAGE. The value if the parameter is a relative URL, i.e.
+ * /actionPage.jsp will execute the JSP editPage.jsp in the portlet
+ * application's web app. The action should not generate any content. The
+ * content will be generate by doCustom(), doHelp() , doEdit(), or
doView().
+ *
+ * See section PLT.16.2 of the JSR 168 Portlet Spec for more information
+ * around executing a servlet or JSP in processAction()
+ *
+ * @see javax.portlet.GenericPortlet#processAction
+ *
+ * @task Need to be able to execute a servlet for the action
+ */
+ public void processAction(ActionRequest request, ActionResponse
actionResponse) throws PortletException,
+ IOException
+ {
+ super.processAction(request, actionResponse);
+ }
+
+ /**
+ * Execute the servlet as define by the init parameter or preference
+ * PARAM_EDIT_PAGE. The value if the parameter is a relative URL, i.e.
+ * /editPage.jsp will execute the JSP editPage.jsp in the portlet
+ * application's web app.
+ *
+ * @see javax.portlet.GenericPortlet#doCustom
+ */
+ public void doCustom(RenderRequest request, RenderResponse response)
throws PortletException, IOException
+ {
+ super.doCustom(request, response);
+ }
+
+ /**
+ * Execute the servlet as define by the init parameter or preference
+ * PARAM_EDIT_PAGE. The value if the parameter is a relative URL, i.e.
+ * /editPage.jsp will execute the JSP editPage.jsp in the portlet
+ * application's web app.
+ *
+ * @see javax.portlet.GenericPortlet#doEdit
+ */
+ public void doEdit(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
+ super.doEdit(request, response);
+ }
+
+ /**
+ * Execute the servlet as define by the init parameter or preference
+ * PARAM_HELP_PAGE. The value if the parameter is a relative URL, i.e.
+ * /helpPage.jsp will exeute the JSP helpPage.jsp in the portlet
+ * application's web app.
+ *
+ * @see javax.portlet.GenericPortlet#doView
+ */
+ public void doHelp(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
+ super.doHelp(request, response);
+ }
+
+ /**
+ * Execute the servlet as define by the init parameter or preference
+ * PARAM_VIEW_PAGE. The value if the parameter is a relative URL, i.e.
+ * /viewPage.jsp will execute the JSP viewPage.jsp in the portlet
+ * application's web app.
+ *
+ * @see javax.portlet.GenericPortlet#doView
+ */
+ public void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
+ super.doView(request, response);
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws
PortletException, java.io.IOException
+ {
+ createPortletVelocityContext(request, response);
+ super.render(request, response);
+ }
+
+ private Context createPortletVelocityContext(RenderRequest request,
RenderResponse response)
+ {
+ Context ctx = new VelocityContext();
+ request.setAttribute(PORTLET_BRIDGE_CONTEXT, ctx);
+ // PLT.22
+ ctx.put("renderRequest", request);
+ ctx.put("renderResponse", response);
+ ctx.put("portletConfig", getPortletConfig());
+ // constants
+ ctx.put("STATE_NORMAL", WindowState.NORMAL);
+ ctx.put("STATE_MAX", WindowState.MAXIMIZED);
+ ctx.put("STATE_MIN", WindowState.MINIMIZED);
+ ctx.put("MODE_VIEW", PortletMode.VIEW);
+ ctx.put("MODE_EDIT", PortletMode.EDIT);
+ ctx.put("MODE_HELP", PortletMode.HELP);
+ ctx.put("USER_INFO", PortletRequest.USER_INFO);
+ return ctx;
+ }
+
+ public Context getContext(RenderRequest request)
+ {
+ return (Context) request.getAttribute(PORTLET_BRIDGE_CONTEXT);
+ }
+
+ public Context getContext(RenderRequest request, RenderResponse response)
+ {
+ Context context = (Context)
request.getAttribute(PORTLET_BRIDGE_CONTEXT);
+
+ if (context == null)
+ {
+ context = createPortletVelocityContext(request, response);
+ }
+
+ return context;
+ }
+
+ public void setupPreferencesEdit(RenderRequest request, RenderResponse
response)
+ {
+ Context context = getContext(request, response);
+ PortletPreferences prefs = request.getPreferences();
+ Map map = prefs.getMap();
+ Iterator it = map.entrySet().iterator();
+ context.put("prefs", it);
+
+ Map result = new HashMap(map.size());
+ Iterator f = map.entrySet().iterator();
+ while(f.hasNext())
+ {
+ Map.Entry e = (Map.Entry)f.next();
+ String []why = (String[])e.getValue();
+ if (why == null || why[0] == null)
+ {
+ result.put(e.getKey(), "");
+ }
+ else
+ {
+ result.put(e.getKey(), why[0]);
+ }
+ }
+ context.put("prefsMap", result);
+ }
+
+ public void doPreferencesEdit(RenderRequest request, RenderResponse
response) throws PortletException, IOException
+ {
+ setupPreferencesEdit(request, response);
+ super.doEdit(request, response);
+ }
+
+}
Propchange:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/bridges/bridges-velocity/trunk/src/main/java/org/apache/portals/bridges/velocity/GenericVelocityPortlet.java
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]