Search in sources :

Example 1 with RelativePathPrefixHandler

use of org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler in project wicket by apache.

the class MarkupParser method initializeMarkupFilters.

/**
 * Initialize Wicket's MarkupParser with all necessary markup filters. You may subclass this
 * method, to add your own filters to the list.
 *
 * @param markup
 * @return The list of markup filter
 */
@Override
protected MarkupFilterList initializeMarkupFilters(final Markup markup) {
    // MarkupFilterList is a simple extension of ArrayList providing few additional helpers
    final MarkupFilterList filters = new MarkupFilterList();
    MarkupResourceStream markupResourceStream = markup.getMarkupResourceStream();
    filters.add(new WicketTagIdentifier(markupResourceStream));
    filters.add(new HtmlHandler());
    filters.add(new WicketRemoveTagHandler(markupResourceStream));
    filters.add(new WicketLinkTagHandler(markupResourceStream));
    filters.add(new AutoLabelTagHandler(markupResourceStream));
    filters.add(new WicketNamespaceHandler(markupResourceStream));
    filters.add(new WicketMessageTagHandler(markupResourceStream));
    // Provided the wicket component requesting the markup is known ...
    if ((markupResourceStream != null) && (markupResourceStream.getResource() != null)) {
        final ContainerInfo containerInfo = markupResourceStream.getContainerInfo();
        if (containerInfo != null) {
            // Pages require additional handlers
            if (Page.class.isAssignableFrom(containerInfo.getContainerClass())) {
                filters.add(new HtmlHeaderSectionHandler(markup));
            }
            filters.add(new HeadForceTagIdHandler(containerInfo.getContainerClass()));
        }
    }
    filters.add(new OpenCloseTagExpander());
    filters.add(new RelativePathPrefixHandler(markupResourceStream));
    filters.add(new EnclosureHandler(markupResourceStream));
    filters.add(new InlineEnclosureHandler(markupResourceStream));
    // Append it. See WICKET-4390
    filters.add(new StyleAndScriptIdentifier(), StyleAndScriptIdentifier.class);
    filters.add(new WicketContainerTagHandler(markupResourceStream, Application.get().usesDevelopmentConfig()));
    return filters;
}
Also used : HtmlHandler(org.apache.wicket.markup.parser.filter.HtmlHandler) WicketNamespaceHandler(org.apache.wicket.markup.parser.filter.WicketNamespaceHandler) StyleAndScriptIdentifier(org.apache.wicket.markup.parser.filter.StyleAndScriptIdentifier) HeadForceTagIdHandler(org.apache.wicket.markup.parser.filter.HeadForceTagIdHandler) RelativePathPrefixHandler(org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler) AutoLabelTagHandler(org.apache.wicket.markup.html.form.AutoLabelTagHandler) WicketMessageTagHandler(org.apache.wicket.markup.parser.filter.WicketMessageTagHandler) WicketRemoveTagHandler(org.apache.wicket.markup.parser.filter.WicketRemoveTagHandler) InlineEnclosureHandler(org.apache.wicket.markup.parser.filter.InlineEnclosureHandler) InlineEnclosureHandler(org.apache.wicket.markup.parser.filter.InlineEnclosureHandler) EnclosureHandler(org.apache.wicket.markup.parser.filter.EnclosureHandler) WicketTagIdentifier(org.apache.wicket.markup.parser.filter.WicketTagIdentifier) WicketLinkTagHandler(org.apache.wicket.markup.parser.filter.WicketLinkTagHandler) OpenCloseTagExpander(org.apache.wicket.markup.parser.filter.OpenCloseTagExpander) HtmlHeaderSectionHandler(org.apache.wicket.markup.parser.filter.HtmlHeaderSectionHandler) WicketContainerTagHandler(org.apache.wicket.markup.parser.filter.WicketContainerTagHandler)

Example 2 with RelativePathPrefixHandler

use of org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler in project wicket by apache.

the class Application method internalInit.

/**
 * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT OVERRIDE OR CALL.
 *
 * Internal initialization.
 */
protected void internalInit() {
    settingsAccessible = true;
    PageSettings pageSettings = getPageSettings();
    // Install default component resolvers
    pageSettings.addComponentResolver(new HtmlHeaderResolver());
    pageSettings.addComponentResolver(new WicketLinkTagHandler());
    pageSettings.addComponentResolver(new WicketMessageResolver());
    pageSettings.addComponentResolver(new RelativePathPrefixHandler());
    pageSettings.addComponentResolver(new EnclosureHandler());
    pageSettings.addComponentResolver(new InlineEnclosureHandler());
    pageSettings.addComponentResolver(new WicketMessageTagHandler());
    pageSettings.addComponentResolver(new WicketContainerResolver());
    getResourceSettings().getResourceFinders().add(new ClassPathResourceFinder(""));
    // Install button image resource factory
    getResourceSettings().addResourceFactory("buttonFactory", new DefaultButtonImageResourceFactory());
    String applicationKey = getApplicationKey();
    applicationKeyToApplication.put(applicationKey, this);
    converterLocator = newConverterLocator();
    setPageManagerProvider(new DefaultPageManagerProvider(this));
    resourceReferenceRegistry = newResourceReferenceRegistry();
    sharedResources = newSharedResources(resourceReferenceRegistry);
    resourceBundles = newResourceBundles(resourceReferenceRegistry);
    // set up default request mapper
    setRootRequestMapper(new SystemMapper(this));
    pageFactory = newPageFactory();
    requestCycleProvider = (context) -> new RequestCycle(context);
    exceptionMapperProvider = () -> new DefaultExceptionMapper();
    // add a request cycle listener that logs each request for the requestlogger.
    getRequestCycleListeners().add(new RequestLoggerRequestCycleListener());
}
Also used : RelativePathPrefixHandler(org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler) PageSettings(org.apache.wicket.settings.PageSettings) RequestCycle(org.apache.wicket.request.cycle.RequestCycle) HtmlHeaderResolver(org.apache.wicket.markup.resolver.HtmlHeaderResolver) WicketMessageTagHandler(org.apache.wicket.markup.parser.filter.WicketMessageTagHandler) ClassPathResourceFinder(org.apache.wicket.core.util.resource.ClassPathResourceFinder) DefaultButtonImageResourceFactory(org.apache.wicket.markup.html.image.resource.DefaultButtonImageResourceFactory) WicketMessageResolver(org.apache.wicket.markup.resolver.WicketMessageResolver) InlineEnclosureHandler(org.apache.wicket.markup.parser.filter.InlineEnclosureHandler) InlineEnclosureHandler(org.apache.wicket.markup.parser.filter.InlineEnclosureHandler) EnclosureHandler(org.apache.wicket.markup.parser.filter.EnclosureHandler) RequestLoggerRequestCycleListener(org.apache.wicket.protocol.http.RequestLoggerRequestCycleListener) WicketContainerResolver(org.apache.wicket.markup.resolver.WicketContainerResolver) WicketLinkTagHandler(org.apache.wicket.markup.parser.filter.WicketLinkTagHandler)

Aggregations

EnclosureHandler (org.apache.wicket.markup.parser.filter.EnclosureHandler)2 InlineEnclosureHandler (org.apache.wicket.markup.parser.filter.InlineEnclosureHandler)2 RelativePathPrefixHandler (org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler)2 WicketLinkTagHandler (org.apache.wicket.markup.parser.filter.WicketLinkTagHandler)2 WicketMessageTagHandler (org.apache.wicket.markup.parser.filter.WicketMessageTagHandler)2 ClassPathResourceFinder (org.apache.wicket.core.util.resource.ClassPathResourceFinder)1 AutoLabelTagHandler (org.apache.wicket.markup.html.form.AutoLabelTagHandler)1 DefaultButtonImageResourceFactory (org.apache.wicket.markup.html.image.resource.DefaultButtonImageResourceFactory)1 HeadForceTagIdHandler (org.apache.wicket.markup.parser.filter.HeadForceTagIdHandler)1 HtmlHandler (org.apache.wicket.markup.parser.filter.HtmlHandler)1 HtmlHeaderSectionHandler (org.apache.wicket.markup.parser.filter.HtmlHeaderSectionHandler)1 OpenCloseTagExpander (org.apache.wicket.markup.parser.filter.OpenCloseTagExpander)1 StyleAndScriptIdentifier (org.apache.wicket.markup.parser.filter.StyleAndScriptIdentifier)1 WicketContainerTagHandler (org.apache.wicket.markup.parser.filter.WicketContainerTagHandler)1 WicketNamespaceHandler (org.apache.wicket.markup.parser.filter.WicketNamespaceHandler)1 WicketRemoveTagHandler (org.apache.wicket.markup.parser.filter.WicketRemoveTagHandler)1 WicketTagIdentifier (org.apache.wicket.markup.parser.filter.WicketTagIdentifier)1 HtmlHeaderResolver (org.apache.wicket.markup.resolver.HtmlHeaderResolver)1 WicketContainerResolver (org.apache.wicket.markup.resolver.WicketContainerResolver)1 WicketMessageResolver (org.apache.wicket.markup.resolver.WicketMessageResolver)1