001: package wicket.settings;
002:
003: import wicket.util.lang.EnumeratedType;
004:
005: /**
006: * Settings interface for configuring exception handling related settings.
007: * <p>
008: * <i>unexpectedExceptionDisplay </i> (defaults to SHOW_EXCEPTION_PAGE) -
009: * Determines how exceptions are displayed to the developer or user
010: * <p>
011: * <i>throwExceptionOnMissingResource </i> (defaults to true) - Set to true to
012: * throw a runtime exception if a required string resource is not found. Set to
013: * false to return the requested resource key surrounded by pairs of question
014: * mark characters (e.g. "??missingKey??")
015: *
016: * @author Igor Vaynberg (ivaynberg)
017: *
018: * @deprecated will be removed in 2.0. See methods for details
019: */
020: public interface IExceptionSettings {
021: /**
022: * Enumerated type for different ways of displaying unexpected exceptions.
023: *
024: * @deprecated will be moved to {@link IApplicationSettings} in 2.0
025: */
026: public static final class UnexpectedExceptionDisplay extends
027: EnumeratedType {
028: private static final long serialVersionUID = 1L;
029:
030: UnexpectedExceptionDisplay(final String name) {
031: super (name);
032: }
033: }
034:
035: /**
036: * Indicates that an exception page appropriate to development should be
037: * shown when an unexpected exception is thrown.
038: */
039: public static final UnexpectedExceptionDisplay SHOW_EXCEPTION_PAGE = new UnexpectedExceptionDisplay(
040: "SHOW_EXCEPTION_PAGE");
041: /**
042: * Indicates a generic internal error page should be shown when an
043: * unexpected exception is thrown.
044: */
045: public static final UnexpectedExceptionDisplay SHOW_INTERNAL_ERROR_PAGE = new UnexpectedExceptionDisplay(
046: "SHOW_INTERNAL_ERROR_PAGE");
047:
048: /**
049: * Indicates that no exception page should be shown when an unexpected
050: * exception is thrown.
051: */
052: public static final UnexpectedExceptionDisplay SHOW_NO_EXCEPTION_PAGE = new UnexpectedExceptionDisplay(
053: "SHOW_NO_EXCEPTION_PAGE");
054:
055: /**
056: * @return Whether to throw an exception when a missing resource is
057: * requested
058: * @deprecated use
059: * {@link IResourceSettings#getThrowExceptionOnMissingResource()}
060: * instead
061: */
062: boolean getThrowExceptionOnMissingResource();
063:
064: /**
065: * @return Returns the unexpectedExceptionDisplay.
066: * @deprecated will be moved to {@link IApplicationSettings} in 2.0
067: */
068: UnexpectedExceptionDisplay getUnexpectedExceptionDisplay();
069:
070: /**
071: * @param throwExceptionOnMissingResource
072: * Whether to throw an exception when a missing resource is
073: * requested
074: * @deprecated use
075: * {@link IResourceSettings#setThrowExceptionOnMissingResource(boolean)}
076: * instead
077: */
078: void setThrowExceptionOnMissingResource(
079: final boolean throwExceptionOnMissingResource);
080:
081: /**
082: * The exception display type determines how the framework displays
083: * exceptions to you as a developer or user.
084: * <p>
085: * The default value for exception display type is SHOW_EXCEPTION_PAGE. When
086: * this value is set and an unhandled runtime exception is thrown by a page,
087: * a redirect to a helpful exception display page will occur.
088: * <p>
089: * This is a developer feature, however, and you may want to instead show an
090: * internal error page without developer details that allows a user to start
091: * over at the application's home page. This can be accomplished by setting
092: * the exception display type to SHOW_INTERNAL_ERROR_PAGE.
093: * <p>
094: * Finally, if you are having trouble with the exception display pages
095: * themselves, you can disable exception displaying entirely with the value
096: * SHOW_NO_EXCEPTION_PAGE. This will cause the framework to re-throw any
097: * unhandled runtime exceptions after wrapping them in a ServletException
098: * wrapper.
099: *
100: * @param unexpectedExceptionDisplay
101: * The unexpectedExceptionDisplay to set.
102: *
103: * @deprecated will be moved to {@link IApplicationSettings} in 2.0
104: */
105: void setUnexpectedExceptionDisplay(
106: UnexpectedExceptionDisplay unexpectedExceptionDisplay);
107: }
|