<commit_before>/*
 * $Id$
 * $Revision$ $Date$
 * 
 * ==============================================================================
 * 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;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import wicket.markup.ComponentTag;
import wicket.markup.html.form.persistence.CookieValuePersisterSettings;
import wicket.resource.ApplicationStringResourceLoader;
import wicket.resource.ComponentStringResourceLoader;
import wicket.resource.IStringResourceLoader;
import wicket.util.crypt.SunJceCrypt;
import wicket.util.file.Folder;
import wicket.util.file.Path;
import wicket.util.lang.EnumeratedType;
import wicket.util.parse.metapattern.MetaPattern;
import wicket.util.time.Duration;

/**
 * Contains application settings as property values. All settings exposed are
 * generic to any kind of protocol or markup.
 * <p>
 * Application settings properties:
 * <p>
 * <ul>
 * <i>bufferResponse </i> (defaults to true) - True if the application should
 * buffer responses. This does require some additional memory, but helps keep
 * exception displays accurate because the whole rendering process completes
 * before the page is sent to the user, thus avoiding the possibility of a
 * partially rendered page.
 * <p>
 * <ul>
 * <i>componentIdAttribute </i> (defaults to "wicket") - The markup attribute
 * which denotes the ids of components to be attached
 * <p>
 * <i>componentUseCheck </i> (defaults to true) - Causes the framework to do a
 * check after rendering each page to ensure that each component was used in
 * rendering the markup. If components are found that are not referenced in the
 * markup, an appropriate error will be displayed
 * <p>
 * <i>compressWhitespace </i> (defaults to false) - Causes pages to render with
 * redundant whitespace removed. Whitespace stripping is not HTML or JavaScript
 * savvy and can conceivably break pages, but should provide significant
 * performance improvements.
 * <p>
 * <i>unexpectedExceptionDisplay </i> (defaults to SHOW_EXCEPTION_PAGE) -
 * Determines how exceptions are displayed to the developer or user
 * <p>
 * <i>maxPages </i>- The maximum number of pages in the user's session
 * before old pages are expired.
 * <p>
 * <i>resourcePollFrequency </i> (defaults to no polling frequency) - Frequency
 * at which resources should be polled for changes.
 * <p>
 * <i>resourcePath </i> (no default) - Set this to enable polling of resources on
 * your source path
 * <p>
 * <i>stripComments </i> (defaults to false) - Set to true to strip HTML
 * comments during markup loading
 * <p>
 * <i>stripComponentIds </i> (defaults to false) - Set to true to strip
 * component id attributes during rendering
 * <p>
 * <i>throwExceptionOnMissingResource </i> (defaults to true) - Set to true to
 * throw a runtime exception if a required string resource is not found. Set to
 * false to return the requested resource key surrounded by pairs of question
 * mark characters (e.g. "??missingKey??")
 * <p>
 * <i>useDefaultOnMissingResource </i> (defaults to true) - Set to true to
 * return a default value if available when a required string resource is not
 * found. If set to false then the throwExceptionOnMissingResource flag is used
 * to determine how to behave. If no default is available then this is the same
 * as if this flag were false
 * <p>
 * <i>stringResourceLoaders </i>- A chain of <code>IStringResourceLoader</code>
 * instances that are searched in order to obtain string resources used during
 * localization. By default the chain is set up to first search for resources
 * against a particular component (e.g. page etc.) and then against the
 * application.
 * <p>
 * <i>defaultPageFactory </i>- the factory class that is used for constructing
 * page instances.
 * <p>
 * <p>
 * <i>renderStrategy</i>- Sets in what way the render part of a request is handled.
 * Basically, there are two different options:
 * <ul>
 *  <li>
 *   Direct, ApplicationSettings.ONE_PASS_RENDER. Everything is handled in one fysical
 *   request. This is efficient, and is the best option if you want to do sophisticated
 *   clustering. It does not however, shield you from what is commonly known as the
 *   <i>Double submit problem</i>
 *  </li>
 *  <li>
 *   Using a redirect. This follows the pattern <a href="http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost"
 *   	>as described at the serverside</a> and that is commonly known as Redirect after post.
 *   Wicket takes it one step further to do any rendering after a redirect, so that not only
 *   form submits are shielded from the double submit problem, but also the IRequestListener
 *   handlers (that could be e.g. a link that deletes a row).
 *   With this pattern, you have two options to choose from:
 *   <ul>
 *    <li>
 *     ApplicationSettings.REDIRECT_TO_RENDER. This option first handles the 'action' part
 *     of the request, which is either page construction (bookmarkable pages or the home page)
 *     or calling a IRequestListener handler, such as Link.onClick. When that part is done,
 *     a redirect is issued to the render part, which does all the rendering of the page
 *     and its components. <strong>Be aware</strong> that this may mean, depending on whether
 *     you access any models in the action part of the request, that attachement and detachement
 *     of some models is done twice for a request.
 *    </li>
 *    <li>
 *     ApplicationSettings.REDIRECT_TO_BUFFER. This option handles both the action- and the
 *     render part of the request in one physical request, but instead of streaming the
 *     result to the browser directly, it is kept in memory, and a redirect is issue to
 *     get this buffered result (after which it is immediately removed).
 *     This option currently is the default render strategy, as it shields you from the
 *     double submit problem, while being more efficient and less error prone regarding to
 *     detachable models.
 *    </li>
 *   </ul>
 *   Note that this parameter sets the default behaviour, but that you can manually set
 *   whether any redirecting is done by calling method RequestCycle.setRedirect. Setting
 *   the redirect flag when the application is configured to use ONE_PASS_RENDER, will result
 *   in a redirect of type REDIRECT_TO_RENDER. When the application is configured to use
 *   REDIRECT_TO_RENDER or REDIRECT_TO_BUFFER, setting the redirect flag to false, will
 *   result in that request begin rendered and streamed in one pass.
 *  </li>
 * </ul>
 * </p>
 * More documentation is available about each setting in the setter method for
 * the property.
 * 
 * @author <NAME><commit_msg>javadoc<commit_after>/*
 * $Id$
 * $Revision$ $Date$
 * 
 * ==============================================================================
 * 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;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import wicket.markup.ComponentTag;
import wicket.markup.html.form.persistence.CookieValuePersisterSettings;
import wicket.resource.ApplicationStringResourceLoader;
import wicket.resource.ComponentStringResourceLoader;
import wicket.resource.IStringResourceLoader;
import wicket.util.crypt.SunJceCrypt;
import wicket.util.file.Folder;
import wicket.util.file.Path;
import wicket.util.lang.EnumeratedType;
import wicket.util.parse.metapattern.MetaPattern;
import wicket.util.time.Duration;

/**
 * Contains application settings as property values. All settings exposed are
 * generic to any kind of protocol or markup.
 * <p>
 * Application settings properties:
 * <p>
 * <ul>
 * <i>bufferResponse </i> (defaults to true) - True if the application should
 * buffer responses. This does require some additional memory, but helps keep
 * exception displays accurate because the whole rendering process completes
 * before the page is sent to the user, thus avoiding the possibility of a
 * partially rendered page.
 * <p>
 * <ul>
 * <i>componentIdAttribute </i> (defaults to "wicket") - The markup attribute
 * which denotes the ids of components to be attached
 * <p>
 * <i>componentUseCheck </i> (defaults to true) - Causes the framework to do a
 * check after rendering each page to ensure that each component was used in
 * rendering the markup. If components are found that are not referenced in the
 * markup, an appropriate error will be displayed
 * <p>
 * <i>compressWhitespace </i> (defaults to false) - Causes pages to render with
 * redundant whitespace removed. Whitespace stripping is not HTML or JavaScript
 * savvy and can conceivably break pages, but should provide significant
 * performance improvements.
 * <p>
 * <i>unexpectedExceptionDisplay </i> (defaults to SHOW_EXCEPTION_PAGE) -
 * Determines how exceptions are displayed to the developer or user
 * <p>
 * <i>maxPages </i>- The maximum number of pages in the user's session
 * before old pages are expired.
 * <p>
 * <i>resourcePollFrequency </i> (defaults to no polling frequency) - Frequency
 * at which resources should be polled for changes.
 * <p>
 * <i>resourcePath </i> (no default) - Set this to enable polling of resources on
 * your source path
 * <p>
 * <i>stripComments </i> (defaults to false) - Set to true to strip HTML
 * comments during markup loading
 * <p>
 * <i>stripComponentIds </i> (defaults to false) - Set to true to strip
 * component id attributes during rendering
 * <p>
 * <i>throwExceptionOnMissingResource </i> (defaults to true) - Set to true to
 * throw a runtime exception if a required string resource is not found. Set to
 * false to return the requested resource key surrounded by pairs of question
 * mark characters (e.g. "??missingKey??")
 * <p>
 * <i>useDefaultOnMissingResource </i> (defaults to true) - Set to true to
 * return a default value if available when a required string resource is not
 * found. If set to false then the throwExceptionOnMissingResource flag is used
 * to determine how to behave. If no default is available then this is the same
 * as if this flag were false
 * <p>
 * <i>stringResourceLoaders </i>- A chain of <code>IStringResourceLoader</code>
 * instances that are searched in order to obtain string resources used during
 * localization. By default the chain is set up to first search for resources
 * against a particular component (e.g. page etc.) and then against the
 * application.
 * <p>
 * <i>defaultPageFactory </i>- the factory class that is used for constructing
 * page instances.
 * <p>
 * <p>
 * <i>renderStrategy</i>- Sets in what way the render part of a request is handled.
 * Basically, there are two different options:
 * <ul>
 *  <li>
 *   Direct, ApplicationSettings.ONE_PASS_RENDER. Everything is handled in one fysical
 *   request. This is efficient, and is the best option if you want to do sophisticated
 *   clustering. It does not however, shield you from what is commonly known as the
 *   <i>Double submit problem</i>
 *  </li>
 *  <li>
 *   Using a redirect. This follows the pattern <a href="http://www.theserverside.com/articles/article.tss?l=RedirectAfterPost"
 *   	>as described at the serverside</a> and that is commonly known as Redirect after post.
 *   Wicket takes it one step further to do any rendering after a redirect, so that not only
 *   form submits are shielded from the double submit problem, but also the IRequestListener
 *   handlers (that could be e.g. a link that deletes a row).
 *   With this pattern, you have two options to choose from:
 *   <ul>
 *    <li>
 *     ApplicationSettings.REDIRECT_TO_RENDER. This option first handles the 'action' part
 *     of the request, which is either page construction (bookmarkable pages or the home page)
 *     or calling a IRequestListener handler, such as Link.onClick. When that part is done,
 *     a redirect is issued to the render part, which does all the rendering of the page
 *     and its components. <strong>Be aware</strong> that this may mean, depending on whether
 *     you access any models in the action part of the request, that attachement and detachement
 *     of some models is done twice for a request.
 *    </li>
 *    <li>
 *     ApplicationSettings.REDIRECT_TO_BUFFER. This option handles both the action- and the
 *     render part of the request in one physical request, but instead of streaming the
 *     result to the browser directly, it is kept in memory, and a redirect is issue to
 *     get this buffered result (after which it is immediately removed).
 *     This option currently is the default render strategy, as it shields you from the
 *     double submit problem, while being more efficient and less error prone regarding to
 *     detachable models.
 *    </li>
 *   </ul>
 *  </li>
 * </ul>
 *   Note that this parameter sets the default behaviour, but that you can manually set
 *   whether any redirecting is done by calling method RequestCycle.setRedirect. Setting
 *   the redirect flag when the application is configured to use ONE_PASS_RENDER, will result
 *   in a redirect of type REDIRECT_TO_RENDER. When the application is configured to use
 *   REDIRECT_TO_RENDER or REDIRECT_TO_BUFFER, setting the redirect flag to false, will
 *   result in that request begin rendered and streamed in one pass.
 * </p>
 * More documentation is available about each setting in the setter method for
 * the property.
 * 
 * @author <NAME>
{'fraction_non_alphanumeric': 0.08578031538879825, 'fraction_numerical': 0.000543773790103317, 'mean_word_length': 3.9488731920618902, 'pattern_counts': {'":': 0, '<': 145, '<?xml version=': 0, '>': 145, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5388193', 'n_tokens_mistral': 3942, 'n_tokens_neox': 3854, 'n_words': 1875}