Disclaimer: a 'tricky' attack surface indicates this may not be the best kind of problem to solve with Salesforce ;) so double check your real business requirements and push back on those if necessary!
First idea:
You might use the Site.UrlRewriter
interface to do this on a Force.com Site, for eg:
public class UrlRewriter implements Site.UrlRewriter {
public PageReference mapRequestUrl(PageReference incoming) {
return new PageReference('/resource/1394899484000/SiteSamples/SiteStyles.css');
}
public PageReference[] generateUrlFor(PageReference[] yourSalesforceUrls) {
return null;
}
}
However the return signature of the implementor must be a PageReference
resolving to a real page! I tried this for real and Salesforce serves a 404
, not the file inside a zipped static resource!
Second idea:
You could create a real Visualforce Page as a kind of proxy that serves up the contents of the zip file using Apex, and point your URL Rewriter at that page:
Example: https://stackexchange-developer-edition.na14.force.com/coach/foo/bar
UrlRewriter.cls
public class UrlRewriter implements Site.UrlRewriter {
public PageReference mapRequestUrl(PageReference incoming) {
return new PageReference('/apex/ResourceReader');
}
public PageReference[] generateUrlFor(PageReference[] yourSalesforceUrls) {
return null;
}
}
ResourceReader.page
<apex:page controller="ResourceReaderController" contentType="text/plain">
<apex:outputText value="{!Content}" escape="false" />
</apex:page>
ResourceReaderController.cls
public class ResourceReaderController {
public String getContent() {
return new PageReference('/resource/1394899484000/SiteSamples/SiteStyles.css').getContent().toString();
}
}
Third idea:
Maybe try using Site URL Redirects which can do a 301
or 302
redirect you. It won't be transparent to the visitors, but you can see an example of that here:
Example: https://stackexchange-developer-edition.na14.force.com/coach/herp/derp
However these guys exist as 0H0
prefix objects and must be administered through the user interface. I'm not sure you will ever be able to upload a zip file and automatically drill into it.