cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: ClientAddressChooser
Date Wed, 05 Jul 2000 06:29:25 GMT
On Wed, 5 Jul 2000, Niclas Hedhman wrote:

> My first try to put together a Chooser, and I selected to do one for
> ClientAddress validation.
> 
> There is one thing that comes into view though.
> IMO, this should not be aware of Http being the transport. But there is
> no parameter or method in Request that gives me this, so I have taken
> the liberty (awaiting something else) to define that "client-address"
> parameter is known by the Request object, and that it returns a String
> with the hostname followed by the ipnumber, separated by a slash. eg.
> envision.asiaconnect.com.my/202.190.60.242
> If the slash is not present, it assumes it to be an IP number is the
> first character is a digit, otherwise a host name.
> 
> Hostnames are matched to the domain/host names in the allow and deny
> sections, by check-and-remove-left sequence, and IP number is by
> check-and-remove-right. It means that if you give;
> <host>202.190.60</host>, all hosts from 202.190.60.1 to 202.190.60.254
> is matched true.
> 
> 
> In the Sitemap;
> 
> definition
>    <map:chooser type="clientaddress"
> src="class:///org.apache.cocoon.choosers.ClientAddressChooser">
>      <param name="order" value="allow,deny" />
>      <param name="all" value="false" />
>      <allow>
>        <host>com</host>
>        <host>se</host>
>        <host>com.my</host>
>      </allow>
>      <deny>
>        <host>asiaconnect.com.my</host>
>      </deny>
>    </map:chooser>
> 
> and usage
> <map:choose type="clientaddress" >
>   <map:when test="allow()" >
>     ...
>   </map:when>
> </map:choose>
> 
> 
> I hope I have attacked this in the proper way, and awaiting some
> comments.

it looks slick to me, from a quick glance. great to see some code floating
around again finally. :)

- donald


Mime
View raw message