You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2010/11/20 18:12:12 UTC

svn commit: r1037272 [2/2] - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/ main/java/org/apache/wicket/settings/ main/java/org/apache/wicket/settings/def/ main/java/org/apache/wicket/util/parse/ main/java/org/apache/wicket/version/ test/jav...

Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultRequestCycleSettings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultRequestCycleSettings.java?rev=1037272&view=auto
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultRequestCycleSettings.java (added)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultRequestCycleSettings.java Sat Nov 20 17:12:11 2010
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.settings.def;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.wicket.response.filter.IResponseFilter;
+import org.apache.wicket.settings.IExceptionSettings;
+import org.apache.wicket.settings.IRequestCycleSettings;
+import org.apache.wicket.util.time.Duration;
+
+/**
+ * @author Jonathan Locke
+ * @author Chris Turner
+ * @author Eelco Hillenius
+ * @author Juergen Donnerstag
+ * @author Johan Compagner
+ * @author Igor Vaynberg (ivaynberg)
+ * @author Martijn Dashorst
+ * @author James Carman
+ */
+public class DefaultRequestCycleSettings implements IRequestCycleSettings
+{
+// ****************************************************************************
+// Fields
+// ****************************************************************************
+
+	/** True if the response should be buffered */
+	private boolean bufferResponse = true;
+
+	/**
+	 * Whether Wicket should try to get extensive client info by redirecting to
+	 * {@link org.apache.wicket.markup.html.pages.BrowserInfoPage a page that polls for client
+	 * capabilities}. False by default.
+	 */
+	private boolean gatherExtendedBrowserInfo = false;
+
+	/** Type of handling for unexpected exceptions */
+	private IExceptionSettings.UnexpectedExceptionDisplay unexpectedExceptionDisplay = IExceptionSettings.SHOW_EXCEPTION_PAGE;
+
+	/**
+	 * The render strategy, defaults to 'REDIRECT_TO_BUFFER'. This property influences the default
+	 * way in how a logical request that consists of an 'action' and a 'render' part is handled, and
+	 * is mainly used to have a means to circumvent the 'refresh' problem.
+	 */
+	private IRequestCycleSettings.RenderStrategy renderStrategy = RenderStrategy.REDIRECT_TO_BUFFER;
+
+	/** List of {@link org.apache.wicket.IResponseFilter}s. */
+	private List<IResponseFilter> responseFilters;
+
+	/**
+	 * In order to do proper form parameter decoding it is important that the response and the
+	 * following request have the same encoding. see
+	 * http://www.crazysquirrel.com/computing/general/form-encoding.jspx for additional information.
+	 */
+	private String responseRequestEncoding = "UTF-8";
+
+	/**
+	 * The time that a request will by default be waiting for the previous request to be handled
+	 * before giving up. Defaults to one minute.
+	 */
+	private Duration timeout = Duration.ONE_MINUTE;
+
+// ****************************************************************************
+// IRequestCycleSettings Implementation
+// ****************************************************************************
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#addResponseFilter(org.apache.wicket.IResponseFilter)
+	 */
+	public void addResponseFilter(IResponseFilter responseFilter)
+	{
+		if (responseFilters == null)
+		{
+			responseFilters = new ArrayList<IResponseFilter>(3);
+		}
+		responseFilters.add(responseFilter);
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#getBufferResponse()
+	 */
+	public boolean getBufferResponse()
+	{
+		return bufferResponse;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#getGatherExtendedBrowserInfo()
+	 */
+	public boolean getGatherExtendedBrowserInfo()
+	{
+		return gatherExtendedBrowserInfo;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#getRenderStrategy()
+	 */
+	public IRequestCycleSettings.RenderStrategy getRenderStrategy()
+	{
+		return renderStrategy;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#getResponseFilters()
+	 */
+	public List<IResponseFilter> getResponseFilters()
+	{
+		if (responseFilters == null)
+		{
+			return null;
+		}
+		else
+		{
+			return Collections.unmodifiableList(responseFilters);
+		}
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#getResponseRequestEncoding()
+	 */
+	public String getResponseRequestEncoding()
+	{
+		return responseRequestEncoding;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#getTimeout()
+	 */
+	public Duration getTimeout()
+	{
+		return timeout;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#getUnexpectedExceptionDisplay()
+	 */
+	public IExceptionSettings.UnexpectedExceptionDisplay getUnexpectedExceptionDisplay()
+	{
+		return unexpectedExceptionDisplay;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#setBufferResponse(boolean)
+	 */
+	public void setBufferResponse(boolean bufferResponse)
+	{
+		this.bufferResponse = bufferResponse;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#setGatherExtendedBrowserInfo(boolean)
+	 */
+	public void setGatherExtendedBrowserInfo(boolean gatherExtendedBrowserInfo)
+	{
+		this.gatherExtendedBrowserInfo = gatherExtendedBrowserInfo;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#setRenderStrategy(org.apache.wicket.settings.Settings.RenderStrategy)
+	 */
+	public void setRenderStrategy(IRequestCycleSettings.RenderStrategy renderStrategy)
+	{
+		this.renderStrategy = renderStrategy;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#setResponseRequestEncoding(java.lang.String)
+	 */
+	public void setResponseRequestEncoding(final String responseRequestEncoding)
+	{
+		this.responseRequestEncoding = responseRequestEncoding;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#setTimeout(org.apache.wicket.util.time.Duration)
+	 */
+	public void setTimeout(Duration timeout)
+	{
+		if (timeout == null)
+		{
+			throw new IllegalArgumentException("timeout cannot be null");
+		}
+		this.timeout = timeout;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestCycleSettings#setUnexpectedExceptionDisplay(org.apache.wicket.settings.Settings.UnexpectedExceptionDisplay)
+	 */
+	public void setUnexpectedExceptionDisplay(
+		final IExceptionSettings.UnexpectedExceptionDisplay unexpectedExceptionDisplay)
+	{
+		this.unexpectedExceptionDisplay = unexpectedExceptionDisplay;
+	}
+}

Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultRequestLoggerSettings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultRequestLoggerSettings.java?rev=1037272&view=auto
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultRequestLoggerSettings.java (added)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultRequestLoggerSettings.java Sat Nov 20 17:12:11 2010
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.settings.def;
+
+import org.apache.wicket.settings.IRequestLoggerSettings;
+
+/**
+ * @author Jonathan Locke
+ * @author Chris Turner
+ * @author Eelco Hillenius
+ * @author Juergen Donnerstag
+ * @author Johan Compagner
+ * @author Igor Vaynberg (ivaynberg)
+ * @author Martijn Dashorst
+ * @author James Carman
+ */
+public class DefaultRequestLoggerSettings implements IRequestLoggerSettings
+{
+// ****************************************************************************
+// Fields
+// ****************************************************************************
+
+	private boolean recordSessionSize = true;
+
+	private int requestsWindowSize = 0;
+
+	private boolean requestLoggerEnabled;
+
+// ****************************************************************************
+// IRequestLoggerSettings Implementation
+// ****************************************************************************
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestLoggerSettings#getRecordSessionSize()
+	 */
+	public boolean getRecordSessionSize()
+	{
+		return recordSessionSize;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestLoggerSettings#getRequestsWindowSize()
+	 */
+	public int getRequestsWindowSize()
+	{
+		return requestsWindowSize;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestLoggerSettings#isRequestLoggerEnabled()
+	 */
+	public boolean isRequestLoggerEnabled()
+	{
+		return requestLoggerEnabled;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestLoggerSettings#setRecordSessionSize(boolean)
+	 */
+	public void setRecordSessionSize(boolean record)
+	{
+		recordSessionSize = record;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestLoggerSettings#setRequestLoggerEnabled(boolean)
+	 */
+	public void setRequestLoggerEnabled(boolean enable)
+	{
+		requestLoggerEnabled = enable;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IRequestLoggerSettings#setRequestsWindowSize(int)
+	 */
+	public void setRequestsWindowSize(int size)
+	{
+		requestsWindowSize = size;
+	}
+}

Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultResourceSettings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultResourceSettings.java?rev=1037272&view=auto
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultResourceSettings.java (added)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultResourceSettings.java Sat Nov 20 17:12:11 2010
@@ -0,0 +1,433 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.settings.def;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.IResourceFactory;
+import org.apache.wicket.Localizer;
+import org.apache.wicket.javascript.IJavascriptCompressor;
+import org.apache.wicket.markup.html.IPackageResourceGuard;
+import org.apache.wicket.markup.html.PackageResourceGuard;
+import org.apache.wicket.resource.PropertiesFactory;
+import org.apache.wicket.resource.loader.ClassStringResourceLoader;
+import org.apache.wicket.resource.loader.ComponentStringResourceLoader;
+import org.apache.wicket.resource.loader.IStringResourceLoader;
+import org.apache.wicket.resource.loader.PackageStringResourceLoader;
+import org.apache.wicket.resource.loader.ValidatorStringResourceLoader;
+import org.apache.wicket.settings.IResourceSettings;
+import org.apache.wicket.util.file.IResourceFinder;
+import org.apache.wicket.util.file.IResourcePath;
+import org.apache.wicket.util.file.Path;
+import org.apache.wicket.util.lang.Args;
+import org.apache.wicket.util.lang.Generics;
+import org.apache.wicket.util.resource.locator.IResourceStreamLocator;
+import org.apache.wicket.util.resource.locator.ResourceStreamLocator;
+import org.apache.wicket.util.time.Duration;
+import org.apache.wicket.util.watch.IModificationWatcher;
+import org.apache.wicket.util.watch.ModificationWatcher;
+
+/**
+ * @author Jonathan Locke
+ * @author Chris Turner
+ * @author Eelco Hillenius
+ * @author Juergen Donnerstag
+ * @author Johan Compagner
+ * @author Igor Vaynberg (ivaynberg)
+ * @author Martijn Dashorst
+ * @author James Carman
+ */
+public class DefaultResourceSettings implements IResourceSettings
+{
+// ****************************************************************************
+// Fields
+// ****************************************************************************
+
+	/**
+	 * Whether we should disable gzip compression for resources.
+	 */
+	private boolean disableGZipCompression = false;
+
+	/** I18N support */
+	private Localizer localizer;
+
+	/** Map to look up resource factories by name */
+	private final Map<String, IResourceFactory> nameToResourceFactory = Generics.newHashMap();
+
+	/** The package resource guard. */
+	private IPackageResourceGuard packageResourceGuard = new PackageResourceGuard();
+
+	/** The factory to be used for the property files */
+	private org.apache.wicket.resource.IPropertiesFactory propertiesFactory;
+
+	/** Filesystem Path to search for resources */
+	private IResourceFinder resourceFinder = new Path();
+
+	/** Frequency at which files should be polled */
+	private Duration resourcePollFrequency = null;
+
+	/** resource locator for this application */
+	private IResourceStreamLocator resourceStreamLocator;
+
+	/** ModificationWatcher to watch for changes in markup files */
+	private IModificationWatcher resourceWatcher;
+
+	/** Chain of string resource loaders to use */
+	private final List<IStringResourceLoader> stringResourceLoaders = Generics.newArrayList(4);
+
+	/** Flags used to determine how to behave if resources are not found */
+	private boolean throwExceptionOnMissingResource = true;
+
+	/** Determines behavior of string resource loading if string is missing */
+	private boolean useDefaultOnMissingResource = true;
+
+	/** Default cache duration */
+	private Duration defaultCacheDuration = Duration.hours(1);
+
+	/** The Javascript compressor */
+	private IJavascriptCompressor javascriptCompressor;
+
+	/** escape string for '..' within resource keys */
+	private String parentFolderPlaceholder = null;
+
+	// use timestamps on resource file names
+	private boolean useTimestampOnResourcesName = true;
+
+// ****************************************************************************
+// Constructors
+// ****************************************************************************
+
+	/**
+	 * Construct
+	 * 
+	 * @param application
+	 */
+	public DefaultResourceSettings(final Application application)
+	{
+		stringResourceLoaders.add(new ComponentStringResourceLoader());
+		stringResourceLoaders.add(new PackageStringResourceLoader());
+		stringResourceLoaders.add(new ClassStringResourceLoader(application.getClass()));
+		stringResourceLoaders.add(new ValidatorStringResourceLoader());
+	}
+
+// ****************************************************************************
+// IResourceSettings Implementation
+// ****************************************************************************
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#addResourceFactory(java.lang.String,
+	 *      org.apache.wicket.IResourceFactory)
+	 */
+	public void addResourceFactory(final String name, IResourceFactory resourceFactory)
+	{
+		nameToResourceFactory.put(name, resourceFactory);
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#addResourceFolder(java.lang.String)
+	 */
+	public void addResourceFolder(final String resourceFolder)
+	{
+		// Get resource finder
+		final IResourceFinder finder = getResourceFinder();
+
+		// Make sure it's a path
+		if (!(finder instanceof IResourcePath))
+		{
+			throw new IllegalArgumentException(
+				"To add a resource folder, the application's resource finder must be an instance of IResourcePath");
+		}
+
+		// Cast to resource path and add folder
+		final IResourcePath path = (IResourcePath)finder;
+		path.add(resourceFolder);
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getDisableGZipCompression()
+	 */
+	public boolean getDisableGZipCompression()
+	{
+		return disableGZipCompression;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getLocalizer()
+	 */
+	public Localizer getLocalizer()
+	{
+		if (localizer == null)
+		{
+			localizer = new Localizer();
+		}
+		return localizer;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getPackageResourceGuard()
+	 */
+	public IPackageResourceGuard getPackageResourceGuard()
+	{
+		return packageResourceGuard;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getPropertiesFactory()
+	 */
+	public org.apache.wicket.resource.IPropertiesFactory getPropertiesFactory()
+	{
+		if (propertiesFactory == null)
+		{
+			propertiesFactory = new PropertiesFactory(Application.get());
+		}
+		return propertiesFactory;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getResourceFactory(java.lang.String)
+	 */
+	public IResourceFactory getResourceFactory(final String name)
+	{
+		return nameToResourceFactory.get(name);
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getResourceFinder()
+	 */
+	public IResourceFinder getResourceFinder()
+	{
+		return resourceFinder;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getResourcePollFrequency()
+	 */
+	public Duration getResourcePollFrequency()
+	{
+		return resourcePollFrequency;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getResourceStreamLocator()
+	 */
+	public IResourceStreamLocator getResourceStreamLocator()
+	{
+		if (resourceStreamLocator == null)
+		{
+			// Create compound resource locator using source path from
+			// application settings
+			resourceStreamLocator = new ResourceStreamLocator(getResourceFinder());
+		}
+		return resourceStreamLocator;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getResourceWatcher(boolean)
+	 */
+	public IModificationWatcher getResourceWatcher(boolean start)
+	{
+		if (resourceWatcher == null && start)
+		{
+			final Duration pollFrequency = getResourcePollFrequency();
+			if (pollFrequency != null)
+			{
+				resourceWatcher = new ModificationWatcher(pollFrequency);
+			}
+		}
+		return resourceWatcher;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setResourceWatcher(org.apache.wicket.util.watch.IModificationWatcher)
+	 */
+	public void setResourceWatcher(IModificationWatcher watcher)
+	{
+		resourceWatcher = watcher;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getStringResourceLoaders()
+	 */
+	public List<IStringResourceLoader> getStringResourceLoaders()
+	{
+		return stringResourceLoaders;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getThrowExceptionOnMissingResource()
+	 */
+	public boolean getThrowExceptionOnMissingResource()
+	{
+		return throwExceptionOnMissingResource;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getUseDefaultOnMissingResource()
+	 */
+	public boolean getUseDefaultOnMissingResource()
+	{
+		return useDefaultOnMissingResource;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setDisableGZipCompression(boolean)
+	 */
+	public void setDisableGZipCompression(boolean disableGZipCompression)
+	{
+		this.disableGZipCompression = disableGZipCompression;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setLocalizer(org.apache.wicket.Localizer)
+	 */
+	public void setLocalizer(final Localizer localizer)
+	{
+		this.localizer = localizer;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setPackageResourceGuard(org.apache.wicket.markup.html.IPackageResourceGuard)
+	 */
+	public void setPackageResourceGuard(IPackageResourceGuard packageResourceGuard)
+	{
+		if (packageResourceGuard == null)
+		{
+			throw new IllegalArgumentException("Argument packageResourceGuard may not be null");
+		}
+		this.packageResourceGuard = packageResourceGuard;
+	}
+
+	/**
+	 * @see IResourceSettings#setPropertiesFactory(org.apache.wicket.resource.IPropertiesFactory)
+	 */
+	public void setPropertiesFactory(org.apache.wicket.resource.IPropertiesFactory factory)
+	{
+		propertiesFactory = factory;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setResourceFinder(org.apache.wicket.util.file.IResourceFinder)
+	 */
+	public void setResourceFinder(final IResourceFinder resourceFinder)
+	{
+		this.resourceFinder = resourceFinder;
+
+		// Cause resource locator to get recreated
+		resourceStreamLocator = null;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setResourcePollFrequency(org.apache.wicket.util.time.Duration)
+	 */
+	public void setResourcePollFrequency(final Duration resourcePollFrequency)
+	{
+		this.resourcePollFrequency = resourcePollFrequency;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setResourceStreamLocator(org.apache.wicket.util.resource.locator.IResourceStreamLocator)
+	 */
+	public void setResourceStreamLocator(IResourceStreamLocator resourceStreamLocator)
+	{
+		this.resourceStreamLocator = resourceStreamLocator;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setThrowExceptionOnMissingResource(boolean)
+	 */
+	public void setThrowExceptionOnMissingResource(final boolean throwExceptionOnMissingResource)
+	{
+		this.throwExceptionOnMissingResource = throwExceptionOnMissingResource;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setUseDefaultOnMissingResource(boolean)
+	 */
+	public void setUseDefaultOnMissingResource(final boolean useDefaultOnMissingResource)
+	{
+		this.useDefaultOnMissingResource = useDefaultOnMissingResource;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getDefaultCacheDuration()
+	 */
+	public final Duration getDefaultCacheDuration()
+	{
+		return defaultCacheDuration;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setDefaultCacheDuration(org.apache.wicket.util.time.Duration)
+	 */
+	public final void setDefaultCacheDuration(Duration duration)
+	{
+		Args.notNull(duration, "duration");
+		defaultCacheDuration = duration;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getJavascriptCompressor()
+	 */
+	public IJavascriptCompressor getJavascriptCompressor()
+	{
+		return javascriptCompressor;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setJavascriptCompressor(org.apache.wicket.javascript.IJavascriptCompressor)
+	 */
+	public IJavascriptCompressor setJavascriptCompressor(IJavascriptCompressor compressor)
+	{
+		IJavascriptCompressor old = javascriptCompressor;
+		javascriptCompressor = compressor;
+		return old;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#getParentFolderPlaceholder()
+	 */
+	public String getParentFolderPlaceholder()
+	{
+		return parentFolderPlaceholder;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setParentFolderPlaceholder(String)
+	 */
+	public void setParentFolderPlaceholder(final String sequence)
+	{
+		parentFolderPlaceholder = sequence;
+	}
+
+	/**
+	 * @see IResourceSettings#getUseTimestampOnResources()
+	 */
+	public boolean getUseTimestampOnResources()
+	{
+		return useTimestampOnResourcesName;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.IResourceSettings#setUseTimestampOnResources(boolean)
+	 */
+	public void setUseTimestampOnResources(boolean useTimestampOnResourcesName)
+	{
+		this.useTimestampOnResourcesName = useTimestampOnResourcesName;
+	}
+}

Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultSecuritySettings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultSecuritySettings.java?rev=1037272&view=auto
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultSecuritySettings.java (added)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultSecuritySettings.java Sat Nov 20 17:12:11 2010
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.settings.def;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.authentication.IAuthenticationStrategy;
+import org.apache.wicket.authentication.strategy.DefaultAuthenticationStrategy;
+import org.apache.wicket.authorization.IAuthorizationStrategy;
+import org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener;
+import org.apache.wicket.authorization.UnauthorizedInstantiationException;
+import org.apache.wicket.settings.ISecuritySettings;
+import org.apache.wicket.util.crypt.CachingSunJceCryptFactory;
+import org.apache.wicket.util.crypt.ICryptFactory;
+
+/**
+ * @author Jonathan Locke
+ * @author Chris Turner
+ * @author Eelco Hillenius
+ * @author Juergen Donnerstag
+ * @author Johan Compagner
+ * @author Igor Vaynberg (ivaynberg)
+ * @author Martijn Dashorst
+ * @author James Carman
+ */
+public class DefaultSecuritySettings implements ISecuritySettings
+{
+// ****************************************************************************
+// Fields
+// ****************************************************************************
+
+	/** The authorization strategy. */
+	private IAuthorizationStrategy authorizationStrategy = IAuthorizationStrategy.ALLOW_ALL;
+
+	/** The authentication strategy. */
+	private IAuthenticationStrategy authenticationStrategy;
+
+	/** factory for creating crypt objects */
+	private ICryptFactory cryptFactory;
+
+	/**
+	 * Whether mounts should be enforced. If true, requests for mounted targets have to done through
+	 * the mounted paths. If, for instance, a bookmarkable page is mounted to a path, a request to
+	 * that same page via the bookmarkablePage parameter will be denied.
+	 */
+	private boolean enforceMounts = false;
+
+	/** Authorizer for component instantiations */
+	private IUnauthorizedComponentInstantiationListener unauthorizedComponentInstantiationListener = new IUnauthorizedComponentInstantiationListener()
+	{
+		/**
+		 * Called when an unauthorized component instantiation is about to take place (but before it
+		 * happens).
+		 * 
+		 * @param component
+		 *            The partially constructed component (only the id is guaranteed to be valid).
+		 */
+		public void onUnauthorizedInstantiation(final Component component)
+		{
+			throw new UnauthorizedInstantiationException(component.getClass());
+		}
+	};
+
+// ****************************************************************************
+// ISecuritySettings Implementation
+// ****************************************************************************
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#getAuthorizationStrategy()
+	 */
+	public IAuthorizationStrategy getAuthorizationStrategy()
+	{
+		return authorizationStrategy;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#getCryptFactory()
+	 */
+	public synchronized ICryptFactory getCryptFactory()
+	{
+		if (cryptFactory == null)
+		{
+			cryptFactory = new CachingSunJceCryptFactory(ISecuritySettings.DEFAULT_ENCRYPTION_KEY);
+		}
+		return cryptFactory;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#getEnforceMounts()
+	 */
+	public boolean getEnforceMounts()
+	{
+		return enforceMounts;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#getUnauthorizedComponentInstantiationListener()
+	 */
+	public IUnauthorizedComponentInstantiationListener getUnauthorizedComponentInstantiationListener()
+	{
+		return unauthorizedComponentInstantiationListener;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#setAuthorizationStrategy(org.apache.wicket.authorization.IAuthorizationStrategy)
+	 */
+	public void setAuthorizationStrategy(IAuthorizationStrategy strategy)
+	{
+		if (strategy == null)
+		{
+			throw new IllegalArgumentException("authorization strategy cannot be set to null");
+		}
+		authorizationStrategy = strategy;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#setCryptFactory(org.apache.wicket.util.crypt.ICryptFactory)
+	 */
+	public void setCryptFactory(ICryptFactory cryptFactory)
+	{
+		if (cryptFactory == null)
+		{
+			throw new IllegalArgumentException("cryptFactory cannot be null");
+		}
+		this.cryptFactory = cryptFactory;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#setEnforceMounts(boolean)
+	 */
+	public void setEnforceMounts(boolean enforce)
+	{
+		enforceMounts = enforce;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#setUnauthorizedComponentInstantiationListener(org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener)
+	 */
+	public void setUnauthorizedComponentInstantiationListener(
+		IUnauthorizedComponentInstantiationListener unauthorizedComponentInstantiationListener)
+	{
+		this.unauthorizedComponentInstantiationListener = unauthorizedComponentInstantiationListener;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#getAuthenticationStrategy()
+	 */
+	public IAuthenticationStrategy getAuthenticationStrategy()
+	{
+		if (authenticationStrategy == null)
+		{
+			authenticationStrategy = new DefaultAuthenticationStrategy("LoggedIn");
+		}
+		return authenticationStrategy;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISecuritySettings#setAuthenticationStrategy(org.apache.wicket.authentication.IAuthenticationStrategy)
+	 */
+	public void setAuthenticationStrategy(final IAuthenticationStrategy strategy)
+	{
+		authenticationStrategy = strategy;
+	}
+}

Added: wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultSessionSettings.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultSessionSettings.java?rev=1037272&view=auto
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultSessionSettings.java (added)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/settings/def/DefaultSessionSettings.java Sat Nov 20 17:12:11 2010
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.settings.def;
+
+import org.apache.wicket.IPageFactory;
+import org.apache.wicket.session.DefaultPageFactory;
+import org.apache.wicket.settings.ISessionSettings;
+
+/**
+ * 
+ * @author Jonathan Locke
+ * @author Chris Turner
+ * @author Eelco Hillenius
+ * @author Juergen Donnerstag
+ * @author Johan Compagner
+ * @author Igor Vaynberg (ivaynberg)
+ * @author Martijn Dashorst
+ * @author James Carman
+ */
+public class DefaultSessionSettings implements ISessionSettings
+{
+// ****************************************************************************
+// Fields
+// ****************************************************************************
+
+	/** factory to create new Page objects */
+	private IPageFactory pageFactory = new DefaultPageFactory();
+
+// ****************************************************************************
+// ISessionSettings Implementation
+// ****************************************************************************
+
+	/**
+	 * @see org.apache.wicket.settings.ISessionSettings#getPageFactory()
+	 */
+	public IPageFactory getPageFactory()
+	{
+		return pageFactory;
+	}
+
+	/**
+	 * @see org.apache.wicket.settings.ISessionSettings#setPageFactory(org.apache.wicket.IPageFactory)
+	 */
+	public void setPageFactory(final IPageFactory defaultPageFactory)
+	{
+		pageFactory = defaultPageFactory;
+	}
+}

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/ApplicationSettingsTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/ApplicationSettingsTest.java?rev=1037272&r1=1037271&r2=1037272&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/ApplicationSettingsTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/ApplicationSettingsTest.java Sat Nov 20 17:12:11 2010
@@ -29,7 +29,10 @@ import org.apache.wicket.resource.loader
 import org.apache.wicket.resource.loader.IStringResourceLoader;
 import org.apache.wicket.resource.loader.PackageStringResourceLoader;
 import org.apache.wicket.resource.loader.ValidatorStringResourceLoader;
-import org.apache.wicket.settings.Settings;
+import org.apache.wicket.settings.IFrameworkSettings;
+import org.apache.wicket.settings.IResourceSettings;
+import org.apache.wicket.settings.def.DefaultFrameworkSettings;
+import org.apache.wicket.settings.def.DefaultResourceSettings;
 import org.junit.After;
 
 /**
@@ -54,7 +57,7 @@ public class ApplicationSettingsTest ext
 	 */
 	public void testFrameworkVersion()
 	{
-		Settings settings = new Settings(new MockApplication());
+		IFrameworkSettings settings = new DefaultFrameworkSettings();
 		assertEquals("n/a", settings.getVersion());
 	}
 
@@ -63,7 +66,7 @@ public class ApplicationSettingsTest ext
 	 */
 	public void testExceptionOnMissingResourceDefaultValue() throws Exception
 	{
-		Settings settings = new Settings(new MockApplication());
+		IResourceSettings settings = new DefaultResourceSettings(new MockApplication());
 		Assert.assertTrue("exceptionOnMissingResource should default to true",
 			settings.getThrowExceptionOnMissingResource());
 	}
@@ -73,7 +76,7 @@ public class ApplicationSettingsTest ext
 	 */
 	public void testExceptionOnMissingResourceSetsCorrectly() throws Exception
 	{
-		Settings settings = new Settings(new MockApplication());
+		IResourceSettings settings = new DefaultResourceSettings(new MockApplication());
 		settings.setThrowExceptionOnMissingResource(false);
 		Assert.assertFalse("exceptionOnMissingResource should have been set to false",
 			settings.getThrowExceptionOnMissingResource());
@@ -84,7 +87,7 @@ public class ApplicationSettingsTest ext
 	 */
 	public void testUseDefaultOnMissingResourceDefaultValue() throws Exception
 	{
-		Settings settings = new Settings(new MockApplication());
+		IResourceSettings settings = new DefaultResourceSettings(new MockApplication());
 		Assert.assertTrue("useDefaultOnMissingResource should default to true",
 			settings.getUseDefaultOnMissingResource());
 	}
@@ -94,7 +97,7 @@ public class ApplicationSettingsTest ext
 	 */
 	public void testUseDefaultOnMissingResourceSetsCorrectly() throws Exception
 	{
-		Settings settings = new Settings(new MockApplication());
+		IResourceSettings settings = new DefaultResourceSettings(new MockApplication());
 		settings.setUseDefaultOnMissingResource(false);
 		Assert.assertFalse("useDefaultOnMissingResource should have been set to false",
 			settings.getUseDefaultOnMissingResource());
@@ -105,7 +108,7 @@ public class ApplicationSettingsTest ext
 	 */
 	public void testDefaultStringResourceLoaderSetup()
 	{
-		Settings settings = new Settings(new MockApplication());
+		IResourceSettings settings = new DefaultResourceSettings(new MockApplication());
 		List<IStringResourceLoader> loaders = settings.getStringResourceLoaders();
 		Assert.assertEquals("There should be 4 default loaders", 4, loaders.size());
 		Assert.assertTrue("First loader one should be the component one",
@@ -123,11 +126,11 @@ public class ApplicationSettingsTest ext
 	 */
 	public void testOverrideStringResourceLoaderSetup()
 	{
-		Settings settings = new Settings(new MockApplication());
+		IResourceSettings settings = new DefaultResourceSettings(new MockApplication());
 		settings.getStringResourceLoaders().clear();
-		settings.addStringResourceLoader(new BundleStringResourceLoader(
-			"org.apache.wicket.resource.DummyResources"));
-		settings.addStringResourceLoader(new ComponentStringResourceLoader());
+		settings.getStringResourceLoaders().add(
+			new BundleStringResourceLoader("org.apache.wicket.resource.DummyResources"));
+		settings.getStringResourceLoaders().add(new ComponentStringResourceLoader());
 		List<IStringResourceLoader> loaders = settings.getStringResourceLoaders();
 		Assert.assertEquals("There should be 2 overridden loaders", 2, loaders.size());
 		Assert.assertTrue("First loader one should be the bundle one",

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/LocalizerTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/LocalizerTest.java?rev=1037272&r1=1037271&r2=1037272&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/LocalizerTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/LocalizerTest.java Sat Nov 20 17:12:11 2010
@@ -109,8 +109,8 @@ public class LocalizerTest extends TestC
 	public void testGetStringMissingStringReturnDefault()
 	{
 		settings.setUseDefaultOnMissingResource(true);
-		Assert.assertEquals("Default string should be returned", "DEFAULT", localizer.getString(
-			"unknown.string", null, null, "DEFAULT"));
+		Assert.assertEquals("Default string should be returned", "DEFAULT",
+			localizer.getString("unknown.string", null, null, "DEFAULT"));
 	}
 
 	/**
@@ -122,8 +122,8 @@ public class LocalizerTest extends TestC
 		settings.setThrowExceptionOnMissingResource(false);
 
 		Assert.assertEquals("Wrapped key should be returned on no default",
-			"[Warning: Property for 'unknown.string' not found]", localizer.getString(
-				"unknown.string", null, null, null));
+			"[Warning: Property for 'unknown.string' not found]",
+			localizer.getString("unknown.string", null, null, null));
 	}
 
 	/**
@@ -134,8 +134,8 @@ public class LocalizerTest extends TestC
 		settings.setUseDefaultOnMissingResource(false);
 		settings.setThrowExceptionOnMissingResource(false);
 		Assert.assertEquals("Wrapped key should be returned on not using default and no exception",
-			"[Warning: Property for 'unknown.string' not found]", localizer.getString(
-				"unknown.string", null, null, "DEFAULT"));
+			"[Warning: Property for 'unknown.string' not found]",
+			localizer.getString("unknown.string", null, null, "DEFAULT"));
 	}
 
 	/**
@@ -183,8 +183,10 @@ public class LocalizerTest extends TestC
 	{
 		Session.get().setLocale(Locale.ENGLISH);
 		MyMockPage page = new MyMockPage();
-		Application.get().getResourceSettings().addStringResourceLoader(
-			new ComponentStringResourceLoader());
+		Application.get()
+			.getResourceSettings()
+			.getStringResourceLoaders()
+			.add(new ComponentStringResourceLoader());
 
 		Localizer localizer = Application.get().getResourceSettings().getLocalizer();
 		assertEquals("value 1", localizer.getString("null", page.drop1));

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java?rev=1037272&r1=1037271&r2=1037272&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java Sat Nov 20 17:12:11 2010
@@ -56,8 +56,10 @@ public class StringResourceModelTest ext
 	protected void setUp() throws Exception
 	{
 		super.setUp();
-		tester.getApplication().getResourceSettings().addStringResourceLoader(
-			new BundleStringResourceLoader("org.apache.wicket.model.StringResourceModelTest"));
+		tester.getApplication()
+			.getResourceSettings()
+			.getStringResourceLoaders()
+			.add(new BundleStringResourceLoader("org.apache.wicket.model.StringResourceModelTest"));
 		page = new MockPage();
 		ws = new WeatherStation();
 		wsModel = new Model<WeatherStation>(ws);

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ClassStringResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ClassStringResourceLoaderTest.java?rev=1037272&r1=1037271&r2=1037272&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ClassStringResourceLoaderTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/loader/ClassStringResourceLoaderTest.java Sat Nov 20 17:12:11 2010
@@ -42,10 +42,10 @@ public class ClassStringResourceLoaderTe
 	public void testValidator1()
 	{
 		ClassStringResourceLoader loader = new ClassStringResourceLoader(MyValidator.class);
-		tester.getApplication().getResourceSettings().addStringResourceLoader(loader);
+		tester.getApplication().getResourceSettings().getStringResourceLoaders().add(loader);
 
-		assertEquals("${label} is invalid", loader.loadStringResource((Component)null, "error",
-			null, null, null));
+		assertEquals("${label} is invalid",
+			loader.loadStringResource((Component)null, "error", null, null, null));
 	}
 
 	/**