Uploaded image for project: 'JBoss Modules'
  1. JBoss Modules
  2. MODULES-340

Add support for "data" URLs

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 1.8.0.Final
    • None
    • None
    • None

      The new JAXP redirection (MODULES-338) requires resources which are string-backed. Instead of using a proprietary string URL scheme, it would be better to just provide proper support for data URLs via a URLStreamHandlerFactory.

      Requirements:

      • Conform to RFC 2397, which means:
        • Support for base 64 content using MIME decoding (with whitespaces stripped out)
        • Support for non-base 64 content using URL decoding with the proper charset
        • Support for charset specification (default to US-ASCII) by way of the charset parameter; invalid charsets should result in UnsupportedEncodingException
      • Return the URL content type from URLConnection#getContentType() which should include all parameters given as part of the URL except for base64, with the special exception that text/ media types should have the charset as the first parameter, and charset should be excluded from other types; the default media type is text/plain
      • Other well-formedness errors should result in ProtocolException

      URL Syntax:

      Unable to find source-code formatter for language: unknown. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
          dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
          mediatype  := [ type "/" subtype ] *( ";" parameter )
          data       := *urlchar
          parameter  := attribute "=" value
      

      The obsolete urlchar production is closest to uric from RFC 3986:

      Unable to find source-code formatter for language: unknown. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
          uric  := unreserved / pct-encoded / ";" / "?" / ":" / "@" / "&" / "=" / "+" / "$" / "," / "/"
          unreserved   := ALPHA / DIGIT / "-" / "." / "_" / "~"
          pct-encoded    := "%" HEXDIG HEXDIG
      

      Content-type definition from RFC 2045:

      Unable to find source-code formatter for language: unknown. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
           content := "Content-Type" ":" type "/" subtype
                      *(";" parameter)
                      ; Matching of media type and subtype
                      ; is ALWAYS case-insensitive.
      
           type := discrete-type / composite-type
      
           discrete-type := "text" / "image" / "audio" / "video" /
                            "application" / extension-token
      
           composite-type := "message" / "multipart" / extension-token
      
           extension-token := ietf-token / x-token
      
           ietf-token := <An extension token defined by a
                          standards-track RFC and registered
                          with IANA.>
      
           x-token := <The two characters "X-" or "x-" followed, with
                       no intervening white space, by any token>
      
           subtype := extension-token / iana-token
      
           iana-token := <A publicly-defined extension token. Tokens
                          of this form must be registered with IANA
                          as specified in RFC 2048.>
      
           parameter := attribute "=" value
      
           attribute := token
                        ; Matching of attributes
                        ; is ALWAYS case-insensitive.
      
           value := token / quoted-string
      
           token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
                       or tspecials>
      
           tspecials :=  "(" / ")" / "<" / ">" / "@" /
                         "," / ";" / ":" / "\" / <">
                         "/" / "[" / "]" / "?" / "="
                         ; Must be in quoted-string,
                         ; to use within parameter values
      

              dlloyd@redhat.com David Lloyd
              dlloyd@redhat.com David Lloyd
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: