You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jijoe <ji...@yahoo.com> on 2005/02/01 01:45:45 UTC

Extending Form component?

I have a need to ensure that the ACTION attribute of a Form uses HTTPS. To me,
it seemed natural that I should be able to override the behavior of
writeAttribute() in Tapestry's built-in Form component. 

So I ended up creating a SecureForm component that does this. Everything was
going smoothly (was able to sub-class Form component class, albeit with some
weirdness around encoding type being private in Form!) until I started to write
SecureForm.jwc. 

As much as I searched and re-read TIA, I couldn't figure out how to use the
notion of "subclassing" for JWCs such that I only needed to specify the name of
my new sub-class and its additional attribute.

I was looking to be able to write something like

<component-specification name="....SecureForm" copy-of="Form">

<parameter name="securePort" type="int" direction="in" required="yes" />

</component-specification>

such that all the parameters and properties of Form are included in this JWC. 

The way I have it now, I had to copy in (=duplicate) all the parameter/property
definitions from Form.jwc before making my changes. 

Does anyone know of a more elegant way to define the JWC that doesn't require me
to copy/paste from an existing component?

Thanks in advance



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Extending Form component?

Posted by Paul Ferraro <pm...@columbia.edu>.
There no way around it.  You'll need to duplicate the parameters and 
properties from the Form component.

In Tapestry 3.1, Form components will be able to indicate a URLBuilder 
implementation responsible for building the url for the form's action.
Specifically, the AbsoluteURLBuilder implementation will allow you to 
specify a specific scheme (e.g. https), host, and port.
Each link component will also accept a urlBuilder parameter, so that its 
ILinkRenderer and URLBuilder may be specified independently.

Paul

Jijoe wrote:

>I have a need to ensure that the ACTION attribute of a Form uses HTTPS. To me,
>it seemed natural that I should be able to override the behavior of
>writeAttribute() in Tapestry's built-in Form component. 
>
>So I ended up creating a SecureForm component that does this. Everything was
>going smoothly (was able to sub-class Form component class, albeit with some
>weirdness around encoding type being private in Form!) until I started to write
>SecureForm.jwc. 
>
>As much as I searched and re-read TIA, I couldn't figure out how to use the
>notion of "subclassing" for JWCs such that I only needed to specify the name of
>my new sub-class and its additional attribute.
>
>I was looking to be able to write something like
>
><component-specification name="....SecureForm" copy-of="Form">
>
><parameter name="securePort" type="int" direction="in" required="yes" />
>
></component-specification>
>
>such that all the parameters and properties of Form are included in this JWC. 
>
>The way I have it now, I had to copy in (=duplicate) all the parameter/property
>definitions from Form.jwc before making my changes. 
>
>Does anyone know of a more elegant way to define the JWC that doesn't require me
>to copy/paste from an existing component?
>
>Thanks in advance
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org