You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by at...@apache.org on 2008/11/28 13:59:47 UTC
svn commit: r721467 - in
/wicket/trunk/wicket/src/main/java/org/apache/wicket: ./ behavior/
markup/html/form/ markup/html/list/ protocol/http/ protocol/http/portlet/
protocol/http/request/ request/ request/target/basic/
request/target/component/ reques...
Author: ate
Date: Fri Nov 28 04:59:42 2008
New Revision: 721467
URL: http://svn.apache.org/viewvc?rev=721467&view=rev
Log:
WICKET-1620: Portlet 2.0 support
See: https://issues.apache.org/jira/browse/WICKET-1620
I'm *only* committing the javadoc/comment improvements from the provided latest patch here: *no* functional code changes (other than a few for readability purposes).
>From the remaining changes of the provided patch, I'll create a trimmed down and cleaned up version, for easier review of the real enhancements and changes for this issue.
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/IPageMap.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/PageMap.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestContext.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractBehavior.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehavior.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItem.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItemModel.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/EmbeddedPortletHeaderResponse.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletInvalidMarkupFilter.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletRequestContext.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletRequestWrapper.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletResponseWrapper.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketPortlet.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketResponseState.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/RequestParameters.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/listener/RedirectPageRequestTarget.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Application.java Fri Nov 28 04:59:42 2008
@@ -397,6 +397,33 @@
* debugging checks and resource polling is inefficient and may leak resources, particularly on
* webapp redeploy.
*
+ * <div style="bored-width:10px;border-style:solid;">
+ * <p>
+ * To change the deployment mode, add the following to your web.xml, inside your <servlet>
+ * mapping (or <filter> mapping if you're using 1.3.x):
+ *
+ * <pre>
+ * <init-param>
+ * <param-name>configuration</param-name>
+ * <param-value>deployment</param-value>
+ * </init-param>
+ * </pre>
+ *
+ * <p>
+ * You can alternatively set this as a <context-param> on the whole context.
+ *
+ * <p>
+ * Another option is to set the "wicket.configuration" system property to either "deployment" or
+ * "development". The value is not case-sensitive.
+ *
+ * <p>
+ * The system property is checked first, allowing you to add a web.xml param for deployment, and
+ * a command-line override when you want to run in development mode during development.
+ *
+ * <p>
+ * You may also override Application.getConfigurationType() to provide your own custom switch,
+ * in which case none of the above logic is used. </div>
+ *
* @return configuration
* @since 1.2.3 (function existed as a property getter)
* @since 1.3.0 (abstract, used to configure things)
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Fri Nov 28 04:59:42 2008
@@ -707,7 +707,9 @@
* <li>Model (indicated by {@link #FLAG_MODEL_SET})
* <li>MetaDataEntry (optionally {@link MetaDataEntry}[] if more metadata entries are present) *
* <li>{@link IBehavior}(s) added to component. The behaviors are not stored in separate array,
- * they are part of the {@link #data} array
+ * they are part of the {@link #data} array (this is in order to save the space of the pointer
+ * to an empty array as most components have no behaviours). - FIXME - explain why - is this
+ * correct?
* </ul>
* If there is only one attribute set (i.e. model or MetaDataEntry([]) or one behavior), the
* #data object points directly to value of that attribute. Otherwise the data is of type
@@ -918,7 +920,7 @@
}
/**
- * Adds an behavior modifier to the component.
+ * Adds a behavior modifier to the component.
*
* <p>
* Note: this method is override to enable users to do things like discussed in <a
@@ -2329,8 +2331,7 @@
public final void render(final MarkupStream markupStream)
{
// We need to know the index before we do the visibility check.
- // Otherwise
- // we wouldn't know the markup index for invisible components
+ // Otherwise we wouldn't know the markup index for invisible components
if (markupStream != null)
{
markupIndex = markupStream.getCurrentIndex();
@@ -2959,8 +2960,8 @@
* set to the value returned from {@link Component#getMarkupId()}.
*
* @param output
- * True if the component will out the id attribute into markup. Please note that the
- * default behavior is to use the same id as the component. This means that your
+ * True if the component will output the id attribute into markup. Please note that
+ * the default behavior is to use the same id as the component. This means that your
* component must begin with [a-zA-Z] in order to generate a valid markup id
* according to: http://www.w3.org/TR/html401/types.html#type-name
*
@@ -3633,7 +3634,9 @@
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR OVERRIDE.
*
+ * <p>
* Called when a request begins.
+ * </p>
*
* @Deprecated use {@link #onBeforeRender()} instead
*/
@@ -3644,7 +3647,9 @@
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR OVERRIDE.
*
+ * <p>
* Called when a request ends.
+ * </p>
*
* @Deprecated use {@link #onBeforeRender()} instead
*
@@ -3656,7 +3661,9 @@
/**
* THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR OVERRIDE.
*
+ * <p>
* Called anytime a model is changed via setModel or setModelObject.
+ * </p>
*/
protected void internalOnModelChanged()
{
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/IPageMap.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/IPageMap.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/IPageMap.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/IPageMap.java Fri Nov 28 04:59:42 2008
@@ -19,6 +19,8 @@
import org.apache.wicket.session.pagemap.IPageMapEntry;
/**
+ * FIXME IPageMap javadoc
+ *
* @author eelcohillenius
* @author Johan Compagner
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/PageMap.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/PageMap.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/PageMap.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/PageMap.java Fri Nov 28 04:59:42 2008
@@ -27,6 +27,8 @@
import org.apache.wicket.util.lang.Objects;
/**
+ * FIXME javadoc
+ *
* @author Jonathan Locke
* @author jcompagner
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestContext.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestContext.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestContext.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestContext.java Fri Nov 28 04:59:42 2008
@@ -28,16 +28,17 @@
* This is the base strategy for encoding URLs, which is to leave them as is. This is mainly so that
* PortletRequestContext can implement it's portlet encoding strategies as portlets need to have
* special URLs encoded with portal information and portlet namespace.
- *
+ * </p>
* <p>
* For url rewriting, only three methods are needed to support creating Portlet ActionURLs, Portlet
* RenderURLs and Resource/Ajax URLs.
- *
+ * </p>
+ * <p>
* The RequestContext is somewhat comparable to the JSF ExternalContext interface which abstracts
* the external environment (like web or portlet) in which the application is currently running.
* As this is request dependent (the same application can technically be accessed even concurrently
* as web or portlet), in Wicket this context has been termed RequestContext.
- *
+ * </p>
* @see PortletRequestContext
* @author Ate Douma
*/
@@ -164,12 +165,13 @@
/**
* Used to override response objects, typically used by the portlet implementation.
+ *
* <p>
* In a Portlet environment, this allows the portlet container/portal to capture the
* HeaderResponse as a separate stream for merging in the overall page header (together
* with header output for other portlets).
* </p>
- *
+ *
* @see PortletRequestContext#getHeaderResponse()
* @return The IHeaderResponse
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/RequestCycle.java Fri Nov 28 04:59:42 2008
@@ -316,7 +316,7 @@
}
/**
- * Get the original response the request was create with. Access may be necessary with the
+ * Get the original response the request was created with. Access may be necessary with the
* response has temporarily being replaced but your components requires access to lets say the
* cookie methods of a WebResponse.
*
@@ -1045,13 +1045,16 @@
detach();
throw new WicketRuntimeException(
"RequestCycles are non-reusable objects. This instance (" + this +
- ") already executed");
+ ") has already been executed");
}
}
/**
- * THIS METHOD IS WICKET PRIVATE API. DO NOT CALL UNLESS YOU KNOW WHAT YOU ARE DOING. Clean up
- * the request cycle.
+ * THIS METHOD IS WICKET PRIVATE API. DO NOT CALL UNLESS YOU KNOW WHAT YOU ARE DOING.
+ *
+ * <p>
+ * Clean up the request cycle.
+ * </p>
*/
public void detach()
{
@@ -1184,8 +1187,10 @@
*/
private final void processEventsAndRespond()
{
- // let the processor handle/ issue any events
+ // let the processor handle/ issue any events, including building the component hireachy
processor.processEvents(this);
+ // process portlet events - or, perhaps save the event on the session, and get it back out
+ // later
// set current stage manually this time
currentStep = RESPOND;
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Session.java Fri Nov 28 04:59:42 2008
@@ -671,20 +671,24 @@
*
* Get the page for the given path.
*
+ * FIXME javadoc - where does it look? where does it get the page from?
+ *
* @param pageMapName
* The name of the page map where the page is
- * @param path
+ * @param componentPath
* Component path
* @param versionNumber
* The version of the page required
* @return The page based on the first path component (the page id), or null if the requested
* version of the page cannot be found.
*/
- public final Page getPage(final String pageMapName, final String path, final int versionNumber)
+ public final Page getPage(final String pageMapName, final String componentPath,
+ final int versionNumber)
{
if (log.isDebugEnabled())
{
- log.debug("Getting page [path = " + path + ", versionNumber = " + versionNumber + "]");
+ log.debug("Getting page [path = " + componentPath + ", versionNumber = " +
+ versionNumber + "]");
}
// Get page map by name, creating the default page map automatically
@@ -740,7 +744,7 @@
AppendingStringBuffer asb = new AppendingStringBuffer(100);
asb.append("After " + timeout + " the Pagemap " + pageMapName +
" is still locked by: " + t +
- ", giving up trying to get the page for path: " + path);
+ ", giving up trying to get the page for path: " + componentPath);
// if it is still not the right thread..
// This either points to long running code (a report
// page?) or a deadlock or such
@@ -767,7 +771,8 @@
newEntry.thread = Thread.currentThread();
newEntry.requestCycle = RequestCycle.get();
pageMapsUsedInRequest.put(pageMap, newEntry);
- final String id = Strings.firstPathComponent(path, Component.PATH_SEPARATOR);
+ final String id = Strings.firstPathComponent(componentPath,
+ Component.PATH_SEPARATOR);
Page page = pageMap.get(Integer.parseInt(id), versionNumber);
if (page == null)
{
@@ -915,7 +920,7 @@
*/
public final IPageMap newPageMap(final String name)
{
- // Check that session doesn't have too many page maps already
+ // Check that session doesn't have too many page maps already, if so, evict
final int maxPageMaps = getApplication().getSessionSettings().getMaxPageMaps();
synchronized (usedPageMaps)
{
@@ -1377,6 +1382,7 @@
/**
* INTERNAL API. The request cycle when detached will call this.
*
+ * FIXME javadoc - does what?
*/
final void requestDetached()
{
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractBehavior.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractBehavior.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractBehavior.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/AbstractBehavior.java Fri Nov 28 04:59:42 2008
@@ -24,7 +24,7 @@
/**
* Adapter implementation of {@link org.apache.wicket.behavior.IBehavior}. It is recommended to
* extend from this class instead of directly implementing
- * {@link org.apache.wicket.behavior.IBehavior} as this class has an extra clean
+ * {@link org.apache.wicket.behavior.IBehavior} as this class has an extra {@link #cleanup()} call.
*
* @author Ralf Ebert
* @author Eelco Hillenius
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehavior.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehavior.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehavior.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/behavior/IBehavior.java Fri Nov 28 04:59:42 2008
@@ -21,16 +21,24 @@
import org.apache.wicket.markup.ComponentTag;
/**
- * Behaviors are kind of plug-ins for Components. They allow to be added to a component and get
- * essential events forwarded by the component. they can be bound to a concrete component (using the
- * bind method is called when the behavior is attached), but they don't need to. They can modify the
- * components markup by changing the rendered ComponentTag. Behaviors can have their own models as
- * well, and they are notified when these are to be detached by the component.
+ * Behaviors are kind of plug-ins for Components. They allow functionality to be added to a
+ * component and get essential events forwarded by the component. They can be bound to a concrete
+ * component (using the bind method which is called when the behavior is attached), but they don't
+ * need to. They can modify the components markup by changing the rendered ComponentTag. Behaviors
+ * can have their own models as well, and they are notified when these are to be detached by the
+ * component.
* <p>
* It is recommended that you extend from {@link org.apache.wicket.behavior.AbstractBehavior}
* instead of directly implementing this interface.
* </p>
*
+ * <p>
+ * Note that behavors are only called during render. They are not the same as events like link
+ * listeners etc.
+ * </p>
+ * <p>
+ * You also cannot modify a components model with a behavor.
+ *
* @see org.apache.wicket.behavior.IBehaviorListener
* @see org.apache.wicket.markup.html.IHeaderContributor
* @see org.apache.wicket.behavior.AbstractAjaxBehavior
@@ -82,8 +90,7 @@
/**
* In case an unexpected exception happened anywhere between onComponentTag() and rendered(),
* onException() will be called for any behavior. Typically, if you clean up resources in
- * {@link #afterRender(Component)}, you should do the same in the implementation of this
- * method.
+ * {@link #afterRender(Component)}, you should do the same in the implementation of this method.
*
* @param component
* the component that has a reference to this behavior and during which processing
@@ -127,8 +134,9 @@
/**
* Specifies whether or not this behavior is temporary. Temporary behaviors are removed at the
- * end of request. Such behaviors are useful for modifying component rendering only when it
- * renders next. Usecases include javascript effects, initial clientside dom setup, etc.
+ * end of request and never reattached. Such behaviors are useful for modifying component
+ * rendering only when it renders next. Usecases include javascript effects, initial clientside
+ * dom setup, etc.
*
* @return true if this behavior is temporary
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java Fri Nov 28 04:59:42 2008
@@ -30,6 +30,7 @@
import org.apache.wicket.Application;
import org.apache.wicket.Component;
+import org.apache.wicket.IConverterLocator;
import org.apache.wicket.Localizer;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Page;
@@ -1260,7 +1261,16 @@
/**
* Converts and validates the conversion of the raw input string into the object specified by
* {@link FormComponent#getType()} and records any errors. Converted value is available through
- * {@link FormComponent#getConvertedInput()}
+ * {@link FormComponent#getConvertedInput()}.
+ *
+ * <p>
+ * Usually the user should do custom conversions by specifying an {@link IConverter} by
+ * registering it with the application by overriding {@link Application#getConverterLocator()},
+ * or at the component level by overriding {@link #getConverter()}.
+ * </p>
+ *
+ * @see IConverterLocator
+ * @see Application#newConverterLocator()
*/
@SuppressWarnings("unchecked")
protected void convertInput()
@@ -1335,7 +1345,7 @@
/**
* Subclasses should overwrite this if the conversion is not done through the type field and the
- * IConverter. <strong>WARNING: this method may be removed in future versions.</strong>
+ * {@link IConverter}. <strong>WARNING: this method may be removed in future versions.</strong>
*
* If conversion fails then a ConversionException should be thrown
*
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItem.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItem.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItem.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItem.java Fri Nov 28 04:59:42 2008
@@ -22,6 +22,7 @@
/**
* Container that holds components in a ListView.
*
+ * @see ListView
* @author Jonathan Locke
*
* @param <T>
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItemModel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItemModel.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItemModel.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/list/ListItemModel.java Fri Nov 28 04:59:42 2008
@@ -21,6 +21,7 @@
/**
* Model for list items.
*
+ * @see ListView
* @param <T>
* Model object type
*
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java Fri Nov 28 04:59:42 2008
@@ -171,7 +171,7 @@
// nop
}
- /**
+ /*
* @see org.apache.wicket.session.ISessionStore#getSessionId(org.apache.wicket.Request, boolean)
*/
public final String getSessionId(Request request, boolean create)
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java Fri Nov 28 04:59:42 2008
@@ -374,9 +374,9 @@
getRequestCycleProcessor().getRequestCodingStrategy().addIgnoreMountPath(path);
}
- /**
+ /*
* @see org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
- * org.apache.wicket.Response)
+ * org.apache.wicket.Response)
*/
@Override
public RequestCycle newRequestCycle(final Request request, final Response response)
@@ -542,7 +542,7 @@
configure();
}
- /**
+ /*
* @see org.apache.wicket.Application#getConfigurationType()
*/
@Override
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WebResponse.java Fri Nov 28 04:59:42 2008
@@ -107,6 +107,7 @@
/**
* Closes response output.
*/
+ @Override
public void close()
{
// NOTE: Servlet container will close the response output stream
@@ -120,6 +121,7 @@
* The URL to encode
* @return The encoded url
*/
+ @Override
public CharSequence encodeURL(CharSequence url)
{
if (httpServletResponse != null && url != null)
@@ -162,6 +164,7 @@
/**
* @see org.apache.wicket.Response#getOutputStream()
*/
+ @Override
public OutputStream getOutputStream()
{
try
@@ -179,6 +182,7 @@
*
* @return True if this response is going to redirect the user agent
*/
+ @Override
public final boolean isRedirect()
{
return redirect;
@@ -194,6 +198,7 @@
* @param url
* The URL to redirect to
*/
+ @Override
public void redirect(String url)
{
if (!redirect)
@@ -225,7 +230,7 @@
// safari chokes on empty response. but perhaps this is
// not the best place?
- httpServletResponse.getWriter().write(" ");
+ httpServletResponse.getWriter().write("-");
}
else
{
@@ -251,6 +256,7 @@
* @param mimeType
* The mime type
*/
+ @Override
public final void setContentType(final String mimeType)
{
if (httpServletResponse != null)
@@ -262,6 +268,7 @@
/**
* @see org.apache.wicket.Response#setContentLength(long)
*/
+ @Override
public void setContentLength(long length)
{
if (httpServletResponse != null)
@@ -273,6 +280,7 @@
/**
* @see org.apache.wicket.Response#setLastModifiedTime(org.apache.wicket.util.time.Time)
*/
+ @Override
public void setLastModifiedTime(Time time)
{
if (httpServletResponse != null)
@@ -295,6 +303,7 @@
* @param locale
* The locale use for mapping the character encoding
*/
+ @Override
public final void setLocale(final Locale locale)
{
if (httpServletResponse != null)
@@ -309,6 +318,7 @@
* @param string
* The string to write
*/
+ @Override
public void write(final CharSequence string)
{
if (string instanceof AppendingStringBuffer)
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java Fri Nov 28 04:59:42 2008
@@ -220,18 +220,22 @@
boolean inPortletContext = false;
if (filterPortletContext != null)
{
+ // collect the request and response together for convenience handling
FilterRequestContext filterRequestContext = new FilterRequestContext(
(HttpServletRequest)request, (HttpServletResponse)response);
- // FIXME comment
+ // sets up the FilterRequestContext for this request, such as wrapping the request and
+ // response objects
inPortletContext = filterPortletContext.setupFilter(getFilterConfig(),
filterRequestContext, getFilterPath((HttpServletRequest)request));
+ // Retrieve and assign the portlet wrapped request/response objects
httpServletRequest = filterRequestContext.getRequest();
httpServletResponse = filterRequestContext.getResponse();
}
else
{
+ // assign plane HTTP servlet request/response objects
httpServletRequest = (HttpServletRequest)request;
httpServletResponse = (HttpServletResponse)response;
}
@@ -248,6 +252,7 @@
final String relativePath = getRelativePath(httpServletRequest);
+ // check against ignore paths and pass on if a match is found
if (ignorePaths.size() > 0 && relativePath.length() > 0)
{
for (String path : ignorePaths)
@@ -274,12 +279,14 @@
// Set the webapplication for this thread
Application.set(webApplication);
+ // last modified time stamp
long lastModified = getLastModified(httpServletRequest);
if (lastModified == -1)
{
// servlet doesn't support if-modified-since, no reason
// to go through further expensive logic
- if (doGet(httpServletRequest, httpServletResponse) == false)
+ boolean requestHandledByWicket = doGet(httpServletRequest, httpServletResponse);
+ if (requestHandledByWicket == false)
{
chain.doFilter(request, response);
}
@@ -328,6 +335,7 @@
}
else
{
+ // request isn't for us
chain.doFilter(request, response);
}
}
@@ -381,19 +389,21 @@
checkCharacterEncoding(servletRequest);
- // Create a new webrequest
+ // Create a new webrequest to wrap the request
final WebRequest request = webApplication.newWebRequest(servletRequest);
// Are we using REDIRECT_TO_BUFFER?
if (webApplication.getRequestCycleSettings().getRenderStrategy() == IRequestCycleSettings.REDIRECT_TO_BUFFER)
{
// Try to see if there is a redirect stored
+ // try get an existing session
ISessionStore sessionStore = webApplication.getSessionStore();
String sessionId = sessionStore.getSessionId(request, false);
if (sessionId != null)
{
BufferedHttpServletResponse bufferedResponse = null;
String queryString = servletRequest.getQueryString();
+ // look for buffered response
if (!Strings.isEmpty(queryString))
{
bufferedResponse = webApplication.popBufferedResponse(sessionId,
@@ -404,7 +414,7 @@
bufferedResponse = webApplication.popBufferedResponse(sessionId,
relativePath);
}
-
+ // if a buffered response was found
if (bufferedResponse != null)
{
bufferedResponse.writeTo(servletResponse);
@@ -415,6 +425,7 @@
}
}
+ // either not REDIRECT_TO_BUFFER or no waiting buffer found - begin the request cycle
WebResponse response = null;
boolean externalCall = !Application.exists();
try
@@ -709,6 +720,7 @@
finally
{
Application.unset();
+ // restore the class loader if it was replaced
if (newClassLoader != previousClassLoader)
{
Thread.currentThread().setContextClassLoader(previousClassLoader);
@@ -933,7 +945,7 @@
*/
private boolean isWicketRequest(String relativePath)
{
- // default location, like
+ // relativePath is emtpy - thus it's the default location, like
// /wicket-examples/forminput/?wicket:interface=:0::::
// the relative path here is empty (wicket-examples is the web
// application and the filter is mapped to /forminput/*
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/EmbeddedPortletHeaderResponse.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/EmbeddedPortletHeaderResponse.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/EmbeddedPortletHeaderResponse.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/EmbeddedPortletHeaderResponse.java Fri Nov 28 04:59:42 2008
@@ -28,6 +28,7 @@
* Portlet behaviour override of the {@link HeaderResponse} implementation, responsible for writing
* header contributions from portlets in the body of the response, as opposed to the head.
*
+ * @see HeaderResponse
* @author Ate Douma
*/
public class EmbeddedPortletHeaderResponse extends HeaderResponse
@@ -47,7 +48,9 @@
if (!isClosed())
{
List token = Arrays.asList(new Object[] { "css", url, media });
+
if (wasRendered(token) == false)
+ // The CSS reference has not been written to the response yet
{
getResponse().write("<script type=\"text/javascript\">");
getResponse().write("var elem=document.createElement(\"link\");");
@@ -65,7 +68,6 @@
}
}
-
/*
* @see org.apache.wicket.markup.html.internal.HeaderResponse#close()
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletInvalidMarkupFilter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletInvalidMarkupFilter.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletInvalidMarkupFilter.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletInvalidMarkupFilter.java Fri Nov 28 04:59:42 2008
@@ -20,17 +20,16 @@
import org.apache.wicket.RequestContext;
import org.apache.wicket.util.string.AppendingStringBuffer;
-
/**
- * This filter removes html page top level markup elements like <html>, <head> and <body>. The
- * filter is configured automatically by WicketFilter if it detects the application is (potentially)
- * invoked as a Portlet.
+ * This filter removes html page top level markup elements like <code><html></code>,
+ * <code><head></code> and <code><body></code>. The filter is configured automatically by
+ * WicketFilter if it detects the application is (potentially) invoked as a Portlet.
*
* @author Ate Douma
*/
public class PortletInvalidMarkupFilter implements IResponseFilter
{
- /**
+ /*
* @see org.apache.wicket.IResponseFilter#filter(AppendingStringBuffer)
*/
public AppendingStringBuffer filter(AppendingStringBuffer responseBuffer)
@@ -81,14 +80,14 @@
private void deleteOpenTag(AppendingStringBuffer responseBuffer, String tagName)
{
int startIndex, endIndex;
- // find and remove opening tag
+ // find and remove opening tag, if it exists
if ((startIndex = responseBuffer.indexOf("<" + tagName)) > -1)
{
if ((endIndex = responseBuffer.indexOf(">", startIndex)) > -1)
{
responseBuffer.delete(startIndex, endIndex + 1);
}
- // remove closing tag
+ // remove closing tag, if it exists
if ((startIndex = responseBuffer.indexOf("</" + tagName + ">")) > -1)
{
responseBuffer.delete(startIndex, startIndex + tagName.length() + 3);
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletRequestContext.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletRequestContext.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletRequestContext.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletRequestContext.java Fri Nov 28 04:59:42 2008
@@ -49,6 +49,7 @@
* For url rewriting, only three methods are needed to support creating Portlet ActionURLs, Portlet
* RenderURLs and Resource/Ajax URLs.
*
+ * @see RequestContext
* @author Ate Douma
*/
public class PortletRequestContext extends RequestContext
@@ -57,6 +58,7 @@
private final PortletConfig portletConfig;
private final PortletRequest portletRequest;
private final PortletResponse portletResponse;
+
/**
* Needed for JSR-168 support which only allows PortletURLs to be created by RenderResponse with
* JSR-286 PortletResponse can do that too.
@@ -72,7 +74,7 @@
*/
private String portletWindowId;
/**
- * Parameter name by which to store the parameter name to store the original Wicket URL.
+ * Stores the parameter name by which to store the Wicket URL as a request parameter.
*/
private final String wicketUrlPortletParameter;
/**
@@ -90,6 +92,8 @@
/**
* Stores the last Wicket URL encoding as a key value pair.
*
+ * FIXME javadoc - is usage explained enough?
+ *
* @see #saveLastEncodedUrl(String, String)
*/
private final String[] lastEncodedUrl = new String[2];
@@ -189,7 +193,7 @@
* FIXME javadoc
*
* <p>
- * Encodes the given path into a portlet URL, saving the original URL against the
+ * Encodes the given path into a portlet URL, saving the original Wicket URL against the
* {@link PortletURL} and in the class {@link #saveLastEncodedUrl(String, String)}.
*
* @see #saveLastEncodedUrl(String, String)
@@ -254,8 +258,9 @@
* FIXME javadoc
*
* <p>
- * Encodes the given path into a portlet URL, saving the original URL against the
- * {@link PortletURL} and in the class {@link #saveLastEncodedUrl(String, String)}.
+ * Encodes the given path into a portlet URL, saving the original Wicket URL against the
+ * {@link PortletURL} and in the class {@link #saveLastEncodedUrl(String, String)} and also
+ * includes the portlet view mode in the url link..
*
* @see #saveLastEncodedUrl(String, String)
* @param path
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletRequestWrapper.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletRequestWrapper.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletRequestWrapper.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletRequestWrapper.java Fri Nov 28 04:59:42 2008
@@ -22,7 +22,7 @@
import javax.servlet.http.HttpSession;
/**
- * Wraps servlet request object with Portal specific functionality by overriding the
+ * Wraps servlet request object with Portlet specific functionality by overriding the
* {@link HttpServletRequestWrapper} retrieval of the context path, path info, request URI etc... to
* return the portal specific translations.
*
@@ -98,6 +98,7 @@
{
session = request.getSession(false);
}
+
servletPath = makeServletPath(filterPath);
// retrieve the correct contextPath, requestURI and queryString
// if request is an include
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletResponseWrapper.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletResponseWrapper.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletResponseWrapper.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/PortletServletResponseWrapper.java Fri Nov 28 04:59:42 2008
@@ -21,10 +21,18 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
+import org.apache.wicket.settings.IRequestCycleSettings;
+
/**
* General class for all Portal responses, wrapping Servlet responses with Portal specific
- * functionality.
+ * functionality. Records various settings in the {@link WicketResponseState}, like the redirect
+ * location, which as when running as a portlet wicket uses the
+ * {@link IRequestCycleSettings#REDIRECT_TO_RENDER} strategy, is used in the render phase to know
+ * what Wicket url to request Wicket Core to render.
+ *
*
+ * @see WicketPortlet#processActionResponseState
+ * @see IRequestCycleSettings#REDIRECT_TO_RENDER
* @see PortletMimeServletResponseWrapper
* @author Ate Douma
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketPortlet.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketPortlet.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketPortlet.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketPortlet.java Fri Nov 28 04:59:42 2008
@@ -55,11 +55,13 @@
*
* <p>
* The WicketPortlet is configured (using an initParameter) against a specific filter path, e.g.
- * Wicket WebApplication. The WicketPortlet maintains a parameter for the current Wicket page url,
- * based against the filter path (e.g. fully qualified to the context path). When a request (action,
- * render or direct resource/ajax call) is received by the WicketPortlet, it dispatches it to Wicket
- * as a servlet request using the provided Wicket page url parameter.
+ * Wicket WebApplication. The WicketPortlet maintains a parameter for the current Wicket page URL
+ * being requested as a URL parameter, based against the filter path (e.g. fully qualified to the
+ * context path). When a request (action, render or direct resource/ajax call) is received by the
+ * WicketPortlet, it dispatches it to Wicket core as a filter request using the provided Wicket page
+ * URL parameter.
*
+ * @see WicketPortlet#WICKET_URL_PORTLET_PARAMETER
* @see WicketFilter
* @author Ate Douma
*/
@@ -70,6 +72,26 @@
*
* <p>
* The prefix for the parameter name for storing Wicket URLs.
+ *
+ * <p>
+ * The actual Wicket URLs generated by Wicket are passed around in portal URLs, encoded by the
+ * portal (as a URL parameter of this name). The Wicket URL is later decoded on subsequent
+ * requests, from the portal URL, so that we know where to route the request, once it's passed
+ * out of the 'portal' realm and into the 'Wicket' realm.
+ *
+ * <p>
+ * This is also used in generating links by {@link PortletRequestContext} in generating links,
+ * as the links have to be portal encoded links, but must also still contain the original wicket
+ * url for use by Wicket (e.g. {@link PortletRequestContext#encodeActionURL}).
+ *
+ * <p>
+ * The name of the parameter which stores the name of the wicket url is stored under
+ * {@link #WICKET_URL_PORTLET_PARAMETER_ATTR}. It will be stored suffixed with the current
+ * portlet mode (e.g. view), so that render requests now what mode to render.
+ *
+ * @see
+ * @see PortletRequestContext
+ * @see #WICKET_URL_PORTLET_PARAMETER_ATTR
*/
public static final String WICKET_URL_PORTLET_PARAMETER = "_wu";
@@ -146,7 +168,9 @@
public static final String WICKET_PORTLET_PROPERTIES = WicketPortlet.class.getName().replace(
'.', '/') +
".properties";
+ /** FIXME javadoc */
public static final String WICKET_FILTER_PATH = WicketPortlet.class.getName() + ".FILTERPATH";
+ /** FIXME javadoc */
public static final String WICKET_FILTER_QUERY = WicketPortlet.class.getName() + ".FILTERQUERY";
/**
@@ -176,9 +200,17 @@
* support.
*/
private PortletResourceURLFactory resourceURLFactory;
+
+ /** FIXME javadoc */
private String wicketFilterPath;
+ /** FIXME javadoc */
private String wicketFilterQuery;
- private final HashMap defaultPages = new HashMap();
+
+ /**
+ * A collection of the default URL's for the different view modes of the portlet - e.g. VIEW,
+ * EDIT, HELP etc...
+ */
+ private final HashMap<String, String> defaultPages = new HashMap<String, String>();
@Override
public void init(PortletConfig config) throws PortletException
@@ -271,9 +303,14 @@
super.destroy();
}
+ /**
+ * @param pageType
+ * the mode of the portlet page, e.g. VIEW, EDIT etc...
+ * @return the default page name for the given pate type.
+ */
protected String getDefaultPage(String pageType)
{
- return (String)defaultPages.get(pageType);
+ return defaultPages.get(pageType);
}
protected String buildWicketFilterPath(String filterPath)
@@ -512,13 +549,25 @@
{
return getServletContextProvider().getHttpServletResponse(portlet, response);
}
-
+ /**
+ * FIXME javadoc - definitely needs explanation - why is no lookup attempted?
+ *
+ * @param request
+ * @param paramName
+ * @param defaultValue
+ * @return
+ */
protected String getWicketConfigParameter(PortletRequest request, String paramName,
String defaultValue)
{
return defaultValue;
}
+ /**
+ * @see WicketPortlet#WICKET_URL_PORTLET_PARAMETER
+ * @param request
+ * @return The prefix for the parameter name for storing Wicket URLs.
+ */
protected String getWicketUrlPortletParameter(PortletRequest request)
{
return WICKET_URL_PORTLET_PARAMETER;
@@ -530,26 +579,48 @@
}
/**
- * Retrieves the Wicket URL from the request object, or if none exists returns the default URL.
+ * Retrieves the Wicket URL from the request object as a request parameter, or if none exists
+ * returns the default URL. The name of the request parameter is stored as a request attribute.
+ *
+ * <p>
+ * This url is then used to pass on to the matching {@link WicketFilter} to process, by way of
+ * {@link RequestDispatcher} via the filters context path.
+ *
+ * <p>
+ * A "parameter" is a form field name/value pair passed from the HTML side of the world. Its
+ * value is a String.
+ *
+ * <p>
+ * An "attribute" is a Java object name/value pair passed only through the internal JavaServer
+ * processes. (I.e. it can come from a JSP or servlet but not an HTML page.) Its value is an
+ * Object.
*
* @see PortletRequestContext#getLastEncodedPath()
* @param request
* @param pageType
* @param defaultPage
+ * url of the default page
* @return the Wicket URL from within the specified request
*/
protected String getWicketURL(PortletRequest request, String pageType, String defaultPage)
{
String wicketURL = null;
+ // get the name of the wicket url paramater, as looked up from a request attribute called
+ // WicketPortlet#WICKET_URL_PORTLET_PARAMETER_ATTR
+ String wicketUrlParameterName = (String)request.getAttribute(WicketPortlet.WICKET_URL_PORTLET_PARAMETER_ATTR);
if (request instanceof ActionRequest)
{
- wicketURL = request.getParameter((String)request.getAttribute(WicketPortlet.WICKET_URL_PORTLET_PARAMETER_ATTR));
+ // try to lookup the passed in wicket url parameter
+ wicketURL = request.getParameter(wicketUrlParameterName);
}
else
{
- wicketURL = request.getParameter((String)request.getAttribute(WicketPortlet.WICKET_URL_PORTLET_PARAMETER_ATTR) +
- request.getPortletMode().toString());
+ // try to lookup the passed in wicket url parameter, suffixed with the portlet mode
+ String parameterName = wicketUrlParameterName + request.getPortletMode().toString();
+ wicketURL = request.getParameter(parameterName);
}
+
+ // if the wicketURL could not be retrieved, return the url for the default page
if (wicketURL == null)
{
wicketURL = getWicketConfigParameter(request, CONFIG_PARAM_PREFIX + pageType,
@@ -558,6 +629,11 @@
return wicketURL;
}
+ /**
+ * Delegates to {@link #processRequest(PortletRequest, PortletResponse, String, String)}.
+ *
+ * @see #processRequest(PortletRequest, PortletResponse, String, String)
+ */
@Override
protected void doView(RenderRequest request, RenderResponse response) throws PortletException,
IOException
@@ -565,6 +641,11 @@
processRequest(request, response, VIEW_REQUEST, PARAM_VIEW_PAGE);
}
+ /**
+ * Delegates to {@link #processRequest(PortletRequest, PortletResponse, String, String)}.
+ *
+ * @see #processRequest(PortletRequest, PortletResponse, String, String)
+ */
@Override
protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException,
IOException
@@ -572,6 +653,11 @@
processRequest(request, response, EDIT_REQUEST, PARAM_EDIT_PAGE);
}
+ /**
+ * Delegates to {@link #processRequest(PortletRequest, PortletResponse, String, String)}.
+ *
+ * @see #processRequest(PortletRequest, PortletResponse, String, String)
+ */
@Override
protected void doHelp(RenderRequest request, RenderResponse response) throws PortletException,
IOException
@@ -579,12 +665,22 @@
processRequest(request, response, HELP_REQUEST, PARAM_HELP_PAGE);
}
+ /**
+ * Delegates to {@link #processRequest(PortletRequest, PortletResponse, String, String)}.
+ *
+ * @see #processRequest(PortletRequest, PortletResponse, String, String)
+ */
protected void doCustom(RenderRequest request, RenderResponse response)
throws PortletException, IOException
{
processRequest(request, response, CUSTOM_REQUEST, PARAM_CUSTOM_PAGE);
}
+ /**
+ * Delegates to {@link #processRequest(PortletRequest, PortletResponse, String, String)}.
+ *
+ * @see #processRequest(PortletRequest, PortletResponse, String, String)
+ */
@Override
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException
@@ -606,13 +702,17 @@
protected void processRequest(PortletRequest request, PortletResponse response,
String requestType, String pageType) throws PortletException, IOException
{
+
String wicketURL = null;
String wicketFilterPath = null;
String wicketFilterQuery = null;
+ // FIXME portal comment: sets the name of the parameter to store the wicket url as a request
+ // attribute, so that we can ?...?
request.setAttribute(WICKET_URL_PORTLET_PARAMETER_ATTR,
getWicketUrlPortletParameter(request));
+ // get the actual wicketURL for this request, to be passed onto Wicket core for processing
wicketURL = getWicketURL(request, pageType, getDefaultPage(pageType));
wicketFilterPath = getWicketConfigParameter(request, WICKET_FILTER_PATH,
this.wicketFilterPath);
@@ -621,6 +721,8 @@
boolean actionRequest = ACTION_REQUEST.equals(requestType);
+ // store the response state and request type in the request object, so they can be looked up
+ // from a different context
WicketResponseState responseState = new WicketResponseState();
request.setAttribute(RESPONSE_STATE_ATTR, responseState);
@@ -632,8 +734,12 @@
request.setAttribute(PORTLET_RESOURCE_URL_ATTR, portletResourceURL);
}
+ // FIXME javadoc - need explanation of why action requests are special
+ // need to record the effective wicket url of the rendered result, so that the subsequent
+ // portlet 'view' requests can delegate to wicket to render the correct location/wicket url.
if (actionRequest)
{
+ // create the request dispatcher, to delegate the request to the wicket filter
ServletContext servletContext = getServletContext(this, request, response);
HttpServletRequest req = getHttpServletRequest(this, request, response);
HttpServletResponse res = getHttpServletResponse(this, request, response);
@@ -660,6 +766,7 @@
}
try
{
+ // delegate to wicket filter - this is where the magic happens
rd.include(req, res);
processActionResponseState(wicketURL, wicketFilterPath, wicketFilterQuery,
(ActionRequest)request, (ActionResponse)response, responseState);
@@ -726,10 +833,13 @@
/**
* Handles redirects set from processing the action. Checks the response state after the action
- * has been processed by Wicket for the presence of a redirect URL, and if present, portletifies
- * the URL. If the URL is a redirect to within the scope of this portlet, leaves it to be
- * handled in a subsequent render call, or if not, sends the redirect to the client.
+ * has been processed by Wicket for the presence of a redirect URL, and if present,
+ * 'portletifies' the URL. If the URL is a redirect to within the scope of this portlet, leaves
+ * it to be handled in a subsequent render call, or if not, sends the redirect to the client.
+ * The recorded url is then used in by wicket in the subsequnt 'VIEW' requests by the portal, to
+ * render the correct Page.
*
+ * @see IRequestCycleSettings#REDIRECT_TO_RENDER
* @param wicketURL
* @param wicketFilterPath
* @param wicketFilterQuery
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketResponseState.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketResponseState.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketResponseState.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/portlet/WicketResponseState.java Fri Nov 28 04:59:42 2008
@@ -16,9 +16,12 @@
*/
package org.apache.wicket.protocol.http.portlet;
+import org.apache.wicket.settings.IRequestCycleSettings;
+
/**
* Holds the current state of the response and the redirect location for Portlets.
*
+ * @see IRequestCycleSettings#REDIRECT_TO_RENDER
* @author Ate Douma
*/
public class WicketResponseState
@@ -26,6 +29,16 @@
private int errorCode;
private String errorMessage;
private int statusCode;
+
+ /**
+ * FIXME javadoc
+ *
+ * Stores the effective wicket url which is used by {@link WicketPortlet} in the view phase to
+ * request a render from wicket core.
+ *
+ * @see IRequestCycleSettings#REDIRECT_TO_RENDER
+ * @see WicketFilterPortletHelper#initFilter
+ */
private String redirectLocation;
/**
@@ -83,6 +96,7 @@
/**
* Sets redirectLocation.
*
+ * @see WicketResponseState#redirectLocation
* @param redirectLocation
* redirectLocation
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java Fri Nov 28 04:59:42 2008
@@ -211,6 +211,7 @@
Map<String, String[]> map = request.getParameterMap();
Iterator<String> iterator = map.keySet().iterator();
+ // remove the parameters with a wicket namepsace prefix from the paramter list
while (iterator.hasNext())
{
String key = iterator.next();
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java Fri Nov 28 04:59:42 2008
@@ -251,6 +251,7 @@
if (requestParameters.getComponentPath() != null &&
requestParameters.getInterfaceName() != null)
{
+ // try to retrieve an existing page
final String componentPath = requestParameters.getComponentPath();
final Page page = session.getPage(requestParameters.getPageMapName(),
componentPath, requestParameters.getVersionNumber());
@@ -262,6 +263,7 @@
}
else
{
+ // create a new page
return new BookmarkableListenerInterfaceRequestTarget(
requestParameters.getPageMapName(), pageClass, params,
requestParameters.getComponentPath(), requestParameters.getInterfaceName(),
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/RequestParameters.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/RequestParameters.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/RequestParameters.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/RequestParameters.java Fri Nov 28 04:59:42 2008
@@ -55,6 +55,9 @@
/** any version number; 0 for no version. */
private int versionNumber;
+ /**
+ * FIXME javadoc
+ */
private boolean onlyProcessIfPathActive = false;
/** any callable interface name (e.g. {@link ILinkListener}). */
@@ -83,8 +86,8 @@
/** depth of the page for relative URLs. */
private int urlDepth = -1;
-
- /* the request query string */
+
+ /** the request query string */
private String queryString;
/**
@@ -365,6 +368,7 @@
/**
* @see java.lang.Object#toString()
*/
+ @Override
public String toString()
{
StringBuffer b = new StringBuffer("[RequestParameters ");
@@ -431,7 +435,7 @@
b.append("]");
return b.toString();
}
-
+
/**
* @return request query string
*/
@@ -439,7 +443,7 @@
{
return queryString;
}
-
+
/**
* @param queryString
*/
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/basic/RedirectRequestTarget.java Fri Nov 28 04:59:42 2008
@@ -22,6 +22,7 @@
import org.apache.wicket.Response;
import org.apache.wicket.markup.html.pages.RedirectPage;
import org.apache.wicket.protocol.http.portlet.PortletRequestContext;
+import org.apache.wicket.request.target.component.listener.RedirectPageRequestTarget;
/**
* A RequestTarget that will send a redirect url to the browser. Use this if you want to direct the
@@ -31,6 +32,7 @@
* If you want to redirect with a delay the {@link RedirectPage} will do a meta tag redirect with a
* delay.
*
+ * @see RedirectPageRequestTarget
* @author jcompagner
*/
public class RedirectRequestTarget implements IRequestTarget
@@ -63,6 +65,8 @@
}
/**
+ * FIXME javadoc - what's special about this implementation?
+ *
* @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle)
*/
public void respond(RequestCycle requestCycle)
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/BookmarkablePageRequestTarget.java Fri Nov 28 04:59:42 2008
@@ -24,12 +24,19 @@
import org.apache.wicket.PageParameters;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.request.IRequestCycleProcessor;
+import org.apache.wicket.settings.IRequestCycleSettings;
/**
- * Default implementation of {@link IBookmarkablePageRequestTarget}. Target that denotes a page
- * that is to be created from the provided page class. This is typically used for redirects to
+ * Default implementation of {@link IBookmarkablePageRequestTarget}. Target that denotes a page that
+ * is to be created from the provided page class. This is typically used for redirects to
* bookmarkable pages or mounted pages.
- *
+ *
+ * <p>
+ * We cannot issue redirects even with {@link IRequestCycleSettings#REDIRECT_TO_RENDER} because the
+ * url has to be bookmarkable, eg user actually being able to bookmark it in the browser. if we
+ * always redirected to a stateful url (e.g. /?wicket:interface=:0::::)that wouldn't work, as it
+ * wouldn't be bookmarkable.
+ *
* @author Eelco Hillenius
* @author Igor Vaynberg (ivaynberg)
*/
@@ -38,7 +45,9 @@
/** the page that was created in response for cleanup */
private Page page;
- /** the class of the page. */
+ /**
+ * the class of the page. FIXME javadoc why use weak reference?
+ * */
private final WeakReference<Class<? extends Page>> pageClassRef;
/** optional page map name. */
@@ -213,8 +222,10 @@
return 17 * result;
}
- /**
- * @see org.apache.wicket.request.target.IEventProcessor#processEvents(org.apache.wicket.RequestCycle)
+ /*
+ * @see
+ * org.apache.wicket.request.target.IEventProcessor#processEvents(org.apache.wicket.RequestCycle
+ * )
*/
public void processEvents(RequestCycle requestCycle)
{
@@ -224,7 +235,7 @@
}
}
- /**
+ /*
* @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle)
*/
public void respond(RequestCycle requestCycle)
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/listener/RedirectPageRequestTarget.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/listener/RedirectPageRequestTarget.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/listener/RedirectPageRequestTarget.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/component/listener/RedirectPageRequestTarget.java Fri Nov 28 04:59:42 2008
@@ -19,11 +19,16 @@
import org.apache.wicket.IRedirectListener;
import org.apache.wicket.Page;
import org.apache.wicket.RequestCycle;
+import org.apache.wicket.request.target.basic.RedirectRequestTarget;
/**
* Specialization of page request that denotes that we are actually handling a redirect request of a
- * page.
+ * page. It does not actually cause a redirect itself.
*
+ * <p>
+ * FIXME javadoc - how is this used? What is it's relationship to {@link RedirectRequestTarget}?
+ *
+ * @see RedirectRequestTarget
* @author Eelco Hillenius
*/
public class RedirectPageRequestTarget extends AbstractListenerInterfaceRequestTarget
@@ -40,10 +45,14 @@
}
/**
+ * FIXME javadoc - why does this not call onProcessEvents like ListenerInterfaceRequestTarget
+ * does?
+ *
* @see org.apache.wicket.request.target.IEventProcessor#processEvents(org.apache.wicket.RequestCycle)
*/
public final void processEvents(final RequestCycle requestCycle)
{
+ // onProcessEvents(requestCycle);
getRequestListenerInterface().invoke(getPage(), getTarget());
}
}
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java?rev=721467&r1=721466&r2=721467&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/IRequestCycleSettings.java Fri Nov 28 04:59:42 2008
@@ -23,6 +23,7 @@
import org.apache.wicket.Session;
import org.apache.wicket.markup.html.pages.BrowserInfoPage;
import org.apache.wicket.protocol.http.WebRequestCycle;
+import org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget;
import org.apache.wicket.settings.IExceptionSettings.UnexpectedExceptionDisplay;
import org.apache.wicket.util.lang.EnumeratedType;
import org.apache.wicket.util.time.Duration;
@@ -139,6 +140,11 @@
* be aware that for one logical request, actually two instances of RequestCycle are created and
* processed.
* </p>
+ * <p>
+ * Also, even with this strategy set, it is ignored for
+ * {@link BookmarkableListenerInterfaceRequestTarget}s, because otherwise they wouldn't be
+ * bookmarkable.
+ * </p>
*/
public static final IRequestCycleSettings.RenderStrategy REDIRECT_TO_RENDER = new IRequestCycleSettings.RenderStrategy(
"CLIENT_SIDE_REDIRECT");