Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java Fri Dec 12 04:06:29 2008
@@ -1,112 +1,112 @@
-/*
+/*
* 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.jetspeed.container;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.jetspeed.desktop.JetspeedDesktop;
-import org.apache.pluto.OptionalContainerServices;
-import org.apache.pluto.PortletContainer;
-import org.apache.pluto.RequiredContainerServices;
-import org.apache.pluto.core.PortletContainerImpl;
-
-/**
- * Desktop Portlet Container implementation. This implementation
- * redirects only if the query paramater encoder=desktop is NOT specified.
- * When the encoder=desktop parameter is specified, the 'redirect' URL
- * is returned in the response body for use by desktop javascript code.
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: $
- */
-public class DesktopPortletContainerImpl extends PortletContainerImpl implements PortletContainer
-{
- private String desktopPipelinePath = null;
- private String desktopActionPipelinePath = null;
- private String desktopRenderPipelinePath = null;
-
- public DesktopPortletContainerImpl(String containerName,
- RequiredContainerServices requiredServices, OptionalContainerServices optionalServices,
- String desktopPipelinePath, String desktopActionPipelinePath, String desktopRenderPipelinePath)
- {
- super(containerName, requiredServices, optionalServices);
- if ( desktopPipelinePath == null || desktopPipelinePath.length() == 0 )
- desktopPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_PIPELINE_PATH;
- if ( desktopPipelinePath.charAt( 0 ) != '/' )
- desktopPipelinePath = "/" + desktopPipelinePath;
- if ( desktopPipelinePath.charAt( desktopPipelinePath.length() -1 ) != '/' )
- desktopPipelinePath = desktopPipelinePath + "/";
-
- if ( desktopActionPipelinePath == null || desktopActionPipelinePath.length() == 0 )
- desktopActionPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_ACTION_PIPELINE_PATH;
- if ( desktopActionPipelinePath.charAt( 0 ) != '/' )
- desktopActionPipelinePath = "/" + desktopActionPipelinePath;
- if ( desktopActionPipelinePath.charAt( desktopActionPipelinePath.length() -1 ) != '/' )
- desktopActionPipelinePath = desktopActionPipelinePath + "/";
-
- if ( desktopRenderPipelinePath == null || desktopRenderPipelinePath.length() == 0 )
- desktopRenderPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_RENDER_PIPELINE_PATH;
- if ( desktopRenderPipelinePath.charAt( 0 ) != '/' )
- desktopRenderPipelinePath = "/" + desktopRenderPipelinePath;
- if ( desktopRenderPipelinePath.charAt( desktopRenderPipelinePath.length() -1 ) != '/' )
- desktopRenderPipelinePath = desktopRenderPipelinePath + "/";
-
- this.desktopPipelinePath = desktopPipelinePath;
- this.desktopActionPipelinePath = desktopActionPipelinePath;
- this.desktopRenderPipelinePath = desktopRenderPipelinePath;
- }
-
- protected void redirect(HttpServletRequest servletRequest, HttpServletResponse servletResponse, String location) throws IOException
- {
- String encoding = servletRequest.getParameter( JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER );
- boolean requestIsDesktopAjax = false;
- if ( encoding != null && encoding.equals( JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER_VALUE ) )
- { // used in cases where action request cannot be made via ajax (e.g. form has <input type=file/> element)
- requestIsDesktopAjax = true;
- String ajaxOverride = servletRequest.getParameter( JetspeedDesktop.DESKTOP_AJAX_REQUEST_PARAMETER );
- if ( ajaxOverride != null && ajaxOverride.equals( "false" ) )
- {
- requestIsDesktopAjax = false;
- }
- }
-
- // TODO: 2.2 is this still necessary?
- javax.servlet.http.HttpServletResponse redirectResponse = servletResponse;
- while (redirectResponse instanceof javax.servlet.http.HttpServletResponseWrapper)
- {
- redirectResponse = (javax.servlet.http.HttpServletResponse) ((javax.servlet.http.HttpServletResponseWrapper) redirectResponse)
- .getResponse();
- }
-
- if ( requestIsDesktopAjax )
- { // no real redirect will occur; instead, return the redirect URL in the response body
- location = location.replaceAll( this.desktopActionPipelinePath, this.desktopRenderPipelinePath );
- redirectResponse.getWriter().print( location );
- }
- else
- { // do real redirect
- location = location.replaceAll( this.desktopActionPipelinePath, this.desktopPipelinePath );
- location = location.replaceAll( this.desktopRenderPipelinePath, this.desktopPipelinePath);
- redirectResponse.sendRedirect(location);
- }
- System.out.println("+++ >>>> DESKTOP REDIRECT: location is " + location);
- }
-
-}
+ * 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.jetspeed.container;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jetspeed.desktop.JetspeedDesktop;
+import org.apache.pluto.OptionalContainerServices;
+import org.apache.pluto.PortletContainer;
+import org.apache.pluto.RequiredContainerServices;
+import org.apache.pluto.core.PortletContainerImpl;
+
+/**
+ * Desktop Portlet Container implementation. This implementation
+ * redirects only if the query paramater encoder=desktop is NOT specified.
+ * When the encoder=desktop parameter is specified, the 'redirect' URL
+ * is returned in the response body for use by desktop javascript code.
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class DesktopPortletContainerImpl extends PortletContainerImpl implements PortletContainer
+{
+ private String desktopPipelinePath = null;
+ private String desktopActionPipelinePath = null;
+ private String desktopRenderPipelinePath = null;
+
+ public DesktopPortletContainerImpl(String containerName,
+ RequiredContainerServices requiredServices, OptionalContainerServices optionalServices,
+ String desktopPipelinePath, String desktopActionPipelinePath, String desktopRenderPipelinePath)
+ {
+ super(containerName, requiredServices, optionalServices);
+ if ( desktopPipelinePath == null || desktopPipelinePath.length() == 0 )
+ desktopPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_PIPELINE_PATH;
+ if ( desktopPipelinePath.charAt( 0 ) != '/' )
+ desktopPipelinePath = "/" + desktopPipelinePath;
+ if ( desktopPipelinePath.charAt( desktopPipelinePath.length() -1 ) != '/' )
+ desktopPipelinePath = desktopPipelinePath + "/";
+
+ if ( desktopActionPipelinePath == null || desktopActionPipelinePath.length() == 0 )
+ desktopActionPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_ACTION_PIPELINE_PATH;
+ if ( desktopActionPipelinePath.charAt( 0 ) != '/' )
+ desktopActionPipelinePath = "/" + desktopActionPipelinePath;
+ if ( desktopActionPipelinePath.charAt( desktopActionPipelinePath.length() -1 ) != '/' )
+ desktopActionPipelinePath = desktopActionPipelinePath + "/";
+
+ if ( desktopRenderPipelinePath == null || desktopRenderPipelinePath.length() == 0 )
+ desktopRenderPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_RENDER_PIPELINE_PATH;
+ if ( desktopRenderPipelinePath.charAt( 0 ) != '/' )
+ desktopRenderPipelinePath = "/" + desktopRenderPipelinePath;
+ if ( desktopRenderPipelinePath.charAt( desktopRenderPipelinePath.length() -1 ) != '/' )
+ desktopRenderPipelinePath = desktopRenderPipelinePath + "/";
+
+ this.desktopPipelinePath = desktopPipelinePath;
+ this.desktopActionPipelinePath = desktopActionPipelinePath;
+ this.desktopRenderPipelinePath = desktopRenderPipelinePath;
+ }
+
+ protected void redirect(HttpServletRequest servletRequest, HttpServletResponse servletResponse, String location) throws IOException
+ {
+ String encoding = servletRequest.getParameter( JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER );
+ boolean requestIsDesktopAjax = false;
+ if ( encoding != null && encoding.equals( JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER_VALUE ) )
+ { // used in cases where action request cannot be made via ajax (e.g. form has <input type=file/> element)
+ requestIsDesktopAjax = true;
+ String ajaxOverride = servletRequest.getParameter( JetspeedDesktop.DESKTOP_AJAX_REQUEST_PARAMETER );
+ if ( ajaxOverride != null && ajaxOverride.equals( "false" ) )
+ {
+ requestIsDesktopAjax = false;
+ }
+ }
+
+ // TODO: 2.2 is this still necessary?
+ javax.servlet.http.HttpServletResponse redirectResponse = servletResponse;
+ while (redirectResponse instanceof javax.servlet.http.HttpServletResponseWrapper)
+ {
+ redirectResponse = (javax.servlet.http.HttpServletResponse) ((javax.servlet.http.HttpServletResponseWrapper) redirectResponse)
+ .getResponse();
+ }
+
+ if ( requestIsDesktopAjax )
+ { // no real redirect will occur; instead, return the redirect URL in the response body
+ location = location.replaceAll( this.desktopActionPipelinePath, this.desktopRenderPipelinePath );
+ redirectResponse.getWriter().print( location );
+ }
+ else
+ { // do real redirect
+ location = location.replaceAll( this.desktopActionPipelinePath, this.desktopPipelinePath );
+ location = location.replaceAll( this.desktopRenderPipelinePath, this.desktopPipelinePath);
+ redirectResponse.sendRedirect(location);
+ }
+ System.out.println("+++ >>>> DESKTOP REDIRECT: location is " + location);
+ }
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/PageHistoryValve.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/DefaultPortletRequestResponseUnwrapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/DefaultPortletRequestResponseUnwrapper.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/DefaultPortletRequestResponseUnwrapper.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/DefaultPortletRequestResponseUnwrapper.java Fri Dec 12 04:06:29 2008
@@ -1,46 +1,46 @@
-/*
- * 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.jetspeed.container.invoker;
-
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponseWrapper;
-
-/**
- * DefaultPortletRequestResponseUnwrapper implements PortletRequestResponseUnwrapper
- * and finds servlet request or servlet response by simple unwrapping.
- *
- * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
- * @version $Id: $
- */
-public class DefaultPortletRequestResponseUnwrapper implements PortletRequestResponseUnwrapper
-{
- public ServletRequest unwrapPortletRequest(PortletRequest portletRequest)
- {
- ServletRequest servletRequest = ((HttpServletRequestWrapper)((HttpServletRequestWrapper)((HttpServletRequestWrapper)portletRequest).getRequest()).getRequest()).getRequest();
- return servletRequest;
- }
-
- public ServletResponse unwrapPortletResponse(PortletResponse portletResponse)
- {
- ServletResponse servletResponse = ((HttpServletResponseWrapper) portletResponse).getResponse();
- return servletResponse;
- }
-}
+/*
+ * 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.jetspeed.container.invoker;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * DefaultPortletRequestResponseUnwrapper implements PortletRequestResponseUnwrapper
+ * and finds servlet request or servlet response by simple unwrapping.
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id: $
+ */
+public class DefaultPortletRequestResponseUnwrapper implements PortletRequestResponseUnwrapper
+{
+ public ServletRequest unwrapPortletRequest(PortletRequest portletRequest)
+ {
+ ServletRequest servletRequest = ((HttpServletRequestWrapper)((HttpServletRequestWrapper)((HttpServletRequestWrapper)portletRequest).getRequest()).getRequest()).getRequest();
+ return servletRequest;
+ }
+
+ public ServletResponse unwrapPortletResponse(PortletResponse portletResponse)
+ {
+ ServletResponse servletResponse = ((HttpServletResponseWrapper) portletResponse).getResponse();
+ return servletResponse;
+ }
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/DefaultPortletRequestResponseUnwrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/JetspeedPortletInvokerService.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/LocalPortletInvokerFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/LocalPortletInvokerFactory.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/LocalPortletInvokerFactory.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/LocalPortletInvokerFactory.java Fri Dec 12 04:06:29 2008
@@ -1,52 +1,52 @@
-/*
+/*
* 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.jetspeed.container.invoker;
-
-/**
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: $
- * @deprecated delete me
- */
-public class LocalPortletInvokerFactory
-{
- /**
- * <p>
- * createInstance
- * </p>
- *
- * @see org.springframework.beans.factory.config.AbstractFactoryBean#createInstance()
- * @return
- * @throws Exception
- */
- public LocalPortletInvoker createInstance()
- {
- return new LocalPortletInvoker();
- }
-
- /**
- * <p>
- * getObjectType
- * </p>
- * @see org.springframework.beans.factory.FactoryBean#getObjectType()
- * @return
- */
- public final Class getObjectType()
- {
- return LocalPortletInvoker.class;
- }
-
-}
+ * 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.jetspeed.container.invoker;
+
+/**
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ * @deprecated delete me
+ */
+public class LocalPortletInvokerFactory
+{
+ /**
+ * <p>
+ * createInstance
+ * </p>
+ *
+ * @see org.springframework.beans.factory.config.AbstractFactoryBean#createInstance()
+ * @return
+ * @throws Exception
+ */
+ public LocalPortletInvoker createInstance()
+ {
+ return new LocalPortletInvoker();
+ }
+
+ /**
+ * <p>
+ * getObjectType
+ * </p>
+ * @see org.springframework.beans.factory.FactoryBean#getObjectType()
+ * @return
+ */
+ public final Class getObjectType()
+ {
+ return LocalPortletInvoker.class;
+ }
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/LocalPortletInvokerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/EventProviderImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/FilterManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/PortletURLListenerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/providers/RequestPropertyProviderImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedOptionalPlutoServices.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedPortalCallbackServices.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/services/JetspeedRequiredPlutoServices.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/session/PortalSessionMonitorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/HybridNavigationalState.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/HybridNavigationalState.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/HybridNavigationalState.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/HybridNavigationalState.java Fri Dec 12 04:06:29 2008
@@ -14,63 +14,63 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.jetspeed.container.state.impl;
-
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.portlet.PortletMode;
-import javax.portlet.WindowState;
-
-import org.apache.jetspeed.cache.JetspeedContentCache;
-import org.apache.jetspeed.container.PortletWindow;
-
-/**
- * HybridNavigationalState
- *
- * Only encodes render parameters that start with a given prefix
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: AbstractNavigationalState.java 333093 2005-11-13 18:42:42Z taylor $
- */
-public class HybridNavigationalState extends SessionNavigationalState
-{
- protected String prefix;
-
- public HybridNavigationalState(NavigationalStateCodec codec, String prefix, JetspeedContentCache cache)
- {
- super(codec, cache);
- this.prefix = prefix;
- }
-
- public String encode(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action)
- throws UnsupportedEncodingException
- {
- Map subset = new HashMap();
- Iterator params = parameters.keySet().iterator();
- while (params.hasNext())
- {
- String key = (String)params.next();
- if (key.startsWith(prefix))
- {
- // only encode params that start with prefix
- subset.put(key, parameters.get(key));
- }
- }
- return super.encode(window, subset, mode, state, action);
- }
-
- public boolean isNavigationalParameterStateFull()
- {
- return true;
- }
-
- public boolean isRenderParameterStateFull()
- {
- return false;
- }
-
-
-}
+package org.apache.jetspeed.container.state.impl;
+
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+import org.apache.jetspeed.cache.JetspeedContentCache;
+import org.apache.jetspeed.container.PortletWindow;
+
+/**
+ * HybridNavigationalState
+ *
+ * Only encodes render parameters that start with a given prefix
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: AbstractNavigationalState.java 333093 2005-11-13 18:42:42Z taylor $
+ */
+public class HybridNavigationalState extends SessionNavigationalState
+{
+ protected String prefix;
+
+ public HybridNavigationalState(NavigationalStateCodec codec, String prefix, JetspeedContentCache cache)
+ {
+ super(codec, cache);
+ this.prefix = prefix;
+ }
+
+ public String encode(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action)
+ throws UnsupportedEncodingException
+ {
+ Map subset = new HashMap();
+ Iterator params = parameters.keySet().iterator();
+ while (params.hasNext())
+ {
+ String key = (String)params.next();
+ if (key.startsWith(prefix))
+ {
+ // only encode params that start with prefix
+ subset.put(key, parameters.get(key));
+ }
+ }
+ return super.encode(window, subset, mode, state, action);
+ }
+
+ public boolean isNavigationalParameterStateFull()
+ {
+ return true;
+ }
+
+ public boolean isRenderParameterStateFull()
+ {
+ return false;
+ }
+
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/HybridNavigationalState.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/state/impl/SessionFullExtendedNavigationalState.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java Fri Dec 12 04:06:29 2008
@@ -1,135 +1,135 @@
-/*
+/*
* 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.jetspeed.container.url.impl;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.jetspeed.container.url.BasePortalURL;
-
-/**
- * <p>
- * BasePortalURL defines the interface for manipulating Base URLs in a portal.
- * Base URLs contain the isSecure flag, server name, server port, and server scheme.
- * This abstraction was necessary for wiring the entire portal's base URL via another
- * mechanism than retrieving from the servlet request.
- * </p>
- *
- * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
- * @version $Id: $
- *
- */
-public class BasePortalURLImpl implements BasePortalURL
-{
- private String serverName;
- private String serverScheme;
- private int serverPort;
- private boolean secure;
-
- public BasePortalURLImpl()
- {
- }
-
- /**
- * This constructor takes a string that represents the name of an
- * environment variable. The environment variable will be the full
- * path of a properties file to be loaded. Information from the
- * properties file will populate this object
- */
- public BasePortalURLImpl(String environmentPath) throws ConfigurationException
- {
- String propertyFilePath = null;
- if (environmentPath != null)
- {
- propertyFilePath = System.getProperty(environmentPath);
- }
-
- PropertiesConfiguration config = null;
-
- // Load the file if the path is provided
- if (propertyFilePath != null)
- {
- config = new PropertiesConfiguration(propertyFilePath);
- }
-
- if (config != null)
- {
- this.serverName = config.getString("portal.url.name");
- this.serverScheme = config.getString("portal.url.scheme");
- this.serverPort = config.getInt("portal.url.port");
- this.secure = config.getBoolean("portal.url.secure");
- }
- }
-
-
- public BasePortalURLImpl(Configuration config)
- {
- this.serverName = config.getString("portal.url.name");
- this.serverScheme = config.getString("portal.url.scheme");
- this.serverPort = config.getInt("portal.url.port");
- this.secure = config.getBoolean("portal.url.secure");
- }
-
- public BasePortalURLImpl(String serverScheme, String serverName, int serverPort, boolean secure)
- {
- this.serverName = serverName;
- this.serverScheme = serverScheme;
- this.serverPort = serverPort;
- this.secure = secure;
- }
-
- public boolean isSecure()
- {
- return secure;
- }
-
- public void setSecure(boolean secure)
- {
- this.secure = secure;
- }
-
- public String getServerName()
- {
- return serverName;
- }
-
- public void setServerName(String serverName)
- {
- this.serverName = serverName;
- }
-
- public int getServerPort()
- {
- return serverPort;
- }
-
- public void setServerPort(int serverPort)
- {
- this.serverPort = serverPort;
- }
-
- public String getServerScheme()
- {
- return serverScheme;
- }
-
- public void setServerScheme(String serverScheme)
- {
- this.serverScheme = serverScheme;
- }
-
-}
+ * 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.jetspeed.container.url.impl;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.jetspeed.container.url.BasePortalURL;
+
+/**
+ * <p>
+ * BasePortalURL defines the interface for manipulating Base URLs in a portal.
+ * Base URLs contain the isSecure flag, server name, server port, and server scheme.
+ * This abstraction was necessary for wiring the entire portal's base URL via another
+ * mechanism than retrieving from the servlet request.
+ * </p>
+ *
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
+ * @version $Id: $
+ *
+ */
+public class BasePortalURLImpl implements BasePortalURL
+{
+ private String serverName;
+ private String serverScheme;
+ private int serverPort;
+ private boolean secure;
+
+ public BasePortalURLImpl()
+ {
+ }
+
+ /**
+ * This constructor takes a string that represents the name of an
+ * environment variable. The environment variable will be the full
+ * path of a properties file to be loaded. Information from the
+ * properties file will populate this object
+ */
+ public BasePortalURLImpl(String environmentPath) throws ConfigurationException
+ {
+ String propertyFilePath = null;
+ if (environmentPath != null)
+ {
+ propertyFilePath = System.getProperty(environmentPath);
+ }
+
+ PropertiesConfiguration config = null;
+
+ // Load the file if the path is provided
+ if (propertyFilePath != null)
+ {
+ config = new PropertiesConfiguration(propertyFilePath);
+ }
+
+ if (config != null)
+ {
+ this.serverName = config.getString("portal.url.name");
+ this.serverScheme = config.getString("portal.url.scheme");
+ this.serverPort = config.getInt("portal.url.port");
+ this.secure = config.getBoolean("portal.url.secure");
+ }
+ }
+
+
+ public BasePortalURLImpl(Configuration config)
+ {
+ this.serverName = config.getString("portal.url.name");
+ this.serverScheme = config.getString("portal.url.scheme");
+ this.serverPort = config.getInt("portal.url.port");
+ this.secure = config.getBoolean("portal.url.secure");
+ }
+
+ public BasePortalURLImpl(String serverScheme, String serverName, int serverPort, boolean secure)
+ {
+ this.serverName = serverName;
+ this.serverScheme = serverScheme;
+ this.serverPort = serverPort;
+ this.secure = secure;
+ }
+
+ public boolean isSecure()
+ {
+ return secure;
+ }
+
+ public void setSecure(boolean secure)
+ {
+ this.secure = secure;
+ }
+
+ public String getServerName()
+ {
+ return serverName;
+ }
+
+ public void setServerName(String serverName)
+ {
+ this.serverName = serverName;
+ }
+
+ public int getServerPort()
+ {
+ return serverPort;
+ }
+
+ public void setServerPort(int serverPort)
+ {
+ this.serverPort = serverPort;
+ }
+
+ public String getServerScheme()
+ {
+ return serverScheme;
+ }
+
+ public void setServerScheme(String serverScheme)
+ {
+ this.serverScheme = serverScheme;
+ }
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java Fri Dec 12 04:06:29 2008
@@ -1,229 +1,229 @@
-/*
+/*
* 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.jetspeed.container.url.impl;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import javax.portlet.PortletMode;
-import javax.portlet.WindowState;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.jetspeed.PortalContext;
-import org.apache.jetspeed.PortalReservedParameters;
-import org.apache.jetspeed.container.state.NavigationalState;
-import org.apache.jetspeed.container.url.BasePortalURL;
-import org.apache.jetspeed.desktop.JetspeedDesktop;
-import org.apache.jetspeed.om.portlet.PortletApplication;
-import org.apache.jetspeed.container.PortletWindow;
-import org.apache.jetspeed.container.PortletEntity;
-import org.apache.pluto.om.portlet.PortletDefinition;
-
-/**
- * DesktopEncodingPortalURL encodes action URLs to target desktop specific /action pipeline,
- * and render URLs to target desktop specific /render pipeline
- *
- * The query parameters "entity" and "portlet" are added to each url. These parameters are needed in a /render
- * request and are used by the desktop javascript code for both /render and /action requests.
- *
- * @author <a href="mailto:ate@apache.org">Ate Douma</a>
- * @version $Id: PathInfoEncodingPortalURL.java 367856 2006-01-11 01:04:09Z taylor $
- */
-public class DesktopEncodingPortalURL extends AbstractPortalURL
-{
- private String baseActionPath = null;
- private String baseRenderPath = null;
-
- private String desktopActionPipelinePath = null;
- private String desktopRenderPipelinePath = null;
-
-
- public DesktopEncodingPortalURL(NavigationalState navState, PortalContext portalContext, String desktopRenderPipelinePath, String desktopActionPipelinePath)
- {
- super(navState, portalContext);
- initializePipelinePaths( desktopRenderPipelinePath, desktopActionPipelinePath );
- }
-
- public DesktopEncodingPortalURL(NavigationalState navState, PortalContext portalContext, String desktopRenderPipelinePath, String desktopActionPipelinePath, BasePortalURL base)
- {
- super(navState, portalContext, base);
- initializePipelinePaths( desktopRenderPipelinePath, desktopActionPipelinePath );
- }
-
- public DesktopEncodingPortalURL(String characterEncoding, NavigationalState navState, PortalContext portalContext)
- {
- super(characterEncoding, navState, portalContext);
- initializePipelinePaths( null, null );
- }
-
- public DesktopEncodingPortalURL(HttpServletRequest request, String characterEncoding, NavigationalState navState, PortalContext portalContext)
- {
- super(request, characterEncoding, navState, portalContext);
- initializePipelinePaths( null, null );
- }
-
- private void initializePipelinePaths( String desktopRenderPipelinePath, String desktopActionPipelinePath )
- {
- if ( desktopActionPipelinePath == null || desktopActionPipelinePath.length() == 0 )
- desktopActionPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_ACTION_PIPELINE_PATH;
- if ( desktopActionPipelinePath.charAt( 0 ) != '/' )
- desktopActionPipelinePath = "/" + desktopActionPipelinePath;
- if ( desktopActionPipelinePath.length() > 1 && desktopActionPipelinePath.charAt( desktopActionPipelinePath.length() -1 ) == '/' )
- desktopActionPipelinePath = desktopActionPipelinePath.substring( 0, desktopActionPipelinePath.length() -1 );
-
- if ( desktopRenderPipelinePath == null || desktopRenderPipelinePath.length() == 0 )
- desktopRenderPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_RENDER_PIPELINE_PATH;
- if ( desktopRenderPipelinePath.charAt( 0 ) != '/' )
- desktopRenderPipelinePath = "/" + desktopRenderPipelinePath;
- if ( desktopRenderPipelinePath.length() > 1 && desktopRenderPipelinePath.charAt( desktopRenderPipelinePath.length() -1 ) == '/' )
- desktopRenderPipelinePath = desktopRenderPipelinePath.substring( 0, desktopRenderPipelinePath.length() -1 );
-
- this.desktopRenderPipelinePath = desktopRenderPipelinePath;
- this.desktopActionPipelinePath = desktopActionPipelinePath;
- }
-
- protected void decodeBasePath(HttpServletRequest request)
- {
- super.decodeBasePath(request);
- if ( this.baseActionPath == null )
- {
- this.baseActionPath = contextPath + this.desktopActionPipelinePath;
- this.baseRenderPath = contextPath + this.desktopRenderPipelinePath;
- }
- }
-
- protected void decodePathAndNavigationalState(HttpServletRequest request)
- {
- String path = null;
- String encodedNavState = null;
-
- String pathInfo = request.getPathInfo();
- if (pathInfo != null)
- {
- StringTokenizer tokenizer = new StringTokenizer(request.getPathInfo(),"/");
- StringBuffer buffer = new StringBuffer();
- String token;
- boolean foundNavState = false;
- String navStatePrefix = getNavigationalStateParameterName() +":";
- while (tokenizer.hasMoreTokens())
- {
- token = tokenizer.nextToken();
- if (!foundNavState && token.startsWith(navStatePrefix))
- {
- foundNavState = true;
- if ( token.length() > navStatePrefix.length() )
- {
- encodedNavState = token.substring(navStatePrefix.length());
- }
- }
- else
- {
- buffer.append("/");
- buffer.append(token);
- }
- }
- if ( buffer.length() > 0 )
- {
- path = buffer.toString();
- }
- else
- {
- path = "/";
- }
- }
- setPath(path);
- setEncodedNavigationalState(encodedNavState);
- }
-
- protected String createPortletURL(String encodedNavState, boolean secure)
- {
- return createPortletURL(encodedNavState, secure, null, false);
- }
-
- protected String createPortletURL(String encodedNavState, boolean secure, PortletWindow window, boolean action)
- {
- return createPortletURL(encodedNavState, secure, window, action, false, false);
- }
-
- protected String createPortletURL(String encodedNavState, boolean secure, PortletWindow window, boolean action, boolean resource, boolean desktopRequestNotAjax)
- {
- StringBuffer buffer = new StringBuffer("");
- buffer.append(getBaseURL(secure));
- if (action)
- {
- buffer.append(this.baseActionPath);
- }
- else
- {
- buffer.append(this.baseRenderPath);
- }
- if ( encodedNavState != null )
- {
- buffer.append("/");
- buffer.append(getNavigationalStateParameterName());
- buffer.append(":");
- buffer.append(encodedNavState);
- }
- if ( getPath() != null )
- {
- buffer.append(getPath());
- }
-
- if ( !resource )
- {
- if ( ! desktopRequestNotAjax )
- {
- PortletEntity pe = window.getPortletEntity();
- buffer.append( "?entity=" ).append( pe.getId() );
-
- PortletDefinition portlet = pe.getPortletDefinition();
- PortletApplication app = (PortletApplication)portlet.getApplication();
- String uniqueName = app.getName() + "::" + portlet.getPortletName();
- buffer.append( "&portlet=" ).append( uniqueName );
- }
- }
- else
- {
- buffer.append("?encoder=desktop");
- }
-
- return buffer.toString();
- }
-
- public String createPortletURL(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action, boolean secure)
- {
- try
- {
- boolean resource = !action && parameters.containsKey(PortalReservedParameters.PORTLET_RESOURCE_URL_REQUEST_PARAMETER);
- boolean desktopRequestNotAjax = false;
- if ( parameters.containsKey(JetspeedDesktop.DESKTOP_REQUEST_NOT_AJAX_PARAMETER) )
- {
- desktopRequestNotAjax = true;
- parameters.remove(JetspeedDesktop.DESKTOP_REQUEST_NOT_AJAX_PARAMETER);
- }
- return createPortletURL(this.getNavigationalState().encode(window,parameters,mode,state,action), secure, window, action, resource, desktopRequestNotAjax);
- }
- catch (UnsupportedEncodingException e)
- {
- // should never happen
- e.printStackTrace();
- // to keep the compiler happy
- return null;
- }
- }
-}
+ * 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.jetspeed.container.url.impl;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.jetspeed.PortalContext;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.container.state.NavigationalState;
+import org.apache.jetspeed.container.url.BasePortalURL;
+import org.apache.jetspeed.desktop.JetspeedDesktop;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.PortletEntity;
+import org.apache.pluto.om.portlet.PortletDefinition;
+
+/**
+ * DesktopEncodingPortalURL encodes action URLs to target desktop specific /action pipeline,
+ * and render URLs to target desktop specific /render pipeline
+ *
+ * The query parameters "entity" and "portlet" are added to each url. These parameters are needed in a /render
+ * request and are used by the desktop javascript code for both /render and /action requests.
+ *
+ * @author <a href="mailto:ate@apache.org">Ate Douma</a>
+ * @version $Id: PathInfoEncodingPortalURL.java 367856 2006-01-11 01:04:09Z taylor $
+ */
+public class DesktopEncodingPortalURL extends AbstractPortalURL
+{
+ private String baseActionPath = null;
+ private String baseRenderPath = null;
+
+ private String desktopActionPipelinePath = null;
+ private String desktopRenderPipelinePath = null;
+
+
+ public DesktopEncodingPortalURL(NavigationalState navState, PortalContext portalContext, String desktopRenderPipelinePath, String desktopActionPipelinePath)
+ {
+ super(navState, portalContext);
+ initializePipelinePaths( desktopRenderPipelinePath, desktopActionPipelinePath );
+ }
+
+ public DesktopEncodingPortalURL(NavigationalState navState, PortalContext portalContext, String desktopRenderPipelinePath, String desktopActionPipelinePath, BasePortalURL base)
+ {
+ super(navState, portalContext, base);
+ initializePipelinePaths( desktopRenderPipelinePath, desktopActionPipelinePath );
+ }
+
+ public DesktopEncodingPortalURL(String characterEncoding, NavigationalState navState, PortalContext portalContext)
+ {
+ super(characterEncoding, navState, portalContext);
+ initializePipelinePaths( null, null );
+ }
+
+ public DesktopEncodingPortalURL(HttpServletRequest request, String characterEncoding, NavigationalState navState, PortalContext portalContext)
+ {
+ super(request, characterEncoding, navState, portalContext);
+ initializePipelinePaths( null, null );
+ }
+
+ private void initializePipelinePaths( String desktopRenderPipelinePath, String desktopActionPipelinePath )
+ {
+ if ( desktopActionPipelinePath == null || desktopActionPipelinePath.length() == 0 )
+ desktopActionPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_ACTION_PIPELINE_PATH;
+ if ( desktopActionPipelinePath.charAt( 0 ) != '/' )
+ desktopActionPipelinePath = "/" + desktopActionPipelinePath;
+ if ( desktopActionPipelinePath.length() > 1 && desktopActionPipelinePath.charAt( desktopActionPipelinePath.length() -1 ) == '/' )
+ desktopActionPipelinePath = desktopActionPipelinePath.substring( 0, desktopActionPipelinePath.length() -1 );
+
+ if ( desktopRenderPipelinePath == null || desktopRenderPipelinePath.length() == 0 )
+ desktopRenderPipelinePath = JetspeedDesktop.DEFAULT_DESKTOP_RENDER_PIPELINE_PATH;
+ if ( desktopRenderPipelinePath.charAt( 0 ) != '/' )
+ desktopRenderPipelinePath = "/" + desktopRenderPipelinePath;
+ if ( desktopRenderPipelinePath.length() > 1 && desktopRenderPipelinePath.charAt( desktopRenderPipelinePath.length() -1 ) == '/' )
+ desktopRenderPipelinePath = desktopRenderPipelinePath.substring( 0, desktopRenderPipelinePath.length() -1 );
+
+ this.desktopRenderPipelinePath = desktopRenderPipelinePath;
+ this.desktopActionPipelinePath = desktopActionPipelinePath;
+ }
+
+ protected void decodeBasePath(HttpServletRequest request)
+ {
+ super.decodeBasePath(request);
+ if ( this.baseActionPath == null )
+ {
+ this.baseActionPath = contextPath + this.desktopActionPipelinePath;
+ this.baseRenderPath = contextPath + this.desktopRenderPipelinePath;
+ }
+ }
+
+ protected void decodePathAndNavigationalState(HttpServletRequest request)
+ {
+ String path = null;
+ String encodedNavState = null;
+
+ String pathInfo = request.getPathInfo();
+ if (pathInfo != null)
+ {
+ StringTokenizer tokenizer = new StringTokenizer(request.getPathInfo(),"/");
+ StringBuffer buffer = new StringBuffer();
+ String token;
+ boolean foundNavState = false;
+ String navStatePrefix = getNavigationalStateParameterName() +":";
+ while (tokenizer.hasMoreTokens())
+ {
+ token = tokenizer.nextToken();
+ if (!foundNavState && token.startsWith(navStatePrefix))
+ {
+ foundNavState = true;
+ if ( token.length() > navStatePrefix.length() )
+ {
+ encodedNavState = token.substring(navStatePrefix.length());
+ }
+ }
+ else
+ {
+ buffer.append("/");
+ buffer.append(token);
+ }
+ }
+ if ( buffer.length() > 0 )
+ {
+ path = buffer.toString();
+ }
+ else
+ {
+ path = "/";
+ }
+ }
+ setPath(path);
+ setEncodedNavigationalState(encodedNavState);
+ }
+
+ protected String createPortletURL(String encodedNavState, boolean secure)
+ {
+ return createPortletURL(encodedNavState, secure, null, false);
+ }
+
+ protected String createPortletURL(String encodedNavState, boolean secure, PortletWindow window, boolean action)
+ {
+ return createPortletURL(encodedNavState, secure, window, action, false, false);
+ }
+
+ protected String createPortletURL(String encodedNavState, boolean secure, PortletWindow window, boolean action, boolean resource, boolean desktopRequestNotAjax)
+ {
+ StringBuffer buffer = new StringBuffer("");
+ buffer.append(getBaseURL(secure));
+ if (action)
+ {
+ buffer.append(this.baseActionPath);
+ }
+ else
+ {
+ buffer.append(this.baseRenderPath);
+ }
+ if ( encodedNavState != null )
+ {
+ buffer.append("/");
+ buffer.append(getNavigationalStateParameterName());
+ buffer.append(":");
+ buffer.append(encodedNavState);
+ }
+ if ( getPath() != null )
+ {
+ buffer.append(getPath());
+ }
+
+ if ( !resource )
+ {
+ if ( ! desktopRequestNotAjax )
+ {
+ PortletEntity pe = window.getPortletEntity();
+ buffer.append( "?entity=" ).append( pe.getId() );
+
+ PortletDefinition portlet = pe.getPortletDefinition();
+ PortletApplication app = (PortletApplication)portlet.getApplication();
+ String uniqueName = app.getName() + "::" + portlet.getPortletName();
+ buffer.append( "&portlet=" ).append( uniqueName );
+ }
+ }
+ else
+ {
+ buffer.append("?encoder=desktop");
+ }
+
+ return buffer.toString();
+ }
+
+ public String createPortletURL(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action, boolean secure)
+ {
+ try
+ {
+ boolean resource = !action && parameters.containsKey(PortalReservedParameters.PORTLET_RESOURCE_URL_REQUEST_PARAMETER);
+ boolean desktopRequestNotAjax = false;
+ if ( parameters.containsKey(JetspeedDesktop.DESKTOP_REQUEST_NOT_AJAX_PARAMETER) )
+ {
+ desktopRequestNotAjax = true;
+ parameters.remove(JetspeedDesktop.DESKTOP_REQUEST_NOT_AJAX_PARAMETER);
+ }
+ return createPortletURL(this.getNavigationalState().encode(window,parameters,mode,state,action), secure, window, action, resource, desktopRequestNotAjax);
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // should never happen
+ e.printStackTrace();
+ // to keep the compiler happy
+ return null;
+ }
+ }
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/url/impl/DesktopEncodingPortalURL.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java Fri Dec 12 04:06:29 2008
@@ -1,337 +1,337 @@
-/*
+/*
* 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.jetspeed.container.window.impl;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.cache.PortletWindowCache;
-import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
-import org.apache.jetspeed.components.portletentity.PortletEntityNotGeneratedException;
-import org.apache.jetspeed.components.portletentity.PortletEntityNotStoredException;
-import org.apache.jetspeed.components.portletregistry.PortletRegistry;
-import org.apache.jetspeed.components.portletregistry.RegistryEventListener;
-import org.apache.jetspeed.container.window.FailedToCreateWindowException;
-import org.apache.jetspeed.container.window.FailedToRetrievePortletWindow;
-import org.apache.jetspeed.container.window.PortletWindowAccessor;
-import org.apache.jetspeed.factory.PortletFactory;
-import org.apache.jetspeed.om.page.ContentFragment;
-import org.apache.jetspeed.om.portlet.PortletApplication;
-import org.apache.jetspeed.om.portlet.PortletDefinition;
-import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
-import org.apache.jetspeed.util.ArgUtil;
-import org.apache.jetspeed.container.PortletEntity;
-import org.apache.jetspeed.container.PortletWindow;
-
-/**
- * Portlet Window Accessor Implementation
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: PortletWindowAccessorImpl.java,v 1.12 2005/04/29 14:01:57 weaver Exp $
- */
-public class PortletWindowAccessorImpl implements PortletWindowAccessor, RegistryEventListener
-{
- protected final static Log log = LogFactory.getLog(PortletWindowAccessorImpl.class);
-
- private PortletEntityAccessComponent entityAccessor;
- private PortletFactory portletFactory;
- private boolean validateWindows = false;
- private PortletWindowCache portletWindowCache;
-
- public PortletWindowAccessorImpl(PortletEntityAccessComponent entityAccessor, PortletFactory portletFactory, PortletWindowCache portletWindowCache, boolean validateWindows)
- {
- this.entityAccessor = entityAccessor;
- this.portletFactory = portletFactory;
- this.validateWindows = validateWindows;
- this.portletWindowCache = portletWindowCache;
-
- }
-
- public PortletWindowAccessorImpl(PortletEntityAccessComponent entityAccessor,
- PortletFactory portletFactory,
- PortletRegistry registry,
- PortletWindowCache portletWindowCache,
- boolean validateWindows)
- {
- this.entityAccessor = entityAccessor;
- this.portletFactory = portletFactory;
- this.validateWindows = validateWindows;
- this.portletWindowCache = portletWindowCache;
- registry.addRegistryListener(this);
- }
-
- public PortletWindow createPortletWindow(PortletEntity entity, String windowId)
- {
- if(entity == null)
- {
- throw new IllegalArgumentException("cratePortletWindow requires a non-null PortletEntity");
- }
-
- PortletWindow found = getWindowFromCache(windowId);
- if (found != null)
- {
- // remove from cache if invalid entity
- checkPortletWindowEntity(found);
- found.setPortletEntity(entity);
- return found;
- }
-
- PortletWindowImpl window = new PortletWindowImpl(windowId);
- window.setPortletEntity(entity);
- if ( isValidPortletEntity(entity))
- {
- portletWindowCache.putPortletWindow(window);
- }
- return window;
- }
-
- public PortletWindow createPortletWindow(String windowId)
- {
- PortletWindow found = getWindowFromCache(windowId);
- if (found != null)
- {
- // remove from cache if invalid entity
- checkPortletWindowEntity(found);
- return found;
- }
- PortletWindowImpl window = new PortletWindowImpl(windowId);
- return window;
- }
-
- public PortletWindow getPortletWindow(String windowId)
- {
- PortletWindow window = getWindowFromCache(windowId);
- if (window != null)
- {
- // remove from cache if invalid entity
- checkPortletWindowEntity(window);
- }
- return window;
- }
-
- public PortletWindow getPortletWindow(ContentFragment fragment) throws FailedToRetrievePortletWindow, PortletEntityNotStoredException
- {
- ArgUtil.assertNotNull(ContentFragment.class, fragment, this, "getPortletWindow(Fragment fragment)");
- PortletWindow portletWindow = getWindowFromCache(fragment);
- if (portletWindow == null || !checkPortletWindowEntity(portletWindow))
- {
- try
- {
- return createPortletWindow(fragment);
- }
- catch (FailedToCreateWindowException e)
- {
- throw new FailedToRetrievePortletWindow(e.toString(), e);
- }
- }
- else
- {
- if (validateWindows)
- {
- validateWindow(fragment, portletWindow);
- }
- }
- return portletWindow;
- }
-
- /**
- * <p>
- * validateWindow
- * </p>
- *
- * @param fragment
- * @param portletWindow
- * @throws PortletEntityNotStoredException
- * @throws InconsistentWindowStateException
- */
- protected void validateWindow( ContentFragment fragment, PortletWindow portletWindow ) throws FailedToRetrievePortletWindow, PortletEntityNotStoredException
- {
- // make sure the window has the most up-to-date portlet entity
- PortletEntity portletEntity = entityAccessor.getPortletEntityForFragment(fragment);
- if(portletEntity != null)
- {
- portletWindow.setPortletEntity(portletEntity);
- // if not a valid entity, remove window from cache
- checkPortletWindowEntity(portletWindow);
- }
- else
- {
- removeWindow(portletWindow);
- throw new FailedToRetrievePortletWindow("No PortletEntity exists for for id "+fragment.getId()+" removing window from cache.");
- }
- }
-
- private PortletWindow createPortletWindow(ContentFragment fragment) throws FailedToCreateWindowException, PortletEntityNotStoredException
- {
- PortletWindow portletWindow = new PortletWindowImpl(fragment.getId());
- boolean temporaryWindow = false;
-
- PortletEntity portletEntity = entityAccessor.getPortletEntityForFragment(fragment);
- if (portletEntity == null)
- {
- log.info("No portlet entity defined for fragment ID "+fragment.getId()+" attempting to auto-generate...");
- try
- {
- portletEntity = entityAccessor.generateEntityFromFragment(fragment);
- // not portlet definition most likely means that the portlet has not been deployed so dont worry about storing off the entity
- if(isValidPortletEntity(portletEntity))
- {
- entityAccessor.storePortletEntity(portletEntity);
- }
- else
- {
- // don't cache the incomplete window
- temporaryWindow = true;
- }
- }
- catch (PortletEntityNotGeneratedException e)
- {
- throw new FailedToCreateWindowException("Error generating new PortletEntity: "+e.toString(), e);
- }
- catch (PortletEntityNotStoredException e)
- {
- throw new FailedToCreateWindowException("Error storing new PortletEntity: "+e.toString(), e);
- }
-
- if(portletEntity == null)
- {
- throw new FailedToCreateWindowException("Unable to generate portlet entity.");
- }
- }
- portletWindow.setPortletEntity(portletEntity);
-
- if ( !temporaryWindow )
- {
- portletWindowCache.putPortletWindow(portletWindow);
- }
- return portletWindow;
- }
-
-
- public void removeWindows(PortletEntity portletEntity)
- {
- portletWindowCache.removePortletWindowByPortletEntityId(portletEntity.getId().toString());
- }
-
- public void removeWindow(PortletWindow window)
- {
- portletWindowCache.removePortletWindow(window.getId().toString());
- }
-
- private PortletWindow getWindowFromCache(ContentFragment fragment)
- {
- return portletWindowCache.getPortletWindow(fragment.getId());
- }
-
- private PortletWindow getWindowFromCache(String id)
- {
- return portletWindowCache.getPortletWindow(id);
- }
-
- private boolean checkPortletWindowEntity(PortletWindow window)
- {
- if (!isValidPortletEntity(window.getPortletEntity()))
- {
- removeWindow(window);
- return false;
- }
- return true;
- }
-
- private boolean isValidPortletEntity(PortletEntity pe)
- {
- return pe != null
- && pe.getPortletDefinition() != null
- && pe.getPortletDefinition().getApplication() != null
- && portletFactory.isPortletApplicationRegistered((PortletApplication) pe.getPortletDefinition()
- .getApplication());
- }
-
- public Set getPortletWindows()
- {
- return portletWindowCache.getAllPortletWindows();
- }
-
- protected void removeForPortletDefinition(PortletDefinition def)
- {
- Iterator windows = getPortletWindows().iterator();
- while(windows.hasNext())
- {
- PortletWindow window = (PortletWindow) windows.next();
- PortletDefinition windowDef = (PortletDefinition)window.getPortletEntity().getPortletDefinition();
- if(def != null && windowDef != null && def.getUniqueName() != null && def.getUniqueName().equals(windowDef.getUniqueName()))
- {
- removeWindow(window);
- }
- }
- if (def != null)
- portletFactory.updatePortletConfig(def);
- }
-
- protected void removeForPortletApplication(PortletApplication app)
- {
- Iterator windows = getPortletWindows().iterator();
- while(windows.hasNext())
- {
- PortletWindow window = (PortletWindow) windows.next();
- PortletDefinition pd = (PortletDefinition)window.getPortletEntity().getPortletDefinition();
- if (pd != null)
- {
- PortletApplication windowApp = (PortletApplication)pd.getApplication();
- if (app.getName().equals(windowApp.getName()))
- {
- removeWindow(window);
- }
- }
- }
- }
-
- public void applicationRemoved(PortletApplication app)
- {
- if (app != null)
- {
- removeForPortletApplication(app);
- }
- }
-
-
- public void applicationUpdated(PortletApplication app)
- {
- if (app != null)
- {
- removeForPortletApplication(app);
- }
- }
-
- public void portletRemoved(PortletDefinition def)
- {
- if (def != null)
- {
- removeForPortletDefinition(def);
- }
- }
-
- public void portletUpdated(PortletDefinition def)
- {
- if (def != null)
- {
- removeForPortletDefinition(def);
- }
- }
-}
+ * 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.jetspeed.container.window.impl;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.cache.PortletWindowCache;
+import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
+import org.apache.jetspeed.components.portletentity.PortletEntityNotGeneratedException;
+import org.apache.jetspeed.components.portletentity.PortletEntityNotStoredException;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.components.portletregistry.RegistryEventListener;
+import org.apache.jetspeed.container.window.FailedToCreateWindowException;
+import org.apache.jetspeed.container.window.FailedToRetrievePortletWindow;
+import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.factory.PortletFactory;
+import org.apache.jetspeed.om.page.ContentFragment;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
+import org.apache.jetspeed.util.ArgUtil;
+import org.apache.jetspeed.container.PortletEntity;
+import org.apache.jetspeed.container.PortletWindow;
+
+/**
+ * Portlet Window Accessor Implementation
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: PortletWindowAccessorImpl.java,v 1.12 2005/04/29 14:01:57 weaver Exp $
+ */
+public class PortletWindowAccessorImpl implements PortletWindowAccessor, RegistryEventListener
+{
+ protected final static Log log = LogFactory.getLog(PortletWindowAccessorImpl.class);
+
+ private PortletEntityAccessComponent entityAccessor;
+ private PortletFactory portletFactory;
+ private boolean validateWindows = false;
+ private PortletWindowCache portletWindowCache;
+
+ public PortletWindowAccessorImpl(PortletEntityAccessComponent entityAccessor, PortletFactory portletFactory, PortletWindowCache portletWindowCache, boolean validateWindows)
+ {
+ this.entityAccessor = entityAccessor;
+ this.portletFactory = portletFactory;
+ this.validateWindows = validateWindows;
+ this.portletWindowCache = portletWindowCache;
+
+ }
+
+ public PortletWindowAccessorImpl(PortletEntityAccessComponent entityAccessor,
+ PortletFactory portletFactory,
+ PortletRegistry registry,
+ PortletWindowCache portletWindowCache,
+ boolean validateWindows)
+ {
+ this.entityAccessor = entityAccessor;
+ this.portletFactory = portletFactory;
+ this.validateWindows = validateWindows;
+ this.portletWindowCache = portletWindowCache;
+ registry.addRegistryListener(this);
+ }
+
+ public PortletWindow createPortletWindow(PortletEntity entity, String windowId)
+ {
+ if(entity == null)
+ {
+ throw new IllegalArgumentException("cratePortletWindow requires a non-null PortletEntity");
+ }
+
+ PortletWindow found = getWindowFromCache(windowId);
+ if (found != null)
+ {
+ // remove from cache if invalid entity
+ checkPortletWindowEntity(found);
+ found.setPortletEntity(entity);
+ return found;
+ }
+
+ PortletWindowImpl window = new PortletWindowImpl(windowId);
+ window.setPortletEntity(entity);
+ if ( isValidPortletEntity(entity))
+ {
+ portletWindowCache.putPortletWindow(window);
+ }
+ return window;
+ }
+
+ public PortletWindow createPortletWindow(String windowId)
+ {
+ PortletWindow found = getWindowFromCache(windowId);
+ if (found != null)
+ {
+ // remove from cache if invalid entity
+ checkPortletWindowEntity(found);
+ return found;
+ }
+ PortletWindowImpl window = new PortletWindowImpl(windowId);
+ return window;
+ }
+
+ public PortletWindow getPortletWindow(String windowId)
+ {
+ PortletWindow window = getWindowFromCache(windowId);
+ if (window != null)
+ {
+ // remove from cache if invalid entity
+ checkPortletWindowEntity(window);
+ }
+ return window;
+ }
+
+ public PortletWindow getPortletWindow(ContentFragment fragment) throws FailedToRetrievePortletWindow, PortletEntityNotStoredException
+ {
+ ArgUtil.assertNotNull(ContentFragment.class, fragment, this, "getPortletWindow(Fragment fragment)");
+ PortletWindow portletWindow = getWindowFromCache(fragment);
+ if (portletWindow == null || !checkPortletWindowEntity(portletWindow))
+ {
+ try
+ {
+ return createPortletWindow(fragment);
+ }
+ catch (FailedToCreateWindowException e)
+ {
+ throw new FailedToRetrievePortletWindow(e.toString(), e);
+ }
+ }
+ else
+ {
+ if (validateWindows)
+ {
+ validateWindow(fragment, portletWindow);
+ }
+ }
+ return portletWindow;
+ }
+
+ /**
+ * <p>
+ * validateWindow
+ * </p>
+ *
+ * @param fragment
+ * @param portletWindow
+ * @throws PortletEntityNotStoredException
+ * @throws InconsistentWindowStateException
+ */
+ protected void validateWindow( ContentFragment fragment, PortletWindow portletWindow ) throws FailedToRetrievePortletWindow, PortletEntityNotStoredException
+ {
+ // make sure the window has the most up-to-date portlet entity
+ PortletEntity portletEntity = entityAccessor.getPortletEntityForFragment(fragment);
+ if(portletEntity != null)
+ {
+ portletWindow.setPortletEntity(portletEntity);
+ // if not a valid entity, remove window from cache
+ checkPortletWindowEntity(portletWindow);
+ }
+ else
+ {
+ removeWindow(portletWindow);
+ throw new FailedToRetrievePortletWindow("No PortletEntity exists for for id "+fragment.getId()+" removing window from cache.");
+ }
+ }
+
+ private PortletWindow createPortletWindow(ContentFragment fragment) throws FailedToCreateWindowException, PortletEntityNotStoredException
+ {
+ PortletWindow portletWindow = new PortletWindowImpl(fragment.getId());
+ boolean temporaryWindow = false;
+
+ PortletEntity portletEntity = entityAccessor.getPortletEntityForFragment(fragment);
+ if (portletEntity == null)
+ {
+ log.info("No portlet entity defined for fragment ID "+fragment.getId()+" attempting to auto-generate...");
+ try
+ {
+ portletEntity = entityAccessor.generateEntityFromFragment(fragment);
+ // not portlet definition most likely means that the portlet has not been deployed so dont worry about storing off the entity
+ if(isValidPortletEntity(portletEntity))
+ {
+ entityAccessor.storePortletEntity(portletEntity);
+ }
+ else
+ {
+ // don't cache the incomplete window
+ temporaryWindow = true;
+ }
+ }
+ catch (PortletEntityNotGeneratedException e)
+ {
+ throw new FailedToCreateWindowException("Error generating new PortletEntity: "+e.toString(), e);
+ }
+ catch (PortletEntityNotStoredException e)
+ {
+ throw new FailedToCreateWindowException("Error storing new PortletEntity: "+e.toString(), e);
+ }
+
+ if(portletEntity == null)
+ {
+ throw new FailedToCreateWindowException("Unable to generate portlet entity.");
+ }
+ }
+ portletWindow.setPortletEntity(portletEntity);
+
+ if ( !temporaryWindow )
+ {
+ portletWindowCache.putPortletWindow(portletWindow);
+ }
+ return portletWindow;
+ }
+
+
+ public void removeWindows(PortletEntity portletEntity)
+ {
+ portletWindowCache.removePortletWindowByPortletEntityId(portletEntity.getId().toString());
+ }
+
+ public void removeWindow(PortletWindow window)
+ {
+ portletWindowCache.removePortletWindow(window.getId().toString());
+ }
+
+ private PortletWindow getWindowFromCache(ContentFragment fragment)
+ {
+ return portletWindowCache.getPortletWindow(fragment.getId());
+ }
+
+ private PortletWindow getWindowFromCache(String id)
+ {
+ return portletWindowCache.getPortletWindow(id);
+ }
+
+ private boolean checkPortletWindowEntity(PortletWindow window)
+ {
+ if (!isValidPortletEntity(window.getPortletEntity()))
+ {
+ removeWindow(window);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean isValidPortletEntity(PortletEntity pe)
+ {
+ return pe != null
+ && pe.getPortletDefinition() != null
+ && pe.getPortletDefinition().getApplication() != null
+ && portletFactory.isPortletApplicationRegistered((PortletApplication) pe.getPortletDefinition()
+ .getApplication());
+ }
+
+ public Set getPortletWindows()
+ {
+ return portletWindowCache.getAllPortletWindows();
+ }
+
+ protected void removeForPortletDefinition(PortletDefinition def)
+ {
+ Iterator windows = getPortletWindows().iterator();
+ while(windows.hasNext())
+ {
+ PortletWindow window = (PortletWindow) windows.next();
+ PortletDefinition windowDef = (PortletDefinition)window.getPortletEntity().getPortletDefinition();
+ if(def != null && windowDef != null && def.getUniqueName() != null && def.getUniqueName().equals(windowDef.getUniqueName()))
+ {
+ removeWindow(window);
+ }
+ }
+ if (def != null)
+ portletFactory.updatePortletConfig(def);
+ }
+
+ protected void removeForPortletApplication(PortletApplication app)
+ {
+ Iterator windows = getPortletWindows().iterator();
+ while(windows.hasNext())
+ {
+ PortletWindow window = (PortletWindow) windows.next();
+ PortletDefinition pd = (PortletDefinition)window.getPortletEntity().getPortletDefinition();
+ if (pd != null)
+ {
+ PortletApplication windowApp = (PortletApplication)pd.getApplication();
+ if (app.getName().equals(windowApp.getName()))
+ {
+ removeWindow(window);
+ }
+ }
+ }
+ }
+
+ public void applicationRemoved(PortletApplication app)
+ {
+ if (app != null)
+ {
+ removeForPortletApplication(app);
+ }
+ }
+
+
+ public void applicationUpdated(PortletApplication app)
+ {
+ if (app != null)
+ {
+ removeForPortletApplication(app);
+ }
+ }
+
+ public void portletRemoved(PortletDefinition def)
+ {
+ if (def != null)
+ {
+ removeForPortletDefinition(def);
+ }
+ }
+
+ public void portletUpdated(PortletDefinition def)
+ {
+ if (def != null)
+ {
+ removeForPortletDefinition(def);
+ }
+ }
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/window/impl/PortletWindowAccessorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/CustomDecoratorActionsFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/DefaultDecoratorActionsFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
|