org.duelengine.duel
Class CDNLinkInterceptor

java.lang.Object
  extended by org.duelengine.duel.CDNLinkInterceptor
All Implemented Interfaces:
LinkInterceptor

public class CDNLinkInterceptor
extends Object
implements LinkInterceptor


Field Summary
protected  String cdnHost
           
protected  boolean isDevMode
           
 
Constructor Summary
CDNLinkInterceptor(String cdnHost, Map<String,String> cdnMap, boolean isDevMode)
           
CDNLinkInterceptor(String cdnHost, ResourceBundle cdnBundle, boolean isDevMode)
           
 
Method Summary
protected static Map<String,String> bundleAsMap(ResourceBundle bundle, boolean isDevMode)
          Converts ResourceBundle to a Map
 String transformURL(String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isDevMode

protected final boolean isDevMode

cdnHost

protected final String cdnHost
Constructor Detail

CDNLinkInterceptor

public CDNLinkInterceptor(String cdnHost,
                          ResourceBundle cdnBundle,
                          boolean isDevMode)
                   throws URISyntaxException
Parameters:
cdnHost - the CDN server hostname (e.g., "cdn.example.com")
cdnMap - a mapping of paths to their compacted form (e.g., "/foo.js" => "/foo.min.js")
isDevMode - uses normal paths unless compacted form has a dev form (e.g., "/foo.js" => "/foo.min.js" => "/foo.test.js", else "/foo.js")
Throws:
URISyntaxException

CDNLinkInterceptor

public CDNLinkInterceptor(String cdnHost,
                          Map<String,String> cdnMap,
                          boolean isDevMode)
                   throws URISyntaxException
Parameters:
cdnHost - the CDN server hostname (e.g., "cdn.example.com")
cdnMap - a mapping of paths to their compacted form (e.g., "/foo.js" => "/foo.min.js")
isDevMode - uses normal paths unless compacted form has a dev form (e.g., "/foo.js" => "/foo.min.js" => "/foo.test.js", else "/foo.js")
Throws:
URISyntaxException
Method Detail

transformURL

public String transformURL(String url)
Specified by:
transformURL in interface LinkInterceptor

bundleAsMap

protected static Map<String,String> bundleAsMap(ResourceBundle bundle,
                                                boolean isDevMode)
Converts ResourceBundle to a Map

Parameters:
cdnBundle -
Returns:


Copyright © 2012. All Rights Reserved.