wicket.markup.parser.filter
Class PrependContextPathHandler

java.lang.Object
  extended by wicket.markup.parser.AbstractMarkupFilter
      extended by wicket.markup.parser.filter.PrependContextPathHandler
All Implemented Interfaces:
IMarkupFilter

public final class PrependContextPathHandler
extends AbstractMarkupFilter

This is a markup inline filter which by default is added to the list of markup filters. It can be added by means of subclassing Application.newMarkupParser() like

     public class MyApplication extends Application
     {
         ...
         public IMarkupFilter[] getAdditionalMarkupHandler()
         {
             return new IMarkupFilter[] { new new PrependContextPathHandler() };
         }
 
The purpose of the filter is to prepend the web apps context path to all href and src attributes found in the markup which contain a relative URL like "myDir/myPage.gif". It is applied to all non wicket component tags (attributes).

Author:
Juergen Donnerstag

Constructor Summary
PrependContextPathHandler(Application application)
          This constructor will get the context path from the application settings.
 
Method Summary
 MarkupElement nextTag()
          Get the next MarkupElement from the parent MarkupFilter and handle it if the specific filter criteria are met.
 
Methods inherited from class wicket.markup.parser.AbstractMarkupFilter
getParent, nextComponentTag, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrependContextPathHandler

public PrependContextPathHandler(Application application)
This constructor will get the context path from the application settings. When it is not set the context path will be automatically resolved. This should work in most cases, and support the following clustering scheme
    node1.mydomain.com[/appcontext]
    node2.mydomain.com[/appcontext]
    node3.mydomain.com[/appcontext]
 
If it is set then you can map to other context like in clusters
    node1.mydomain.com/mycontext1/
    node2.mydomain.com/mycontext2/
    node3.mydomain.com/mycontext3/
    mydomain.com/mycontext (load balancer)
 
or as a virtual server (app server and webserver)
    appserver.com/context mapped to webserver/ (context path should be '/')
 

Parameters:
application - The application object
Method Detail

nextTag

public MarkupElement nextTag()
                      throws java.text.ParseException
Get the next MarkupElement from the parent MarkupFilter and handle it if the specific filter criteria are met. Depending on the filter, it may return the MarkupElement unchanged, modified or it remove by asking the parent handler for the next tag.

Returns:
Return the next eligible MarkupElement
Throws:
java.text.ParseException
See Also:
IMarkupFilter.nextTag()


Copyright © 2004-2007 Wicket developers. All Rights Reserved.