On 14 Apr 2016, at 16:52, Marius Dumitru Florea <[email protected]> wrote:
On Thu, Apr 14, 2016 at 5:43 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
I’m implementing http://jira.xwiki.org/browse/XWIKI-10375 ("Refactor the temporary resource concept inside the Resource module”) and I need to define a URL format for the new “tmp” resource type.
I’m proposing the following:
http://<server>/<context>/tmp/<module id>/<serialized owner document reference>/<module-dependent resource path>
Serialized document reference uses backslash to escape special characters which breaks the URL in Tomcat for security reasons.
Also note that using A/B/C instead of A.B.C has the issue of having a non-finite number of path segments and this would mean introducing a marker path segment which means that this marker could not be used as a page name or we’d need escaping, etc. That’s complex. I’d prefer to keep extensibility by allowing variable path segments for the module-dependent resource name in case a module has lots of files and wants to organize them into subdirectories. And it wouldn’t fully solve the tomcat issue anyway since we should be able to have \ or / in page/space names anyway. Thanks -Vincent
This is based on the existing TemporaryResourceReference at:
https://github.com/xwiki/xwiki-platform/blob/96caad053c14fc5546e9bc141bc284e...
For example:
http:// <server>/<context>/tmp/officeviewer/A.B.WebHome/Q29tcGFueSBQcmVzZW50YXRpb24ucHB0/Company+Presentation-slide0.jpg
Note that in this example from the officeviewer macro the module-dependent resource path consists in:
- base64(name of office attachment + hashcode(parameters))
See http://jira.xwiki.org/browse/XWIKI-11528 for the rationale behind it. I was trying to avoid backslash (from the serialized attachment reference) in the URL.
- generated image name from PPT
In this case, the implementation would generate the following file:
[TMPDIR]/officeviewer/A/B/WebHome/Q29tcGFueSBQcmVzZW50YXRpb24ucHB0/Company+Presentation-slide0.jpg
WDYT?
Thanks -Vincent