Hi Philippe,

We had this problem too. I don't know if this is the best solution, but
I defined a LinkRenderer which removes the state info from the link. 

public class CleanLinkRenderer
    extends DefaultLinkRenderer
{
    static final Pattern STATE = Pattern.compile("[\\?&]state:.*=.*&?");

    @Override
    protected String constructURL(ILinkComponent component,
IRequestCycle cycle)
    {
        String link = super.constructURL(component, cycle);
        return removeState(link);
    }

    static String removeState(String link)
    {
        Matcher matcher = STATE.matcher(link);
        if (!matcher.find())
        {
            return link;
        }
        link = link.substring(0, matcher.start()) +
link.substring(matcher.end());
        link = StringUtils.chomp(link, "&");
        link = StringUtils.chomp(link, "?");
        return link;
    }
}

Just add renderer="ognl:getCleanRenderer()" to the link and the state is
gone.

Best wishes

John

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Philippe Joly
Sent: Friday, December 16, 2005 9:27 AM
To: [email protected]
Subject: Tapestry 4 b13 : ExternalLink and state properties

Hello,

I am using an ExternalLink to make a true HTTP redirection after a POST
.
It is possible to add parameters to the external link, and it works
fine.
But tapestry always add automatically a serialized page object as a
state
properties and that can explode the URL size limit (very little using
links :
GET form submit).

I just want to use 3 parameters, WITHOUT any state properties, how to
remove
them from the link ?

The link generated :
http://localhost:8080/MyApplication/app?page=MyPage&service=external
  &sp=PARAM1
  &sp=PARAM2
  &sp=PARAM3
  &state:APageClass=ZH4sIAAAAA...(very long)

The link I want :
http://localhost:8080/MyApplication/app?page=MyPage&service=external
  &sp=PARAM1
  &sp=PARAM2
  &sp=PARAM3


Second question :
I have maybe found a workaround (change the LinkFactory of the
ExternalService),
but I need to access to the ExternalService object, and I can't !
In page.java : public abstract IEngineService getExternalService();
In page.page : <inject property="externalService" type="object"
object="engine-service:external"/>

At runtime, getExternalService() NEVER returns an ExternalService
object, but a
EngineServiceOuterProxy !

Any idea ?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to