You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Vadim Gritsenko <va...@verizon.net> on 2002/08/16 21:27:12 UTC

Re: host selector

Silke Schön wrote:

>Thanks a lot, Vadim!
>
>Now I changed my pipeline as you said, using a host selector this time:
>
>#
>#<map:match pattern="**research.pdf">
>#  <map:generate src="content/research/research.xml"/>
>#  <map:select  type="host">
>#     <map:when test=localhost">
>#         <map:transform src="transforms/page-fo.xsl"/>
>#     </map:when>
>#     <map:otherwise>
>#         <map:transform src="transforms/no-access.xsl"/>
>#     </map:otherwise>
>#  </map:select>
>#  <map:serialize type="fo2pdf"/>
>#</map:match>
>#
>
>I want my pdf only to be accessible from the localhost, from other computers a different pdf should be seen.
>But where can I now set that localhost is the "host:port" (port is 80 in my case) in my URI?
>I tried with a unlisted element just below the host selector in my component part:
>
>#
>#<map:selector name="host" src="org.apache.cocoon.selection.HostSelector">
>#  <host name="localhost" value="http://localhost**"/>
>#</map:selector>
>#
>  
>

 From Javadoc:

 * <p>Configuration:
 * <pre>
 * &lt;map:selector name="host" 
src="org.apache.cocoon.selection.HostSelector"&gt;
 *   &lt;host name="uk-site" value="www.foo.co.uk"/&gt;
 * &lt;/map:selector&gt;
 * </pre>
 * <p>Usage:
 * <pre>
 * &lt;map:select type="host"&gt;
 *   &lt;map:when test="uk-site"&gt;
 *     &lt;map:transform src="stylesheets/page/uk.xsl"/&gt;
 *   &lt;/map:when&gt;
 *   &lt;map:otherwise&gt;
 *     &lt;map:transform src="stylesheets/page/us.xsl"/&gt;
 *   &lt;/map:otherwise&gt;
 * &lt;/map:select&gt;
 * </pre>


Which means that this:

<map:selector name="host" src="org.apache.cocoon.selection.HostSelector">
  <host name="localhost" value="localhost"/>
</map:selector>

Should work.

Vadim


>which is obviously wrong. So which possibilities do I have? I could not find any samples for this case.
>I'd be very happy to get some help,
>thank you
>Silke
>  
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>