Skip to content

Commit

Permalink
add a hook in ERXApplication to modify URLs generated by ERXResourceM…
Browse files Browse the repository at this point in the history
…anager
  • Loading branch information
darkv committed Apr 11, 2012
1 parent cd8734f commit bc2e448
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,20 @@ public String _rewriteURL(String url) {
}
return processedURL;
}

/**
* This method is called by ERXResourceManager and provides the application a hook
* to rewrite generated URLs for resources.
*
* @param url
* the URL to rewrite
* @param bundle
* the bundle the resource is located in
* @return the rewritten URL
*/
public String _rewriteResourceURL(String url, WODeployedBundle bundle) {
return url;
}

/**
* Returns whether or not to rewrite direct connect URLs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,17 @@ public String urlForResourceNamed(String name, String bundleName, NSArray langua
}
}
completeURL = _versionManager.versionedUrlForResourceNamed(completeURL, name, bundleName, languages, request);
completeURL = _postprocessURL(completeURL, bundleName);
return completeURL;
}

protected String _postprocessURL(String url, String bundleName) {
if (WOApplication.application() instanceof ERXApplication) {
WODeployedBundle bundle = _cachedBundleForFrameworkNamed(bundleName);
return ERXApplication.erxApplication()._rewriteResourceURL(url, bundle);
}
return url;
}

private WOURLValuedElementData cachedDataForKey(String key) {
WOURLValuedElementData data = (WOURLValuedElementData) _urlValuedElementsData.objectForKey(key);
Expand Down

0 comments on commit bc2e448

Please sign in to comment.