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

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

The Trie concept can still be used for this - that example was just a different 
use case. You can check if a leaf node was hit so that the path in the Trie was 
a prefix to the string you search for – and if you don't hit a leaf node, you 
know it's not a match.

http://www.geeksforgeeks.org/longest-prefix-matching-a-trie-based-solution-in-java/
https://gist.github.com/shawnchin/1607595
https://github.com/eclipse/jetty.project/blob/master/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java

Sling might have something like this already for the /etc/map stuff or servlet 
resolution... [~fmeschbe] Do you know?

Because this is a filter and we have optimizations like SLING-4544 going on, we 
should be careful with the performance. I would argue that the 
{{contentDispositionPaths.contains(pathInfo)}} check hurts performance for 
99.9% of the requests where it will never match.

> 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
>             Fix For: Security 1.0.10
>
>         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