@Test public void testLocalize() { StaticDispatcherUrlService sdus = new StaticDispatcherUrlService(); sdus.setDispatcherUrl(TEST); sdus.setLocalDispatcherUrl(LOCAL); Assert.assertEquals(LOCAL, sdus.getLocalDispatcherUrl()); Assert.assertEquals(LOCAL1, sdus.localize(EXT1)); Assert.assertEquals(BAD, sdus.localize(BAD)); }
public String localize(String externalUrl) { String localBase = getLocalDispatcherUrl(); if (localBase == null) { return externalUrl; } else { String dispatcherBase = getDispatcherUrl(); if (externalUrl.startsWith(dispatcherBase)) { return localBase + externalUrl.substring(dispatcherBase.length()); } else { return externalUrl; } } }
StaticDispatcherUrlService implements DispatcherUrlService { public String localize(String externalUrl) { String localBase = getLocalDispatcherUrl(); if (localBase == null) { return externalUrl; } else { String dispatcherBase = getDispatcherUrl(); if (externalUrl.startsWith(dispatcherBase)) { return localBase + externalUrl.substring(dispatcherBase.length()); } else { return externalUrl; } } } }
StaticDispatcherUrlService implements DispatcherUrlService { public String localize(String externalUrl) { String localBase = getLocalDispatcherUrl(); if (localBase == null) { return externalUrl; } else { String dispatcherBase = getDispatcherUrl(); if (externalUrl.startsWith(dispatcherBase)) { return localBase + externalUrl.substring(dispatcherBase.length()); } else { return externalUrl; } } }  }
StaticDispatcherUrlService implements DispatcherUrlService { public String localize(String externalUrl) { String localBase = getLocalDispatcherUrl(); if (localBase == null) { return externalUrl; } else { String dispatcherBase = getDispatcherUrl(); if (externalUrl.startsWith(dispatcherBase)) { return localBase + externalUrl.substring(dispatcherBase.length()); } else { return externalUrl; } } }  void setDispatcherUrl(String dispatcherUrl); @Override String getDispatcherUrl(); void setLocalDispatcherUrl(String localDispatcherUrl); String getLocalDispatcherUrl(); String localize(String externalUrl); }
StaticDispatcherUrlService implements DispatcherUrlService { public String localize(String externalUrl) { String localBase = getLocalDispatcherUrl(); if (localBase == null) { return externalUrl; } else { String dispatcherBase = getDispatcherUrl(); if (externalUrl.startsWith(dispatcherBase)) { return localBase + externalUrl.substring(dispatcherBase.length()); } else { return externalUrl; } } }  void setDispatcherUrl(String dispatcherUrl); @Override String getDispatcherUrl(); void setLocalDispatcherUrl(String localDispatcherUrl); String getLocalDispatcherUrl(); String localize(String externalUrl);  }