org.apache.tapestry.contrib.link
Class FormLinkRenderer

java.lang.Object
  extended by org.apache.tapestry.link.DefaultLinkRenderer
      extended by org.apache.tapestry.contrib.link.FormLinkRenderer
All Implemented Interfaces:
org.apache.tapestry.link.ILinkRenderer

public class FormLinkRenderer
extends org.apache.tapestry.link.DefaultLinkRenderer

A link renderer that ensures that the generated link uses POST instead of GET request and is therefore no longer limited in size.

Theoretically, browsers should support very long URLs, but in practice they often start behaving strangely if the URLs are more than 256 characters. This renderer uses JavaScript to generate forms containing the requested link parameters and then "post" them when the link is selected. As a result, the data is sent to the server using a POST request with a very short URL and there is no longer a limitation in the size of the parameters.

In short, simply add the following parameter to your DirectLink, ExternalLink, or other such link components:

 renderer="ognl: @org.apache.tapestry.contrib.link.FormLinkRenderer@RENDERER"
 
and they will automatically start using POST rather than GET requests. Their parameters will no longer be limited in size.

Since:
4.0
Author:
mb

Field Summary
static org.apache.tapestry.link.ILinkRenderer RENDERER
          A public singleton instance of the FormLinkRenderer.
 
Fields inherited from class org.apache.tapestry.link.DefaultLinkRenderer
SHARED_INSTANCE
 
Constructor Summary
FormLinkRenderer()
           
 
Method Summary
 void renderLink(org.apache.tapestry.IMarkupWriter writer, org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.components.ILinkComponent linkComponent)
           
 
Methods inherited from class org.apache.tapestry.link.DefaultLinkRenderer
afterBodyRender, beforeBodyRender, constructURL, getElement, getHasBody, getTargetAttribute, getUrlAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RENDERER

public static final org.apache.tapestry.link.ILinkRenderer RENDERER
A public singleton instance of the FormLinkRenderer.

Since the FormLinkRenderer is stateless, this instance can serve all links within your application without interference.

Constructor Detail

FormLinkRenderer

public FormLinkRenderer()
Method Detail

renderLink

public void renderLink(org.apache.tapestry.IMarkupWriter writer,
                       org.apache.tapestry.IRequestCycle cycle,
                       org.apache.tapestry.components.ILinkComponent linkComponent)
Specified by:
renderLink in interface org.apache.tapestry.link.ILinkRenderer
Overrides:
renderLink in class org.apache.tapestry.link.DefaultLinkRenderer