Custom URL Schema as an Adapter in Existing URL Schemas

Is there a clean and spec-compatible way to define a custom URL scheme that acts as an adapter on a resource returned by another URL?

I have already defined my own URL protocol, which returns a decrypted representation of the local file. So for example in my code

decrypted-file:///path/to/file

transparently decrypts the file you get from file:///path/to/file. However, this only works for local files. No fun! I hope that the specification of the URLs provides a clean way so that I can generalize this by specifying the new URL scheme as a kind of adapter on existing URLs.

For example, can I define a custom URL scheme decrypted:that can be used as an adapter, which is the prefix of another absolute URL that the resource received? Then I could just do

decrypted:file:///path/to/file

or decrypted:http://server/path/to/fileor decrypted:ftp://server/path/to/fileor something else. This would make my protocol decrypted:composite for all existing URL schemes that search for files.

Java - URL jar:, RFC 3986 , Java URL, URL- , /, ? # URL- URL- ( , JarURLConnection). .

? URL (.. decrypted:file%3A%2F%2F%2Fpath%2Fto%2Ffile, )?

( URL) , ? , ?

+1
1

Cocoa , NSURLProtocol . URL-, :

myscheme:<originalurl>

:

myscheme:http://example.com/path

NSURL , , , URI, . , URL, , RFC 1808 .., .

, URI, , , ( , ASCII ).

-resourceSpecifier URL- .

0

Source: https://habr.com/ru/post/1665125/


All Articles