Package org.apache.wiki.ui
Class AbstractCommand
java.lang.Object
org.apache.wiki.ui.AbstractCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
GroupCommand,PageCommand,RedirectCommand,WikiCommand
Abstract, immutable Command implementation class. All of the fields in this class are
final. This class is thread-safe.- Since:
- 2.4.22
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCommand(String requestContext, String urlPattern, String contentTemplate, Object target) Constructs a new Command with a specified wiki context, URL pattern, content template and target. -
Method Summary
Modifier and TypeMethodDescriptionfinal StringReturns the content template associated with a Command, such asPreferencesContent.jsp.final StringgetJSP()Returns the JSP associated with the Command.protected final StringReturns the "friendly name" for this command's JSP, namely a beatified version of the JSP's name without the .jsp suffix.abstract StringgetName()Returns the human-friendly name for this command.final StringReturns the name of the request context (e.g.final ObjectReturns the target associated with a Command, if it was created with one.final StringReturns the URL pattern associated with this Command.abstract CommandtargetedCommand(Object target) Creates and returns a targeted Command by combining a target, such as a WikiPage or GroupPrincipal into the existing Command.final StringtoString()Returns a String representation of the Command.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.wiki.api.core.Command
requiredPermission
-
Constructor Details
-
AbstractCommand
protected AbstractCommand(String requestContext, String urlPattern, String contentTemplate, Object target) Constructs a new Command with a specified wiki context, URL pattern, content template and target. The URL pattern is used to derive the JSP; if it is a "local" JSP (that is, it does not contain thehttp://orhttps://prefixes), then the JSP will be a cleansed version of the URL pattern; symbols (such as%u) will be removed. If the supplied URL pattern points to a non-local destination, the JSP will be set to the value supplied, unmodified.- Parameters:
requestContext- the request contexturlPattern- the URL patterncontentTemplate- the content template; may benulltarget- the target of the command, such as a WikiPage; may benull- Throws:
IllegalArgumentException- if the request content or URL pattern isnull
-
-
Method Details
-
targetedCommand
Description copied from interface:CommandCreates and returns a targeted Command by combining a target, such as a WikiPage or GroupPrincipal into the existing Command. Subclasses should check to make sure the suppliedtargetobject is of the correct type. This method is guaranteed to return a non-nullCommand (unless the target is an incorrect type).- Specified by:
targetedCommandin interfaceCommand- Parameters:
target- the object to combine, such as a GroupPrincipal or WikiPage- Returns:
- the new, targeted Command
- See Also:
-
getContentTemplate
Description copied from interface:CommandReturns the content template associated with a Command, such asPreferencesContent.jsp. For Commands that are not page-related, this method will always returnnull. Calling methods should always check to see if the result of this method isnull.- Specified by:
getContentTemplatein interfaceCommand- Returns:
- the content template
- See Also:
-
getJSP
Description copied from interface:CommandReturns the JSP associated with the Command. The JSP is a "local" JSP within the JSPWiki webapp; it is not a general HTTP URL. If it exists, the JSP will be expressed relative to the webapp root, without a leading slash. This method is guaranteed to return a non-nullresult, although in some cases the result may be an empty string. -
getName
Description copied from interface:CommandReturns the human-friendly name for this command. -
getRequestContext
Description copied from interface:CommandReturns the name of the request context (e.g. VIEW) associated with this Command. This method is guaranteed to return a non-nullString.- Specified by:
getRequestContextin interfaceCommand- Returns:
- the request context
- See Also:
-
getTarget
Description copied from interface:CommandReturns the target associated with a Command, if it was created with one. Commands created withCommand.targetedCommand(Object)will always return a non-nullobject. Calling methods should always check to see if the result of this method isnull. -
getURLPattern
Description copied from interface:CommandReturns the URL pattern associated with this Command. This method is guaranteed to return a non-nullString.- Specified by:
getURLPatternin interfaceCommand- Returns:
- the URL pattern
- See Also:
-
getJSPFriendlyName
Returns the "friendly name" for this command's JSP, namely a beatified version of the JSP's name without the .jsp suffix.- Returns:
- the friendly name
-
toString
Returns a String representation of the Command.
-