info.magnolia.cms.beans.config
Class HostBasedVirtualURIMapping

java.lang.Object
  extended by info.magnolia.cms.beans.config.HostBasedVirtualURIMapping
All Implemented Interfaces:
VirtualURIMapping

public class HostBasedVirtualURIMapping
extends java.lang.Object
implements VirtualURIMapping

Simple VirtualURI mapping that can forward to a different url depending on the request host name. The "host" property must be a list of uri=destination strings. See below for a sample configuration:

 [] virtualURIMapping
    [] default
     - class            info.magnolia.cms.beans.config.HostBasedVirtualURIMapping
     - fromURI          /
     - toURI            redirect:/.magnolia/pages/adminCentral.html
       [] hosts
        - 1             www.acme.com=forward:/acme/en/index.html
        - 2             www.acme.de=forward:/acme/de/index.html
 

Version:
$Id: HostBasedVirtualURIMapping.java 41137 2011-01-06 18:19:25Z gjoseph $
Author:
fgiust

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.magnolia.cms.beans.config.VirtualURIMapping
VirtualURIMapping.MappingResult
 
Constructor Summary
HostBasedVirtualURIMapping()
           
 
Method Summary
 void addHost(java.lang.String mapping)
          Adds a host mapping (used by content2bean).
 java.lang.String getFromURI()
           
 java.util.List<java.lang.String> getHosts()
           
 java.lang.String getToURI()
           
 VirtualURIMapping.MappingResult mapURI(java.lang.String uri)
          Maps an incoming URI to a new target URI.
 void setFromURI(java.lang.String fromURI)
           
 void setToURI(java.lang.String toURI)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HostBasedVirtualURIMapping

public HostBasedVirtualURIMapping()
Method Detail

getHosts

public java.util.List<java.lang.String> getHosts()

addHost

public void addHost(java.lang.String mapping)
Adds a host mapping (used by content2bean).

Parameters:
mapping - in the form host=path

mapURI

public VirtualURIMapping.MappingResult mapURI(java.lang.String uri)
Description copied from interface: VirtualURIMapping
Maps an incoming URI to a new target URI. Returns a VirtualURIMapping.MappingResult describing the new URI and the level of match. The new URI can be prefixed with "redirect:", "permanent:" or "forward:" to trigger either a temporary redirect, a permanent redirect or a forward respectively. For redirects the URI can be absolute or relative within the web application (the context path is added automatically). If the mapping does not apply to the input URI this method returns null.

Specified by:
mapURI in interface VirtualURIMapping
Parameters:
uri - the URI of the current request, decoded and without the context path
Returns:
a VirtualURIMapping.MappingResult with the target URI and level or null if the mapping doesn't apply

getFromURI

public java.lang.String getFromURI()

setFromURI

public void setFromURI(java.lang.String fromURI)

getToURI

public java.lang.String getToURI()

setToURI

public void setToURI(java.lang.String toURI)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.