You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2006/10/14 16:53:55 UTC
svn commit: r463947 - in
/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket: ./
markup/ protocol/http/ protocol/http/request/ request/
request/target/coding/ settings/ util/lang/
Author: ehillenius
Date: Sat Oct 14 07:53:54 2006
New Revision: 463947
URL: http://svn.apache.org/viewvc?view=rev&rev=463947
Log:
var small refactorings, and put some 2.0 transition code in
Added:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestTargetMountsInfo.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/IMountableRequestTargetUrlCodingStrategy.java
Modified:
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Application.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupCache.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WebApplication.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/BookmarkablePageRequestTargetUrlCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/PackageRequestTargetUrlCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/SharedResourceRequestTargetUrlCodingStrategy.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IExceptionSettings.java
incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/util/lang/Classes.java
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Application.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Application.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Application.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/Application.java Sat Oct 14 07:53:54 2006
@@ -397,6 +397,7 @@
* @return Application's ajax related settings
* @see IAjaxSettings
* @since 1.2
+ * @deprecated use {@link #getDebugSettings()} instead
*/
public final IAjaxSettings getAjaxSettings()
{
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupCache.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupCache.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupCache.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/markup/MarkupCache.java Sat Oct 14 07:53:54 2006
@@ -193,7 +193,7 @@
markupResource = new MarkupResourceStream(resourceStream,
new ContainerInfo(container), containerClass);
}
-
+
// load the markup and watch for changes
markup = loadMarkupAndWatchForChanges(container, key, markupResource);
}
@@ -231,12 +231,13 @@
afterLoadListeners.notifyListeners(markupResourceStream);
afterLoadListeners.remove(markupResourceStream);
}
-
+
/**
* Remove the markup from the cache and trigger all associated listeners
*
* @since 1.2.3
- * @param markupResourceStream The resource stream
+ * @param markupResourceStream
+ * The resource stream
*/
public void removeMarkup(final MarkupResourceStream markupResourceStream)
{
@@ -247,11 +248,11 @@
Map.Entry entry = (Map.Entry)iter.next();
if (entry.getValue() == markupResourceStream)
{
- key = (CharSequence) entry.getKey();
+ key = (CharSequence)entry.getKey();
break;
}
}
-
+
if (key != null)
{
removeMarkup(key, markupResourceStream);
@@ -408,6 +409,14 @@
}
/**
+ * @return the number of elements currently in the cache.
+ */
+ public int size()
+ {
+ return markupCache.size();
+ }
+
+ /**
* The markup has just been loaded and now we check if markup inheritance
* applies, which is if <wicket:extend> is found in the markup. If yes, than
* load the base markups and merge the markup elements to create an updated
@@ -497,7 +506,7 @@
{
for (int i = 0; i < markup.size(); i++)
{
- MarkupElement elem = (MarkupElement) markup.get(i);
+ MarkupElement elem = (MarkupElement)markup.get(i);
if (elem instanceof WicketTag)
{
WicketTag wtag = (WicketTag)elem;
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WebApplication.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WebApplication.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WebApplication.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/WebApplication.java Sat Oct 14 07:53:54 2006
@@ -71,11 +71,11 @@
* init() method. For example:
*
* <pre>
- * public void init()
- * {
- * String webXMLParameter = getWicketServlet().getInitParameter("myWebXMLParameter");
- * URL schedulersConfig = getWicketServlet().getServletContext().getResource("/WEB-INF/schedulers.xml");
- * ...
+ * public void init()
+ * {
+ * String webXMLParameter = getWicketServlet().getInitParameter("myWebXMLParameter");
+ * URL schedulersConfig = getWicketServlet().getServletContext().getResource("/WEB-INF/schedulers.xml");
+ * ...
* </pre>
*
* @see WicketServlet
@@ -98,6 +98,12 @@
public abstract class WebApplication extends Application implements ISessionFactory
{
/**
+ * The cached application key. Will be set in
+ * {@link #setWicketServlet(WicketServlet)} based on the servlet context.
+ */
+ private String applicationKey;
+
+ /**
* Map of buffered responses that are in progress per session. Buffered
* responses are temporarily stored
*/
@@ -106,6 +112,9 @@
/** the default request cycle processor implementation. */
private IRequestCycleProcessor requestCycleProcessor;
+ /** Request logger instance. */
+ private RequestLogger requestLogger;
+
/**
* the prefix for storing variables in the actual session (typically
* {@link HttpSession} for this application instance.
@@ -118,21 +127,53 @@
/** The WicketServlet that this application is attached to */
private WicketServlet wicketServlet;
- /** Request logger instance. */
- private RequestLogger requestLogger;
+ /**
+ * Constructor. <strong>Use {@link #init()} for any configuration of your
+ * application instead of overriding the constructor.</strong>
+ */
+ public WebApplication()
+ {
+ }
/**
- * The cached application key. Will be set in
- * {@link #setWicketServlet(WicketServlet)} based on the servlet context.
+ * @see wicket.Application#getApplicationKey()
*/
- private String applicationKey;
+ public final String getApplicationKey()
+ {
+ if (applicationKey == null)
+ {
+ throw new IllegalStateException("the application key does not seem to"
+ + " be set properly or this method is called before WicketServlet is"
+ + " set, which leads to the wrong behavior");
+ }
+ return applicationKey;
+ }
/**
- * Constructor. <strong>Use {@link #init()} for any configuration of your
- * application instead of overriding the constructor.</strong>
+ * Gets the default request cycle processor (with lazy initialization). This
+ * is the {@link IRequestCycleProcessor} that will be used by
+ * {@link RequestCycle}s when custom implementations of the request cycle
+ * do not provide their own customized versions.
+ *
+ * @return the default request cycle processor
*/
- public WebApplication()
+ public final IRequestCycleProcessor getRequestCycleProcessor()
+ {
+ if (requestCycleProcessor == null)
+ {
+ requestCycleProcessor = newRequestCycleProcessor();
+ }
+ return requestCycleProcessor;
+ }
+
+ /**
+ * Gets the {@link RequestLogger}.
+ *
+ * @return The RequestLogger
+ */
+ public final RequestLogger getRequestLogger()
{
+ return requestLogger;
}
/**
@@ -174,26 +215,30 @@
return wicketServlet;
}
- /*
- * Set the application key value
+ /**
+ * @see wicket.Application#logEventTarget(wicket.IRequestTarget)
*/
- protected final void setApplicationKey(String applicationKey)
+ public void logEventTarget(IRequestTarget target)
{
- this.applicationKey=applicationKey;
+ super.logEventTarget(target);
+ RequestLogger rl = getRequestLogger();
+ if (rl != null)
+ {
+ rl.logEventTarget(target);
+ }
}
-
+
/**
- * @see wicket.Application#getApplicationKey()
+ * @see wicket.Application#logResponseTarget(wicket.IRequestTarget)
*/
- public final String getApplicationKey()
+ public void logResponseTarget(IRequestTarget target)
{
- if (applicationKey == null)
+ super.logResponseTarget(target);
+ RequestLogger rl = getRequestLogger();
+ if (rl != null)
{
- throw new IllegalStateException("the application key does not seem to"
- + " be set properly or this method is called before WicketServlet is"
- + " set, which leads to the wrong behavior");
+ rl.logResponseTarget(target);
}
- return applicationKey;
}
/**
@@ -283,6 +328,43 @@
}
/**
+ * Create new Wicket Session object. Note, this method is not called if you
+ * registered your own ISessionFactory with the Application.
+ *
+ * @see wicket.ISessionFactory#newSession()
+ */
+ public Session newSession()
+ {
+ return new WebSession(WebApplication.this);
+ }
+
+ /**
+ * @param sessionId
+ * The session id that was destroyed
+ */
+ public void sessionDestroyed(String sessionId)
+ {
+ bufferedResponses.remove(sessionId);
+
+ RequestLogger logger = getRequestLogger();
+ if (logger != null)
+ {
+ logger.sessionDestroyed(sessionId);
+ }
+ }
+
+ /**
+ * Sets the {@link RequestLogger}.
+ *
+ * @param logger
+ * The request logger
+ */
+ public final void setRequestLogger(RequestLogger logger)
+ {
+ requestLogger = logger;
+ }
+
+ /**
* @param sessionFactory
* The session factory to use
*/
@@ -326,53 +408,6 @@
}
/**
- * @see wicket.Application#logEventTarget(wicket.IRequestTarget)
- */
- public void logEventTarget(IRequestTarget target)
- {
- super.logEventTarget(target);
- RequestLogger rl = getRequestLogger();
- if (rl != null)
- {
- rl.logEventTarget(target);
- }
- }
-
- /**
- * @see wicket.Application#logResponseTarget(wicket.IRequestTarget)
- */
- public void logResponseTarget(IRequestTarget target)
- {
- super.logResponseTarget(target);
- RequestLogger rl = getRequestLogger();
- if (rl != null)
- {
- rl.logResponseTarget(target);
- }
- }
-
- /**
- * Gets the {@link RequestLogger}.
- *
- * @return The RequestLogger
- */
- public final RequestLogger getRequestLogger()
- {
- return requestLogger;
- }
-
- /**
- * Sets the {@link RequestLogger}.
- *
- * @param logger
- * The request logger
- */
- public final void setRequestLogger(RequestLogger logger)
- {
- requestLogger = logger;
- }
-
- /**
* Create a request cycle factory which is used by default by WebSession.
* You may provide your own default factory by subclassing WebApplication
* and overriding this method or your may subclass WebSession to create a
@@ -399,53 +434,13 @@
}
/**
- * Gets the default request cycle processor (with lazy initialization). This
- * is the {@link IRequestCycleProcessor} that will be used by
- * {@link RequestCycle}s when custom implementations of the request cycle
- * do not provide their own customized versions.
- *
- * @return the default request cycle processor
- */
- protected final IRequestCycleProcessor getRequestCycleProcessor()
- {
- if (requestCycleProcessor == null)
- {
- requestCycleProcessor = newRequestCycleProcessor();
- }
- return requestCycleProcessor;
- }
-
- /**
- * May be replaced by subclasses which whishes to uses there own
- * implementation of IRequestCycleProcessor
- *
- * @return IRequestCycleProcessor
- */
- // TODO Doesn't this method belong in Application, not WebApplication?
- protected IRequestCycleProcessor newRequestCycleProcessor()
- {
- return new DefaultWebRequestCycleProcessor();
- }
-
- /**
* @see wicket.Application#getSessionFactory()
*/
protected ISessionFactory getSessionFactory()
{
return this.sessionFactory;
}
-
- /**
- * Create new Wicket Session object. Note, this method is not called
- * if you registered your own ISessionFactory with the Application.
- *
- * @see wicket.ISessionFactory#newSession()
- */
- public Session newSession()
- {
- return new WebSession(WebApplication.this);
- }
-
+
/**
* Initialize; if you need the wicket servlet for initialization, e.g.
* because you want to read an initParameter from web.xml or you want to
@@ -465,7 +460,8 @@
protected void internalDestroy()
{
ModificationWatcher resourceWatcher = getResourceSettings().getResourceWatcher();
- if(resourceWatcher != null) resourceWatcher.destroy();
+ if (resourceWatcher != null)
+ resourceWatcher.destroy();
super.internalDestroy();
bufferedResponses.clear();
// destroy the resource watcher
@@ -544,6 +540,26 @@
}
/**
+ * May be replaced by subclasses which whishes to uses there own
+ * implementation of IRequestCycleProcessor
+ *
+ * @return IRequestCycleProcessor
+ */
+ // TODO Doesn't this method belong in Application, not WebApplication?
+ protected IRequestCycleProcessor newRequestCycleProcessor()
+ {
+ return new DefaultWebRequestCycleProcessor();
+ }
+
+ /**
+ * @see wicket.Application#newSessionStore()
+ */
+ protected ISessionStore newSessionStore()
+ {
+ return new HttpSessionStore();
+ }
+
+ /**
* Create a new WebRequest. Subclasses of WebRequest could e.g. decode and
* obfuscated URL which has been encoded by an appropriate WebResponse.
*
@@ -569,12 +585,12 @@
servletResponse) : new WebResponse(servletResponse));
}
- /**
- * @see wicket.Application#newSessionStore()
+ /*
+ * Set the application key value
*/
- protected ISessionStore newSessionStore()
+ protected final void setApplicationKey(String applicationKey)
{
- return new HttpSessionStore();
+ this.applicationKey = applicationKey;
}
/**
@@ -618,7 +634,7 @@
session = getSessionFactory().newSession();
// Set the client Locale for this session
session.setLocale(request.getLocale());
-
+
if (sessionStore.getSessionId(request) != null)
{
// Bind the session to the session store
@@ -672,21 +688,6 @@
return buffered;
}
return null;
- }
-
- /**
- * @param sessionId
- * The session id that was destroyed
- */
- public void sessionDestroyed(String sessionId)
- {
- bufferedResponses.remove(sessionId);
-
- RequestLogger logger = getRequestLogger();
- if (logger != null)
- {
- logger.sessionDestroyed(sessionId);
- }
}
/**
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/request/WebRequestCodingStrategy.java Sat Oct 14 07:53:54 2006
@@ -44,6 +44,7 @@
import wicket.protocol.http.WebRequest;
import wicket.protocol.http.WebRequestCycle;
import wicket.request.IRequestCodingStrategy;
+import wicket.request.IRequestTargetMountsInfo;
import wicket.request.RequestParameters;
import wicket.request.target.coding.IRequestTargetUrlCodingStrategy;
import wicket.request.target.component.IBookmarkablePageRequestTarget;
@@ -60,7 +61,7 @@
* @author Eelco Hillenius
* @author Jonathan Locke
*/
-public class WebRequestCodingStrategy implements IRequestCodingStrategy
+public class WebRequestCodingStrategy implements IRequestCodingStrategy, IRequestTargetMountsInfo
{
/** Name of interface target query parameter */
public static final String NAME_SPACE = "wicket:";
@@ -198,8 +199,10 @@
if (path != null)
{
CharSequence prefix = urlPrefix(requestCycle);
- // special check if the prefix ends on '/' because a mount always starts with '/'
- if(prefix.charAt(prefix.length()-1) == '/') prefix = prefix.subSequence(0, prefix.length()-1);
+ // special check if the prefix ends on '/' because a mount always
+ // starts with '/'
+ if (prefix.charAt(prefix.length() - 1) == '/')
+ prefix = prefix.subSequence(0, prefix.length() - 1);
final AppendingStringBuffer buffer = new AppendingStringBuffer(prefix.length()
+ path.length());
buffer.append(prefix);
@@ -231,11 +234,21 @@
{
return url;
}
- // Just return null intead of throwing an exception. So that it can be handled better
+ // Just return null intead of throwing an exception. So that it can be
+ // handled better
return null;
}
/**
+ * @see wicket.request.IRequestTargetMountsInfo#listMounts()
+ */
+ public IRequestTargetUrlCodingStrategy[] listMounts()
+ {
+ return (IRequestTargetUrlCodingStrategy[])mountsOnPath.values().toArray(
+ new IRequestTargetUrlCodingStrategy[mountsOnPath.size()]);
+ }
+
+ /**
* @see wicket.request.IRequestTargetMounter#urlCodingStrategyForPath(java.lang.String)
*/
public final IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(final String path)
@@ -629,11 +642,11 @@
}
buffer.append(sharedResourceKey);
Map map = requestTarget.getRequestParameters().getParameters();
- if(map != null && map.size() > 0)
+ if (map != null && map.size() > 0)
{
buffer.append('?');
Iterator it = map.entrySet().iterator();
- while(it.hasNext())
+ while (it.hasNext())
{
Map.Entry entry = (Entry)it.next();
buffer.append(entry.getKey());
@@ -641,7 +654,7 @@
buffer.append(entry.getValue());
buffer.append('&');
}
- buffer.setLength(buffer.length()-1);
+ buffer.setLength(buffer.length() - 1);
}
return requestCycle.getOriginalResponse().encodeURL(buffer);
}
@@ -809,11 +822,13 @@
buffer.append(path);
}
}
- // special check, if everything is empty then we need to define '/' as urlPrefix
+ // special check, if everything is empty then we need to define '/'
+ // as urlPrefix
// else all urls get relative this is bad for mounts.
- // Except for mounts who have to do a special check else mounts get: //mount
+ // Except for mounts who have to do a special check else mounts get:
+ // //mount
// see encode(RequestCycle,IRequestTarget) when a mount is found.
- if(buffer.length() ==0)
+ if (buffer.length() == 0)
{
urlPrefix = "/";
}
Added: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestTargetMountsInfo.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestTargetMountsInfo.java?view=auto&rev=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestTargetMountsInfo.java (added)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/IRequestTargetMountsInfo.java Sat Oct 14 07:53:54 2006
@@ -0,0 +1,37 @@
+/*
+ * $Id: org.eclipse.jdt.ui.prefs 5004 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) eelco12 $
+ * $Revision: 5004 $
+ * $Date: 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) $
+ *
+ * ==============================================================================
+ * 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 wicket.request;
+
+import wicket.request.target.coding.IRequestTargetUrlCodingStrategy;
+
+/**
+ * Optional interface that can be implemented by implementations of
+ * {@link IRequestTargetMounter} to provide management extensions.
+ *
+ * @author eelcohillenius
+ */
+public interface IRequestTargetMountsInfo extends IRequestTargetMounter
+{
+ /**
+ * List the mounts that are known to the implementing mounter.
+ *
+ * @return the mounts that are known to the implementing mounter
+ */
+ IRequestTargetUrlCodingStrategy[] listMounts();
+}
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java Sat Oct 14 07:53:54 2006
@@ -41,7 +41,8 @@
*/
public abstract class AbstractRequestTargetUrlCodingStrategy
implements
- IRequestTargetUrlCodingStrategy
+ IRequestTargetUrlCodingStrategy,
+ IMountableRequestTargetUrlCodingStrategy
{
/** log. */
private static final Log log = LogFactory.getLog(AbstractRequestTargetUrlCodingStrategy.class);
@@ -150,11 +151,9 @@
}
/**
- * Gets path.
- *
- * @return path
+ * @see wicket.request.target.coding.IMountableRequestTargetUrlCodingStrategy#getMountPath()
*/
- protected final String getMountPath()
+ public final String getMountPath()
{
return mountPath;
}
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/BookmarkablePageRequestTargetUrlCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/BookmarkablePageRequestTargetUrlCodingStrategy.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/BookmarkablePageRequestTargetUrlCodingStrategy.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/BookmarkablePageRequestTargetUrlCodingStrategy.java Sat Oct 14 07:53:54 2006
@@ -75,7 +75,7 @@
final PageParameters parameters = new PageParameters(decodeParameters(parametersFragment,
requestParameters.getParameters()));
String pageMapName = (String)parameters.remove(WebRequestCodingStrategy.PAGEMAP);
- if(requestParameters.getPageMapName() == null)
+ if (requestParameters.getPageMapName() == null)
{
requestParameters.setPageMapName(pageMapName);
}
@@ -138,5 +138,13 @@
}
}
return false;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "BookmarkablePageEncoder[page=" + bookmarkablePageClass + "]";
}
}
Added: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/IMountableRequestTargetUrlCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/IMountableRequestTargetUrlCodingStrategy.java?view=auto&rev=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/IMountableRequestTargetUrlCodingStrategy.java (added)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/IMountableRequestTargetUrlCodingStrategy.java Sat Oct 14 07:53:54 2006
@@ -0,0 +1,37 @@
+/*
+ * $Id: org.eclipse.jdt.ui.prefs 5004 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) eelco12 $
+ * $Revision: 5004 $
+ * $Date: 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) $
+ *
+ * ==============================================================================
+ * 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 wicket.request.target.coding;
+
+/**
+ * Temporary interface to make the transition to 2.0, where
+ * {@link IRequestTargetUrlCodingStrategy} has a method that reviels the mount
+ * path.
+ *
+ * @author eelcohillenius
+ */
+public interface IMountableRequestTargetUrlCodingStrategy extends IRequestTargetUrlCodingStrategy
+{
+
+ /**
+ * Returns the path of the url where this request target is mounted on.
+ *
+ * @return String The path of the url
+ */
+ String getMountPath();
+}
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/PackageRequestTargetUrlCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/PackageRequestTargetUrlCodingStrategy.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/PackageRequestTargetUrlCodingStrategy.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/PackageRequestTargetUrlCodingStrategy.java Sat Oct 14 07:53:54 2006
@@ -132,4 +132,12 @@
}
return false;
}
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "PackageEncoder[package=" + packageName + "]";
+ }
}
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/SharedResourceRequestTargetUrlCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/SharedResourceRequestTargetUrlCodingStrategy.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/SharedResourceRequestTargetUrlCodingStrategy.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/request/target/coding/SharedResourceRequestTargetUrlCodingStrategy.java Sat Oct 14 07:53:54 2006
@@ -95,6 +95,16 @@
return target.getRequestParameters().getResourceKey().equals(resourceKey);
}
else
+ {
return false;
+ }
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "SharedResourceEncoder[key=" + resourceKey + "]";
}
}
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IAjaxSettings.java Sat Oct 14 07:53:54 2006
@@ -24,18 +24,20 @@
* from the browser
*
* @author Igor Vaynberg (ivaynberg)
+ *
+ * @deprecated use IDebugSettings instead
*/
public interface IAjaxSettings
{
/**
+ * @return true if ajax debug mode is enabled, false otherwise
+ */
+ boolean isAjaxDebugModeEnabled();
+
+ /**
* Enables or disables ajax debug mode.
*
* @param enable
*/
void setAjaxDebugModeEnabled(boolean enable);
-
- /**
- * @return true if ajax debug mode is enabled, false otherwise
- */
- boolean isAjaxDebugModeEnabled();
}
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IExceptionSettings.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IExceptionSettings.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IExceptionSettings.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/settings/IExceptionSettings.java Sat Oct 14 07:53:54 2006
@@ -15,49 +15,58 @@
* mark characters (e.g. "??missingKey??")
*
* @author Igor Vaynberg (ivaynberg)
+ *
+ * @deprecated will be removed in 2.0. See methods for details
*/
public interface IExceptionSettings
{
/**
+ * Enumerated type for different ways of displaying unexpected exceptions.
+ *
+ * @deprecated will be moved to {@link IApplicationSettings} in 2.0
+ */
+ public static final class UnexpectedExceptionDisplay extends EnumeratedType
+ {
+ private static final long serialVersionUID = 1L;
+
+ UnexpectedExceptionDisplay(final String name)
+ {
+ super(name);
+ }
+ }
+
+ /**
* Indicates that an exception page appropriate to development should be
* shown when an unexpected exception is thrown.
*/
public static final UnexpectedExceptionDisplay SHOW_EXCEPTION_PAGE = new UnexpectedExceptionDisplay(
- "SHOW_EXCEPTION_PAGE");
-
+ "SHOW_EXCEPTION_PAGE");
/**
* Indicates a generic internal error page should be shown when an
* unexpected exception is thrown.
*/
public static final UnexpectedExceptionDisplay SHOW_INTERNAL_ERROR_PAGE = new UnexpectedExceptionDisplay(
- "SHOW_INTERNAL_ERROR_PAGE");
+ "SHOW_INTERNAL_ERROR_PAGE");
+
/**
* Indicates that no exception page should be shown when an unexpected
* exception is thrown.
*/
public static final UnexpectedExceptionDisplay SHOW_NO_EXCEPTION_PAGE = new UnexpectedExceptionDisplay(
- "SHOW_NO_EXCEPTION_PAGE");
- /**
- * Enumerated type for different ways of displaying unexpected exceptions.
- */
- public static final class UnexpectedExceptionDisplay extends EnumeratedType
- {
- private static final long serialVersionUID = 1L;
-
- UnexpectedExceptionDisplay(final String name)
- {
- super(name);
- }
- }
+ "SHOW_NO_EXCEPTION_PAGE");
/**
* @return Whether to throw an exception when a missing resource is
* requested
+ * @deprecated use
+ * {@link IResourceSettings#getThrowExceptionOnMissingResource()}
+ * instead
*/
boolean getThrowExceptionOnMissingResource();
/**
* @return Returns the unexpectedExceptionDisplay.
+ * @deprecated will be moved to {@link IApplicationSettings} in 2.0
*/
UnexpectedExceptionDisplay getUnexpectedExceptionDisplay();
@@ -65,6 +74,9 @@
* @param throwExceptionOnMissingResource
* Whether to throw an exception when a missing resource is
* requested
+ * @deprecated use
+ * {@link IResourceSettings#setThrowExceptionOnMissingResource(boolean)}
+ * instead
*/
void setThrowExceptionOnMissingResource(final boolean throwExceptionOnMissingResource);
@@ -89,6 +101,8 @@
*
* @param unexpectedExceptionDisplay
* The unexpectedExceptionDisplay to set.
+ *
+ * @deprecated will be moved to {@link IApplicationSettings} in 2.0
*/
void setUnexpectedExceptionDisplay(UnexpectedExceptionDisplay unexpectedExceptionDisplay);
}
Modified: incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/util/lang/Classes.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/util/lang/Classes.java?view=diff&rev=463947&r1=463946&r2=463947
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/util/lang/Classes.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/util/lang/Classes.java Sat Oct 14 07:53:54 2006
@@ -34,67 +34,6 @@
public final class Classes
{
/**
- * Instantiation not allowed
- */
- private Classes()
- {
- }
-
- /**
- * @param className
- * Class to resolve
- * @return Resolved class
- */
- public static Class resolveClass(final String className)
- {
- if (Application.isAttached())
- {
- return Application.get().getApplicationSettings().getClassResolver().resolveClass(
- className);
- }
- try
- {
- return Class.forName(className);
- }
- catch (ClassNotFoundException e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * Gets the name of a given class without the prefixed package path
- *
- * @param c
- * The class
- * @return The class name
- */
- public static String simpleName(final Class c)
- {
- return Strings.lastPathComponent(c.getName(), '.');
- }
-
- /**
- * Takes a Class and a relative path to a class and returns any class at
- * that relative path. For example, if the given Class was java.lang.System
- * and the relative path was "../util/List", then the java.util.List class
- * would be returned.
- *
- * @param scope
- * The package to start at
- * @param path
- * The relative path to the class
- * @return The class
- * @throws ClassNotFoundException
- */
- public static Class relativeClass(final Class scope, final String path)
- throws ClassNotFoundException
- {
- return Class.forName(Packages.absolutePath(scope, path).replace('/', '.'));
- }
-
- /**
* Invoke the setter method for 'name' on object and provide the 'value'
*
* @param object
@@ -172,5 +111,78 @@
"Unable to initialize Component. Failure while invoking method " + methodName
+ ". Cause: " + ex);
}
+ }
+
+ /**
+ * Gets the name of the given class or null if the class is null.
+ *
+ * @param c
+ * The class
+ * @return The class name
+ */
+ public static String name(final Class c)
+ {
+ return (c != null) ? c.getName() : null;
+ }
+
+ /**
+ * Takes a Class and a relative path to a class and returns any class at
+ * that relative path. For example, if the given Class was java.lang.System
+ * and the relative path was "../util/List", then the java.util.List class
+ * would be returned.
+ *
+ * @param scope
+ * The package to start at
+ * @param path
+ * The relative path to the class
+ * @return The class
+ * @throws ClassNotFoundException
+ */
+ public static Class relativeClass(final Class scope, final String path)
+ throws ClassNotFoundException
+ {
+ return Class.forName(Packages.absolutePath(scope, path).replace('/', '.'));
+ }
+
+ /**
+ * @param className
+ * Class to resolve
+ * @return Resolved class
+ */
+ public static Class resolveClass(final String className)
+ {
+ if (Application.isAttached())
+ {
+ return Application.get().getApplicationSettings().getClassResolver().resolveClass(
+ className);
+ }
+ try
+ {
+ return Class.forName(className);
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * Gets the name of a given class without the prefixed package path
+ *
+ * @param c
+ * The class
+ * @return The class name
+ */
+ public static String simpleName(final Class c)
+ {
+ return Strings.lastPathComponent(c.getName(), '.');
+ }
+
+ /**
+ * Instantiation not allowed
+ */
+ private Classes()
+ {
}
}