How can I represent URL (possibly including query string) as a filename in Java without obscuring the original URL?

Posted by jerluc on Stack Overflow See other posts from Stack Overflow or by jerluc
Published on 2011-01-11T18:52:23Z Indexed on 2011/01/12 2:54 UTC
Read the original article Hit count: 118

Filed under:

Is there any real way to represent a URL (which more than likely will also have a query string) as a filename in Java without obscuring the original URL completely?

My first approach was to simply escape invalid characters with arbitrary replacements (for example, replacing "/" with "_", etc). The problem is, as in the example of replacing with underscores is that a URL such as "app/my_app" would become "app_my_app" thus obscuring the original URL completely. I have also attempted to encode all the special characters, however again, seeing crazy %3e %20 etc is really not clear.

Thank you for any suggestions.

© Stack Overflow or respective owner

Related posts about java