[ 
https://issues.apache.org/jira/browse/SLING-3829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14389109#comment-14389109
 ] 

Alexander Klimetschek commented on SLING-3829:
----------------------------------------------

You should use a [Trie|http://en.wikipedia.org/wiki/Trie] data structure for 
that, commons-collections 4.0 has one:
* interface 
[Trie|http://commons.apache.org/proper/commons-collections/javadocs/api-release/org/apache/commons/collections4/Trie.html]
 and implementation 
[PatriciaTrie|http://commons.apache.org/proper/commons-collections/javadocs/api-release/org/apache/commons/collections4/trie/PatriciaTrie.html]
* (I think these should be embedded and inlined in the sling bundle, usually 
only commons 3.x is available as bundle in Sling environments).
* example: https://code.google.com/p/patricia-trie/wiki/Examples
* see also 
http://stackoverflow.com/questions/5595780/space-efficient-collection-for-strings-with-common-prefixes-java-implementatio

The {{contentDispositionPaths.contains(pathInfo)}} check only happens rarely, 
since the root paths that would be configured ({{/content/usergenerated}}, 
{{/content/dam}}) would rarely be requested directly. The startsWith checks 
become costly the more configurations are present.

> Add support for Content-Disposition attachment 
> -----------------------------------------------
>
>                 Key: SLING-3829
>                 URL: https://issues.apache.org/jira/browse/SLING-3829
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Antonio Sanso
>            Assignee: Antonio Sanso
>            Priority: Minor
>         Attachments: ContentDispositionFilter.java, SLING-3829-patch.txt
>
>
> In some situation will be useful (and safer) to force Content-Disposition 
> attachment for some Content-Type (configurable ) under some specific (and 
> sensitive) path (configurable)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to