ate 2004/10/15 14:41:43
Modified: jetspeed-api/src/java/org/apache/jetspeed/container/url
PortalURL.java
jetspeed-api/src/java/org/apache/jetspeed/request
RequestContext.java
jetspeed-api/src/java/org/apache/jetspeed/mockobjects/request
MockRequestContext.java
Added: jetspeed-api/src/java/org/apache/jetspeed/container/state
FailedToCreateNavStateException.java
FailedToCreatePortalUrlException.java
FailedToCreatedNavStateCodecException.java
NavigationalState.java
NavigationalStateComponent.java
MutableNavigationalState.java
Removed: jetspeed-api/src/java/org/apache/jetspeed/container/session
NavigationalState.java
FailedToCreateNavStateException.java PageState.java
FailedToCreatePortalUrlException.java
NavigationalStateComponent.java
jetspeed-api/src/java/org/apache/jetspeed/container/url
PortalControlParameter.java
Log:
Implementing PLT.7.1 PortletURL request parameter name and value encoding
See: http://issues.apache.org/jira/browse/JS2-149
Revision Changes Path
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/state/FailedToCreateNavStateException.java
Index: FailedToCreateNavStateException.java
===================================================================
/*
* Copyright 2000-2001,2004 The Apache Software Foundation.
*
* Licensed 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.state;
import org.apache.jetspeed.exception.JetspeedRuntimeException;
/**
* <p>
* FailedToCreateNavStateException
* </p>
* <p>
* Thrown if an attempt to create a [EMAIL PROTECTED] NavigationalState} met with
an unexpected
* failure.
* </p>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $Id: FailedToCreateNavStateException.java,v 1.1 2004/10/15 21:41:43 ate
Exp $
*
*/
public class FailedToCreateNavStateException extends JetspeedRuntimeException
{
/**
*
*/
public FailedToCreateNavStateException()
{
super();
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public FailedToCreateNavStateException( String arg0 )
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public FailedToCreateNavStateException( Throwable arg0 )
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
* @param arg1
*/
public FailedToCreateNavStateException( String arg0, Throwable arg1 )
{
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/state/FailedToCreatePortalUrlException.java
Index: FailedToCreatePortalUrlException.java
===================================================================
/*
* Copyright 2000-2001,2004 The Apache Software Foundation.
*
* Licensed 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.state;
import org.apache.jetspeed.exception.JetspeedRuntimeException;
/**
* <p>
* FailedToCreatePortalUrl
* </p>
* <p>
* Thrown if an attempt to create a Portal URL met with an unexpected
* failure.
* </p>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $Id: FailedToCreatePortalUrlException.java,v 1.1 2004/10/15 21:41:43 ate
Exp $
*
*/
public class FailedToCreatePortalUrlException extends JetspeedRuntimeException
{
/**
*
*/
public FailedToCreatePortalUrlException()
{
super();
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public FailedToCreatePortalUrlException( String arg0 )
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public FailedToCreatePortalUrlException( Throwable arg0 )
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
* @param arg1
*/
public FailedToCreatePortalUrlException( String arg0, Throwable arg1 )
{
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/state/FailedToCreatedNavStateCodecException.java
Index: FailedToCreatedNavStateCodecException.java
===================================================================
/*
* Copyright 2000-2001,2004 The Apache Software Foundation.
*
* Licensed 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.state;
import org.apache.jetspeed.exception.JetspeedRuntimeException;
/**
* FailedToCreateNavStateCodecException
*
* Thrown if an attempt to create a NavigationalStateCodec met with an unexpected
* failure.
* </p>
* @author <a href="mailto:[EMAIL PROTECTED]">Ate Douma</a>
* @version $Id: FailedToCreatedNavStateCodecException.java,v 1.1 2004/10/15
21:41:43 ate Exp $
*
*/
public class FailedToCreatedNavStateCodecException extends JetspeedRuntimeException
{
/**
*
*/
public FailedToCreatedNavStateCodecException()
{
super();
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public FailedToCreatedNavStateCodecException(String arg0)
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public FailedToCreatedNavStateCodecException(Throwable arg0)
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
* @param arg1
*/
public FailedToCreatedNavStateCodecException(String arg0, Throwable arg1)
{
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/state/NavigationalState.java
Index: NavigationalState.java
===================================================================
/*
* Copyright 2000-2001,2004 The Apache Software Foundation.
*
* Licensed 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.state;
import java.io.UnsupportedEncodingException;
import java.util.Iterator;
import java.util.Map;
import javax.portlet.PortletMode;
import javax.portlet.WindowState;
import org.apache.jetspeed.request.RequestContext;
import org.apache.pluto.om.window.PortletWindow;
/**
* NavigationalState gives readonly access to the state of the Portal URL and all
navigational state context
* as well as encoding a new State for usage in a Portal URL.
* <br>
* Note: Support for changing the PortletMode and/or WindowState of a PortletWindow,
other than for encoding a new State
* is moved down to the [EMAIL PROTECTED] MutableNavigationState} interface to
cleanly define the immutable contract of this
* interface.
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: NavigationalState.java,v 1.1 2004/10/15 21:41:43 ate Exp $
*/
public interface NavigationalState
{
public static final String NAVSTATE_SESSION_KEY = "org.apache.jetspeed.navstate";
/*
* Decodes an encoded Navigational State as retrieved from a Portal URL.
* <br>
* Note: Initializing is done only once. Subsequent init requests are ignored.
*
* @param encodedState encoded Navigational State as retrieved from a Portal URL.
* @param characterEncoding String containing the name of the chararacter
encoding
*/
void init(String encodedState, String characterEncoding) throws
UnsupportedEncodingException;
/**
* Synchronize the Navigational State with saved state (if used).
* <br>
* Should be called by the PortalURL impl right after calling [EMAIL PROTECTED]
#init(String)}
*
* @param context The RequestContext for this Navigational State
*/
void sync(RequestContext context);
/**
* Gets the window state for given portlet window.
*
* @param window
* @return
*/
WindowState getState(PortletWindow window);
/**
* Gets the portlet mode for the given portlet window.
*
* @param window
* @return
*/
PortletMode getMode(PortletWindow window);
/**
* For the current request return the (first) maximized window or
* return null if no windows are maximized.
*
* @return The maximized window or null
*/
PortletWindow getMaximizedWindow();
Iterator getParameterNames(PortletWindow window);
String[] getParameterValues(PortletWindow window, String parameterName);
PortletWindow getPortletWindowOfAction();
/**
* Encodes the Navigational State with overrides for a specific PortletWindow
into a string to be embedded within a
* PortalURL.
*
* @param window the PortalWindow
* @param parameters the new request or action parameters for the PortalWindow
* @param mode the new PortletMode for the PortalWindow
* @param state the new WindowState for the PortalWindow
* @param action indicates if to be used in an actionURL or renderURL
* @return encoded new Navigational State
*/
String encode(PortletWindow window, Map parameters, PortletMode mode,
WindowState state, boolean action) throws UnsupportedEncodingException;
/**
* Encodes the Navigational State with overrides for a specific PortletWindow
while retaining its (request)
* parameters into a string to be embedded within a renderURL.
*
* @param window the PortalWindow
* @param mode the new PortletMode for the PortalWindow
* @param state the new WindowState for the PortalWindow
* @return encoded new Navigational State
*/
String encode(PortletWindow window, PortletMode mode, WindowState state) throws
UnsupportedEncodingException;
/**
* @return true if WindowStates and PortletModes will be saved in the Session
*/
boolean isNavigationalParameterStateFull();
/**
* @return true if render parameters will be saved in the Session
*/
boolean isRenderParameterStateFull();
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/state/NavigationalStateComponent.java
Index: NavigationalStateComponent.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.state;
import javax.portlet.PortletMode;
import javax.portlet.WindowState;
import org.apache.jetspeed.container.url.PortalURL;
import org.apache.jetspeed.request.RequestContext;
/**
* NavigationalState
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: NavigationalStateComponent.java,v 1.1 2004/10/15 21:41:43 ate Exp $
*/
public interface NavigationalStateComponent
{
/**
* Creates a navigational state.
* Depending on the implementation, a navigational state context can be
retrieved from
* a persistence store to recover the state of a page such as portlet modes
* and window states of portlets on a page.
*
* @return A new navigational state. This method will never return
<code>null</code>
* @throws FailedToCreateNavStateException if the nav state could not be
created. Under normal
* circumstances, this should not happen.
*/
NavigationalState create();
/**
* Creates a Portal URL representing the URL of the request.
*
* @param context The ubiqitious request context.
* @return A new Portal URL. This method will never return <code>null</code>;
* @throws FailedToCreatePortalUrlException if the portelt url could not be
created. Under normal
* circumstances, this should not happen.
*/
PortalURL createURL(RequestContext context);
/**
* Given a window state name, look up its object.
* Ensures that we always use the same objects for WindowStates
* allowing for comparison by value.
*
* @param name The string representation of the window state.
* @return The corresponding WindowState object
*/
WindowState lookupWindowState(String name);
/**
* Given a portlet mode name, look up its object.
* Ensures that we always use the same objects for Portlet Modes
* allowing for comparison by value.
*
* @param name The string representation of the portlet mode.
* @return The corresponding PortletMode object
*/
PortletMode lookupPortletMode(String name);
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/state/MutableNavigationalState.java
Index: MutableNavigationalState.java
===================================================================
/*
* Copyright 2000-2001,2004 The Apache Software Foundation.
*
* Licensed 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.state;
import javax.portlet.PortletMode;
import javax.portlet.WindowState;
import org.apache.pluto.om.window.PortletWindow;
/**
* MutableNavigationalState
*
* Allows changing the PortletMode and/or WindowState of a PortletWindow state.
* <br>
* This interface extends the [EMAIL PROTECTED] NavigationState} interface to
cleanly define the immutable contract of the latter.
* <br>
* Note: this is actually an ugly hack into the Portal as formally (per the portlet
specs) the PortletMode and/or
* WindowState are only to be modified *and* then retained for the *next* subsequent
renderRequest.
* <br>
* This interface is used for support of the Pluto required PortalActionProvider
implementation (which definition
* is not undisputed, see: [todo: link to pluto-dev "Why PortalActionProvider?" mail
discussion]).
* <br>
* Furthermore, this interface is also used by the Jetspeed-1 JetspeedFusionPortlet
to synchronize the NavigationalState.
* Under which conditions that is done isn't clear yet (to me) but possibly that
can/should be done differently also.
* <br>
* Modifying the Navigational State *during* a renderRequest (before the actual)
rendering can result in a lost of these new states on a
* subsequent refresh of the Portlet if that doesn't trigger changing them again,
because the state of these changes is
* only saved in PortletURLs created during the renderRequest, *not* in the session
(if SessionNavigationalState is used).
* The session state has already been synchronized (if done) *before* these methods
can be called.
* <br>
* Modifying the Navigational State *during* an actionRequest, as done by Pluto
through the PortalActionProvider
* interface just before it sends a redirect, is kinda strange as it can more
cleanly be done through the
* its PortalURLProvider interface (see above link to the mail discussion about
this).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ate Douma</a>
* @version $Id: MutableNavigationalState.java,v 1.1 2004/10/15 21:41:43 ate Exp $
*/
public interface MutableNavigationalState extends NavigationalState
{
/**
* Sets the window state for the given portlet window.
*
* @param window
* @param windowState
*/
void setState(PortletWindow window, WindowState windowState);
/**
* Sets the portlet mode for the given portlet window.
*
* @param window
* @param portletMode
*/
void setMode(PortletWindow window, PortletMode portletMode);
}
1.2 +47 -55
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/url/PortalURL.java
Index: PortalURL.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/container/url/PortalURL.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PortalURL.java 28 May 2004 18:51:55 -0000 1.1
+++ PortalURL.java 15 Oct 2004 21:41:43 -0000 1.2
@@ -6,12 +6,12 @@
*/
package org.apache.jetspeed.container.url;
-import java.util.Iterator;
+import java.util.Map;
import javax.portlet.PortletMode;
import javax.portlet.WindowState;
-import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.container.state.NavigationalState;
import org.apache.pluto.om.window.PortletWindow;
/**
@@ -34,69 +34,61 @@
/** HTTPS protocol. */
public static final String HTTPS = "https";
- void init(RequestContext context);
-
/**
* Gets the Base URL for this portal.
*
* @return The Base URL of the portal.
*/
String getBaseURL();
-
+
/**
- * Encodes a window state for the given window on the URL.
+ * Gets a secure version of the Base URL for this portal.
*
- * @param window The targeted window having its state set.
- * @param state The state being encoded into the URL.
+ * @return The secure Base URL of the portal.
*/
- void setState(PortletWindow window, WindowState state);
-
+ String getBaseURL(boolean secure);
+
/**
- * Encodes a portlet mode for the given window on the URL.
+ * Gets the global navigational path of the current request.
+ * <br>
+ * The path does not contain the NavigationalState parameter
*
- * @param window The targeted window having its mode set.
- * @param mode The portlet mode being encoded into the URL.
- */
- void setMode(PortletWindow window, PortletMode mode);
-
- WindowState getState(PortletWindow window);
- PortletMode getMode(PortletWindow window);
- PortletMode getPreviousMode(PortletWindow window);
- WindowState getPreviousState(PortletWindow window);
-
- ///////////////////////////////////////////////
-
- PortalControlParameter getControlParameters();
-
- boolean isNavigationalParameter(String token);
-
- Iterator getRenderParamNames(PortletWindow window);
+ * @return The the global navigational path of the current request.
+ */
+ String getPath();
- String[] getRenderParamValues(PortletWindow window, String paramName);
+ /**
+ * Gets the NavigationalState for access to the current request portal control
parameters
+ * @return the NavigationalState of the PortalURL
+ */
+ NavigationalState getNavigationalState();
- PortletWindow getPortletWindowOfAction();
-
- void clearRenderParameters(PortletWindow portletWindow);
-
- void setAction(PortletWindow window);
-
- void setRequestParam(String name, String[] values);
-
- void setRenderParam(PortletWindow window, String name, String[] values);
-
- String toString();
-
- String toString(boolean secure);
-
- boolean isStateFullParameter(String param);
-
- String getStateKey(PortletWindow window);
- String getModeKey(PortletWindow window);
- String getActionKey(PortletWindow window);
- String getPrevModeKey(PortletWindow window);
- String getPrevStateKey(PortletWindow window);
- String getRenderParamKey(PortletWindow window);
-
-
-
+ /**
+ * Create a new PortletURL for a PortletWindow including request or action
parameters.
+ * <br>
+ * The Portal Navigational State is encoded within the URL
+ *
+ * @param window the PortalWindow
+ * @param parameters the new request or action parameters for the PortalWindow
+ * @param mode the new PortletMode for the PortalWindow
+ * @param state the new WindowState for the PortalWindow
+ * @param action indicates if an actionURL or renderURL is created
+ * @param secure indicates if a secure url is required
+ * @return a new actionURL or renderURL as String
+ */
+ String createPortletURL(PortletWindow window, Map parameters, PortletMode mode,
WindowState state, boolean action, boolean secure);
+
+ /**
+ * Create a new PortletURL for a PortletWindow retaining its (request)
parameters.
+ * <br>
+ * The Portal Navigational State is encoded within the URL
+ *
+ * @param window the PortalWindow
+ * @param mode the new PortletMode for the PortalWindow
+ * @param state the new WindowState for the PortalWindow
+ * @param secure
+ * @param secure indicates if a secure url is required
+ * @return a new renderURL as String
+ */
+ String createPortletURL(PortletWindow window, PortletMode mode, WindowState
state, boolean secure);
}
1.11 +1 -10
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/request/RequestContext.java
Index: RequestContext.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/request/RequestContext.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RequestContext.java 15 Oct 2004 07:07:49 -0000 1.10
+++ RequestContext.java 15 Oct 2004 21:41:43 -0000 1.11
@@ -25,7 +25,6 @@
import org.apache.jetspeed.aggregator.ContentDispatcher;
import org.apache.jetspeed.capabilities.CapabilityMap;
-import org.apache.jetspeed.container.session.NavigationalState;
import org.apache.jetspeed.container.url.PortalURL;
import org.apache.jetspeed.om.page.Page;
@@ -153,15 +152,7 @@
*
*/
public String getMediaType();
-
- /**
- * Gets the navigational state for this current request.
- *
- * @return The navigational state context object for the current request.
- */
- public NavigationalState getNavigationalState();
-
/**
* Gets the Portal URL for the current request.
*
1.5 +1 -1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java
Index: MockRequestContext.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/mockobjects/request/MockRequestContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MockRequestContext.java 15 Oct 2004 07:07:49 -0000 1.4
+++ MockRequestContext.java 15 Oct 2004 21:41:43 -0000 1.5
@@ -26,7 +26,7 @@
import org.apache.jetspeed.aggregator.ContentDispatcher;
import org.apache.jetspeed.capabilities.CapabilityMap;
-import org.apache.jetspeed.container.session.NavigationalState;
+import org.apache.jetspeed.container.state.NavigationalState;
import org.apache.jetspeed.container.url.PortalURL;
import org.apache.jetspeed.mockobjects.MockHttpServletRequest;
import org.apache.jetspeed.om.page.Page;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]