Class AutoLinkResolver
- java.lang.Object
-
- org.apache.wicket.markup.resolver.AutoLinkResolver
-
- All Implemented Interfaces:
java.io.Serializable,IComponentResolver,org.apache.wicket.util.io.IClusterable
public final class AutoLinkResolver extends java.lang.Object implements IComponentResolver
The AutoLinkResolver is responsible to handle automatic link resolution. Tags are marked "autolink" by the MarkupParser for all tags with href attribute, such as anchor and link tags with no explicit wicket id. E.g. <a href="Home.html">If href points to a *.html file, a BookmarkablePageLink> will automatically be created, except for absolute paths, where an ExternalLink is created.
If href points to a *.html file, it resolves the given URL by searching for a page class, either relative or absolute, specified by the href attribute of the tag. If relative the href URL must be relative to the package containing the associated page. An exception is thrown if no Page class was found.
If href is no *.html file a static reference to the resource is created.
- Author:
- Juergen Donnerstag, Eelco Hillenius
- See Also:
WicketLinkTagHandler, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAutoLinkResolver.AbstractAutolinkResolverDelegateAbstract implementation that has a helper method for creating a resource reference.static classAutoLinkResolver.AutolinkBookmarkablePageLink<T>Autolink components delegate component resolution to their parent components.static interfaceAutoLinkResolver.IAutolinkResolverDelegateInterface to delegate the actual resolving of auto components to.static classAutoLinkResolver.PathInfoEncapsulates different aspects of a path.
-
Constructor Summary
Constructors Constructor Description AutoLinkResolver()Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTagReferenceResolver(java.lang.String tagName, java.lang.String attributeName, AutoLinkResolver.IAutolinkResolverDelegate resolver)Register (add or replace) a new resolver with the tagName and attributeName.AutoLinkResolver.IAutolinkResolverDelegategetAutolinkResolverDelegate(java.lang.String tagName)Get the resolver registered for 'tagName'Componentresolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)Try to resolve a component.
-
-
-
Method Detail
-
addTagReferenceResolver
public final void addTagReferenceResolver(java.lang.String tagName, java.lang.String attributeName, AutoLinkResolver.IAutolinkResolverDelegate resolver)Register (add or replace) a new resolver with the tagName and attributeName. The resolver will be invoked each time an appropriate tag and attribute is found.- Parameters:
tagName- The tag nameattributeName- The attribute nameresolver- Implements what to do based on the tag and the attribute
-
getAutolinkResolverDelegate
public final AutoLinkResolver.IAutolinkResolverDelegate getAutolinkResolverDelegate(java.lang.String tagName)
Get the resolver registered for 'tagName'- Parameters:
tagName- The tag's name- Returns:
- The resolver found. Null, if none registered
-
resolve
public final Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
Description copied from interface:IComponentResolverTry to resolve a component.- Specified by:
resolvein interfaceIComponentResolver- Parameters:
container- The container parsing its markupmarkupStream- The current markupStreamtag- The current component tag while parsing the markup- Returns:
- component or
nullif not found - See Also:
IComponentResolver.resolve(org.apache.wicket.MarkupContainer, org.apache.wicket.markup.MarkupStream, org.apache.wicket.markup.ComponentTag)
-
-