org.apache.lenya.cms.linking
Class OutgoingLinkRewriter

java.lang.Object
  extended by org.apache.lenya.cms.linking.ServletLinkRewriter
      extended by org.apache.lenya.cms.linking.OutgoingLinkRewriter
All Implemented Interfaces:
LinkRewriter

public class OutgoingLinkRewriter
extends ServletLinkRewriter

Converts web application links to links which will be sent to the browser by using the publication's proxy settings. If the current request is SSL-encrypted, all link URLs will use the SSL proxy.

Objects of this class are not thread-safe.


Field Summary
 
Fields inherited from class org.apache.lenya.cms.linking.ServletLinkRewriter
manager
 
Constructor Summary
OutgoingLinkRewriter(org.apache.avalon.framework.service.ServiceManager manager, org.apache.lenya.cms.repository.Session session, java.lang.String requestUrl, boolean ssl, boolean considerSslPolicies, boolean relativeUrls)
           
 
Method Summary
protected  java.lang.String generateUpDots(int length)
           
protected  GlobalProxies getGlobalProxies()
           
protected  java.lang.String getLastStep(java.lang.String url)
           
protected  org.apache.lenya.cms.publication.Publication getPublication(java.lang.String pubId)
           
protected  java.lang.String getRelativeUrlTo(java.lang.String webappUrl)
           
protected  boolean hasArea(org.apache.lenya.cms.publication.Publication pub, java.lang.String area)
          Checks if a publication has an area by using a cache for performance reasons.
 boolean matches(java.lang.String url)
           
protected  java.lang.String normalizeUrl(java.lang.String url)
           
 java.lang.String rewrite(java.lang.String url)
           
protected  java.lang.String rewriteLink(java.lang.String linkUrl, org.apache.lenya.cms.publication.Publication pub, boolean ssl)
           
protected  java.util.List toList(java.lang.String url)
           
 
Methods inherited from class org.apache.lenya.cms.linking.ServletLinkRewriter
getContextPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutgoingLinkRewriter

public OutgoingLinkRewriter(org.apache.avalon.framework.service.ServiceManager manager,
                            org.apache.lenya.cms.repository.Session session,
                            java.lang.String requestUrl,
                            boolean ssl,
                            boolean considerSslPolicies,
                            boolean relativeUrls)
Parameters:
manager - The service manager to use.
session - The current session.
requestUrl - The request URL where the links should be rewritten.
ssl - If the current page is SSL-encrypted.
considerSslPolicies - If the SSL protection of policies should be considered when resolving the corresponding proxy. Setting this to true leads to a substantial performance overhead.
relativeUrls - If relative URLs should be created.
Method Detail

getGlobalProxies

protected GlobalProxies getGlobalProxies()

matches

public boolean matches(java.lang.String url)
Parameters:
url - The URL.
Returns:
If this rewriter feels responsible for the URL.

getPublication

protected org.apache.lenya.cms.publication.Publication getPublication(java.lang.String pubId)
                                                               throws org.apache.lenya.cms.publication.PublicationException
Throws:
org.apache.lenya.cms.publication.PublicationException

rewrite

public java.lang.String rewrite(java.lang.String url)
Parameters:
url - The original URL.
Returns:
The rewritten URL.

normalizeUrl

protected java.lang.String normalizeUrl(java.lang.String url)
                                 throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

hasArea

protected boolean hasArea(org.apache.lenya.cms.publication.Publication pub,
                          java.lang.String area)
Checks if a publication has an area by using a cache for performance reasons.

Parameters:
pub - The publication.
area - The area name.
Returns:
if the publication contains the area.

rewriteLink

protected java.lang.String rewriteLink(java.lang.String linkUrl,
                                       org.apache.lenya.cms.publication.Publication pub,
                                       boolean ssl)
Parameters:
linkUrl - The original link URL.
pub - The publication to use for proxy resolving.
ssl - If the URL uses SSL.
Returns:
A link URL.

getRelativeUrlTo

protected java.lang.String getRelativeUrlTo(java.lang.String webappUrl)

getLastStep

protected java.lang.String getLastStep(java.lang.String url)

generateUpDots

protected java.lang.String generateUpDots(int length)

toList

protected java.util.List toList(java.lang.String url)


Copyright © $ Apache Software Foundation. All Rights Reserved.