You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2007/11/04 02:15:33 UTC
svn commit: r591717 - in
/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket:
Component.java Page.java
Author: jcompagner
Date: Sat Nov 3 18:15:32 2007
New Revision: 591717
URL: http://svn.apache.org/viewvc?rev=591717&view=rev
Log:
moved the session.bind to page.onBeforeRender from component
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java?rev=591717&r1=591716&r2=591717&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java Sat Nov 3 18:15:32 2007
@@ -428,7 +428,7 @@
public String toString()
{
return "VisibilityChange[component: " + component.getPath() + ", visible: " + visible +
- "]";
+ "]";
}
/**
@@ -640,7 +640,7 @@
/** Component flags. See FLAG_* for possible non-exclusive flag values. */
private int flags = FLAG_VISIBLE | FLAG_ESCAPE_MODEL_STRINGS | FLAG_VERSIONED | FLAG_ENABLED |
- FLAG_IS_RENDER_ALLOWED;
+ FLAG_IS_RENDER_ALLOWED;
/** Component id. */
private String id;
@@ -868,7 +868,7 @@
if (debugSettings.isLinePreciseReportingOnNewComponentEnabled())
{
setMetaData(CONSTRUCTED_AT_KEY, Strings.toString(this, new MarkupException(
- "constructed")));
+ "constructed")));
}
}
@@ -969,9 +969,9 @@
if (getFlag(FLAG_AFTER_RENDERING))
{
throw new IllegalStateException(Component.class.getName() +
- " has not been properly detached. Something in the hierarchy of " +
- getClass().getName() +
- " has not called super.onAfterRender() in the override of onAfterRender() method");
+ " has not been properly detached. Something in the hierarchy of " +
+ getClass().getName() +
+ " has not called super.onAfterRender() in the override of onAfterRender() method");
}
// always detach children because components can be attached
// independently of their parents
@@ -995,9 +995,9 @@
if (!getFlag(FLAG_BEFORE_RENDERING_SUPER_CALL_VERIFIED))
{
throw new IllegalStateException(Component.class.getName() +
- " has not been properly rendered. Something in the hierarchy of " +
- getClass().getName() +
- " has not called super.onBeforeRender() in the override of onBeforeRender() method");
+ " has not been properly rendered. Something in the hierarchy of " +
+ getClass().getName() +
+ " has not called super.onBeforeRender() in the override of onBeforeRender() method");
}
}
}
@@ -1036,14 +1036,6 @@
}
feedbacks.add(this);
}
-
- // If any of the components on page is not stateless, we need to bind the session
- // before we start rendering components, as then jsessionid won't be appended
- // for links rendered before first stateful component
- if (!isStateless() && getSession().isTemporary())
- {
- getSession().bind();
- }
}
/**
@@ -1082,9 +1074,9 @@
if (getFlag(FLAG_DETACHING))
{
throw new IllegalStateException(Component.class.getName() +
- " has not been properly detached. Something in the hierarchy of " +
- getClass().getName() +
- " has not called super.onDetach() in the override of onDetach() method");
+ " has not been properly detached. Something in the hierarchy of " +
+ getClass().getName() +
+ " has not called super.onDetach() in the override of onDetach() method");
}
setFlag(FLAG_ATTACHED, false);
@@ -1384,9 +1376,9 @@
if (page == null)
{
throw new WicketRuntimeException(
- "This component is not (yet) coupled to a page. It has to be able "
- + "to find the page it is supposed to operate in before you can call "
- + "this method (Component#getMarkupId)");
+ "This component is not (yet) coupled to a page. It has to be able "
+ + "to find the page it is supposed to operate in before you can call "
+ + "this method (Component#getMarkupId)");
}
return page.getAutoIndex();
@@ -1415,7 +1407,7 @@
}
final int generatedMarkupId = storedMarkupId instanceof Integer ? ((Integer)storedMarkupId)
- .intValue() : nextAutoIndex();
+ .intValue() : nextAutoIndex();
if (storedMarkupId == null)
{
@@ -2177,8 +2169,8 @@
else
{
throw new IllegalStateException(
- "Tried to remove a behavior that was not added to the component. Behavior: " +
- behavior.toString());
+ "Tried to remove a behavior that was not added to the component. Behavior: " +
+ behavior.toString());
}
return this;
}
@@ -2389,14 +2381,13 @@
{
// We were something other than <tag> or <tag/>
markupStream
- .throwMarkupException("Method renderComponent called on bad markup element: " +
- tag);
+ .throwMarkupException("Method renderComponent called on bad markup element: " + tag);
}
if (tag.isOpenClose() && openTag.isOpen())
{
markupStream
- .throwMarkupException("You can not modify a open tag to open-close: " + tag);
+ .throwMarkupException("You can not modify a open tag to open-close: " + tag);
}
try
@@ -2431,7 +2422,7 @@
if (getRenderBodyOnly() == false)
{
final boolean stripWicketTags = Application.get().getMarkupSettings()
- .getStripWicketTags();
+ .getStripWicketTags();
if (!(openTag instanceof WicketTag) || !stripWicketTags)
{
// Close the manually opened panel tag.
@@ -2523,13 +2514,13 @@
if (!getId().equals(replacement.getId()))
{
throw new IllegalArgumentException(
- "Replacement component must have the same id as the component it will replace. Replacement id [[" +
- replacement.getId() + "]], replaced id [[" + getId() + "]].");
+ "Replacement component must have the same id as the component it will replace. Replacement id [[" +
+ replacement.getId() + "]], replaced id [[" + getId() + "]].");
}
if (parent == null)
{
throw new IllegalStateException(
- "This method can only be called on a component that has already been added to its parent.");
+ "This method can only be called on a component that has already been added to its parent.");
}
parent.replace(replacement);
}
@@ -2801,8 +2792,7 @@
if (model == null)
{
throw new IllegalStateException(
- "Attempt to set model object on null model of component: " +
- getPageRelativePath());
+ "Attempt to set model object on null model of component: " + getPageRelativePath());
}
// Check authorization
@@ -2994,16 +2984,16 @@
if (page == null)
{
return new StringBuffer("[Component id = ").append(getId()).append(
- ", page = <No Page>, path = ").append(getPath()).append(".").append(
- Classes.simpleName(getClass())).append("]").toString();
+ ", page = <No Page>, path = ").append(getPath()).append(".").append(
+ Classes.simpleName(getClass())).append("]").toString();
}
else
{
return new StringBuffer("[Component id = ").append(getId()).append(", page = ")
- .append(getPage().getClass().getName()).append(", path = ").append(
- getPath()).append(".").append(Classes.simpleName(getClass()))
- .append(", isVisible = ").append((isRenderAllowed() && isVisible()))
- .append(", isVersioned = ").append(isVersioned()).append("]").toString();
+ .append(getPage().getClass().getName()).append(", path = ").append(getPath())
+ .append(".").append(Classes.simpleName(getClass())).append(", isVisible = ")
+ .append((isRenderAllowed() && isVisible())).append(", isVersioned = ").append(
+ isVersioned()).append("]").toString();
}
}
else
@@ -3041,7 +3031,7 @@
* @return The URL
*/
public final CharSequence urlFor(final IBehavior behaviour,
- final RequestListenerInterface listener)
+ final RequestListenerInterface listener)
{
return getRequestCycle().urlFor(this, behaviour, listener);
}
@@ -3064,7 +3054,7 @@
* @return Bookmarkable URL to page
*/
public final CharSequence urlFor(final IPageMap pageMap, final Class pageClass,
- final PageParameters parameters)
+ final PageParameters parameters)
{
return getRequestCycle().urlFor(pageMap, pageClass, parameters);
}
@@ -3228,8 +3218,8 @@
if (!tag.getName().equalsIgnoreCase(name))
{
findMarkupStream().throwMarkupException(
- "Component " + getId() + " must be applied to a tag of type '" + name +
- "', not " + tag.toUserDebugString());
+ "Component " + getId() + " must be applied to a tag of type '" + name + "', not " +
+ tag.toUserDebugString());
}
}
@@ -3246,7 +3236,7 @@
* Thrown if the tag does not have the required attribute value
*/
protected final void checkComponentTagAttribute(final ComponentTag tag, final String key,
- final String value)
+ final String value)
{
if (key != null)
{
@@ -3254,9 +3244,8 @@
if (tagAttributeValue == null || !value.equalsIgnoreCase(tagAttributeValue))
{
findMarkupStream().throwMarkupException(
- "Component " + getId() + " must be applied to a tag with '" + key +
- "' attribute matching '" + value + "', not '" + tagAttributeValue +
- "'");
+ "Component " + getId() + " must be applied to a tag with '" + key +
+ "' attribute matching '" + value + "', not '" + tagAttributeValue + "'");
}
}
}
@@ -3274,7 +3263,7 @@
if (!component.isAuto() && getFlag(FLAG_RENDERING))
{
throw new WicketRuntimeException(
- "Cannot modify component hierarchy during render phase");
+ "Cannot modify component hierarchy during render phase");
}
}
@@ -3319,7 +3308,7 @@
if (parent == null)
{
throw new IllegalStateException("Cannot find markupstream for " + this +
- " as there is no parent");
+ " as there is no parent");
}
return parent.findMarkupStream();
@@ -3535,7 +3524,7 @@
{
// Ignore AttributeModifiers when FLAG_IGNORE_ATTRIBUTE_MODIFIER is set
if ((behavior instanceof AttributeModifier) &&
- (getFlag(FLAG_IGNORE_ATTRIBUTE_MODIFIER) != false))
+ (getFlag(FLAG_IGNORE_ATTRIBUTE_MODIFIER) != false))
{
return false;
}
@@ -3703,7 +3692,7 @@
// Apply behavior modifiers
List behaviors = getBehaviorsImpl();
if ((behaviors != null) && !behaviors.isEmpty() && !tag.isClose() &&
- (isIgnoreAttributeModifier() == false))
+ (isIgnoreAttributeModifier() == false))
{
tag = tag.mutable();
@@ -3732,8 +3721,8 @@
// Write the tag
tag
- .writeOutput(getResponse(), stripWicketTags, findMarkupStream()
- .getWicketNamespace());
+ .writeOutput(getResponse(), stripWicketTags, findMarkupStream()
+ .getWicketNamespace());
}
}
@@ -3748,7 +3737,7 @@
* The new markup
*/
protected final void replaceComponentTagBody(final MarkupStream markupStream,
- final ComponentTag tag, final CharSequence body)
+ final ComponentTag tag, final CharSequence body)
{
// The tag might have been changed from open-close to open. Hence
// we'll need what was in the markup itself
@@ -3787,8 +3776,8 @@
{
// There must be a component in this discarded body
markupStream.throwMarkupException("Expected close tag for '" + markupOpenTag +
- "' Possible attempt to embed component(s) '" + markupStream.get() +
- "' in the body of this component which discards its body");
+ "' Possible attempt to embed component(s) '" + markupStream.get() +
+ "' in the body of this component which discards its body");
}
}
}
@@ -3902,8 +3891,8 @@
return this;
}
throw new IllegalArgumentException(
- exceptionMessage("Component is not a container and so does " +
- "not contain the path " + path));
+ exceptionMessage("Component is not a container and so does " + "not contain the path " +
+ path));
}
/**
@@ -3969,7 +3958,7 @@
* if true, the tag will not be written to the output
*/
final void renderClosingComponentTag(final MarkupStream markupStream,
- final ComponentTag openTag, final boolean renderTagOnly)
+ final ComponentTag openTag, final boolean renderTagOnly)
{
// Tag should be open tag and not openclose tag
if (openTag.isOpen())
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java?rev=591717&r1=591716&r2=591717&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java Sat Nov 3 18:15:32 2007
@@ -145,7 +145,7 @@
*
*/
public Page deserializePage(int id, String name, Page page, ObjectInputStream stream)
- throws IOException, ClassNotFoundException;
+ throws IOException, ClassNotFoundException;
/**
* Called from the {@link Page#writeObject(java.io.ObjectOutputStream)} method.
@@ -313,7 +313,7 @@
* The {@link PageParameters} object that was used to construct this page. This will be used in
* creating stateless/bookmarkable links to this page
*
- * @return
+ * @return {@link PageParameters} The construction page parameter
*/
public PageParameters getPageParameters()
{
@@ -336,7 +336,7 @@
// that forwards to IAuthorizationStrategy for RequestListenerInterface
// invocations.
public void afterCallComponent(final Component component,
- final RequestListenerInterface listener)
+ final RequestListenerInterface listener)
{
}
@@ -357,7 +357,7 @@
// that forwards to IAuthorizationStrategy for RequestListenerInterface
// invocations.
public void beforeCallComponent(final Component component,
- final RequestListenerInterface listener)
+ final RequestListenerInterface listener)
{
}
@@ -379,7 +379,7 @@
if (renderedComponents.add(component) == false)
{
throw new MarkupException("The component " + component +
- " has the same wicket:id as another component already added at the same level");
+ " has the same wicket:id as another component already added at the same level");
}
if (log.isDebugEnabled())
{
@@ -535,7 +535,7 @@
}
/**
- * @return
+ * @return String The PageMap name
*/
public final String getPageMapName()
{
@@ -584,7 +584,7 @@
else
{
log.info("No version manager available to retrieve requested versionNumber " +
- versionNumber);
+ versionNumber);
return null;
}
}
@@ -613,7 +613,7 @@
// If we went all the way back to the original page
if (page != null && page.getCurrentVersionNumber() == 0 &&
- page.getAjaxVersionNumber() == 0)
+ page.getAjaxVersionNumber() == 0)
{
// remove version info
page.versionManager = null;
@@ -654,7 +654,7 @@
levels++;
}
buffer.append(StringValue.repeat(levels, " ") + component.getPageRelativePath() +
- ":" + Classes.simpleName(component.getClass()));
+ ":" + Classes.simpleName(component.getClass()));
return null;
}
});
@@ -750,7 +750,7 @@
if (getStatelessHint())
{
log.warn("Page '" + this + "' is not stateless because it is not bookmarkable, " +
- "but the stateless hint is set to true!");
+ "but the stateless hint is set to true!");
}
}
@@ -782,7 +782,7 @@
if (!stateless.booleanValue() && getStatelessHint())
{
log.warn("Page '" + this + "' is not stateless because of '" + returnArray[0] +
- "' but the stateless hint is set to true!");
+ "' but the stateless hint is set to true!");
}
}
@@ -811,13 +811,13 @@
* will remain unchanged.
*/
public final void removePersistedFormData(final Class formClass,
- final boolean disablePersistence)
+ final boolean disablePersistence)
{
// Check that formClass is an instanceof Form
if (!Form.class.isAssignableFrom(formClass))
{
throw new WicketRuntimeException("Form class " + formClass.getName() +
- " is not a subclass of Form");
+ " is not a subclass of Form");
}
// Visit all children which are an instance of formClass
@@ -964,8 +964,8 @@
if (value && !isBookmarkable())
{
throw new WicketRuntimeException(
- "Can't set stateless hint to true on a page when the page is not bookmarkable, page: " +
- this);
+ "Can't set stateless hint to true on a page when the page is not bookmarkable, page: " +
+ this);
}
setFlag(FLAG_STATELESS_HINT, value);
}
@@ -993,13 +993,13 @@
if (versionManager != null)
{
return "[Page class = " + getClass().getName() + ", id = " + getId() + ", version = " +
- versionManager.getCurrentVersionNumber() + ", ajax = " +
- versionManager.getAjaxVersionNumber() + "]";
+ versionManager.getCurrentVersionNumber() + ", ajax = " +
+ versionManager.getAjaxVersionNumber() + "]";
}
else
{
return "[Page class = " + getClass().getName() + ", id = " + getId() + ", version = " +
- 0 + "]";
+ 0 + "]";
}
}
@@ -1034,9 +1034,8 @@
// Add to explanatory string to buffer
buffer.append(Integer.toString(unrenderedComponents.size()) + ". " +
- component + "\n");
- String metadata = (String)component
- .getMetaData(Component.CONSTRUCTED_AT_KEY);
+ component + "\n");
+ String metadata = (String)component.getMetaData(Component.CONSTRUCTED_AT_KEY);
if (metadata != null)
{
buffer.append(metadata);
@@ -1077,15 +1076,13 @@
{
Component sibling = (Component)iterator2.next();
if (!sibling.isVisible() && sibling instanceof MarkupContainer &&
- ((MarkupContainer)sibling).isTransparentResolver())
+ ((MarkupContainer)sibling).isTransparentResolver())
{
// we found a transparent container that isn't visible
// then ignore this component and only do a debug statement here.
- log
- .warn("Component " +
- component +
- " wasn't rendered but most likely it has a transparent parent: " +
- sibling);
+ log.warn("Component " + component +
+ " wasn't rendered but most likely it has a transparent parent: " +
+ sibling);
iterator.remove();
break;
}
@@ -1096,8 +1093,8 @@
{
// Throw exception
throw new WicketRuntimeException(
- "The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered).\n\n" +
- buffer.toString());
+ "The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered).\n\n" +
+ buffer.toString());
}
}
}
@@ -1206,7 +1203,7 @@
// Auto components do not participate in versioning since they are
// added during the rendering phase (which is normally illegal).
if (component.isAuto() || (parent == null && !component.isVersioned()) ||
- (parent != null && !parent.isVersioned()))
+ (parent != null && !parent.isVersioned()))
{
return false;
}
@@ -1332,7 +1329,7 @@
// Write out an xml declaration if the markup stream and settings allow
final MarkupStream markupStream = findMarkupStream();
if ((markupStream != null) && (markupStream.getXmlDeclaration() != null) &&
- (application.getMarkupSettings().getStripXmlDeclarationFromOutput() == false))
+ (application.getMarkupSettings().getStripXmlDeclarationFromOutput() == false))
{
response.write("<?xml version='1.0' encoding='");
response.write(encoding);
@@ -1378,6 +1375,27 @@
setPageMap(map);
setNextAvailableId();
+ }
+
+ /**
+ * @return Factory method that creates a version manager for this Page
+ * @deprecated TODO Remove in 1.4
+ */
+ protected final IPageVersionManager newVersionManager()
+ {
+ return null;
+ }
+
+ protected void onBeforeRender()
+ {
+ super.onBeforeRender();
+ // If any of the components on page is not stateless, we need to bind the session
+ // before we start rendering components, as then jsessionid won't be appended
+ // for links rendered before first stateful component
+ if (getSession().isTemporary() && !isPageStateless())
+ {
+ getSession().bind();
+ }
}
/**