Bug 1063 - Utilize own Uri and Uri.Encoded class w/ proper encoding and differentiating encoded/decoded variants by type
Summary: Utilize own Uri and Uri.Encoded class w/ proper encoding and differentiating ...
Status: RESOLVED FIXED
Alias: None
Product: Gluegen
Classification: JogAmp
Component: core (show other bugs)
Version: 2.3.0
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
URL:
Depends on: 908
Blocks: 1103 1109
  Show dependency treegraph
 
Reported: 2014-09-07 08:03 CEST by Sven Gothel
Modified: 2019-03-29 17:54 CET (History)
4 users (show)

See Also:
Type: ---
SCM Refs:
5205e47e8a2e84e793b26305391b1c4f8648597c 2d615932505d4870f3fd0dd37f21fb3d308ab536 6322991799268166e46aeeacb142c11d45950f48 dde91a061cb0bc209442fe0e74a532b91d1bb4b8 6a466e3f1e92a1e831ea61d1bb72c32f56b2a28d jogl 1bdc495c19d3c8798a56d8476247084f0c870b48 c97e35377aea70cb293cabdd205bcc5da64b95c6
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2014-09-07 08:03:44 CEST
Resolution of Bug 908 shows that utilizing URI is almost fatal:
  - the fact, that the encoded and unencoded variant uses the same String type,

  - the URI/URL decoding differs, is not complete 
    (e.g. %20 .. SPACE remains in decoded part),

  - and does not comply w/ RFC 2396 and RFC 3986 (encoding), 
    e.g. not all RESERVED chars are encoded.

This shall be solved by our own immutable Uri and Uri.Encoded class,
where all 'encoded String' arguments shall be replaced w/ Uri.Encoded.

Further more, move all Uri relevant operations from IOUtil to Uri.
Comment 1 Sven Gothel 2014-09-07 10:23:14 CEST
commit 5205e47e8a2e84e793b26305391b1c4f8648597c 
branch v2.3.0_branch

Utilize own Uri and Uri.Encoded class w/ proper encoding 
and differentiating encoded/decoded variants by type [Part 1]
    
 - Add immutable com.jogamp.common.net.Uri class impl. 
   RFC 2396 w/ encoding of RFC 3986
    
 - Class Uri.Encoded is used to represent encoded parts
    
 - IOUtil: Remove unused methods (residing in Uri) 
   and mark others deprecated (will move to Uri)
    
 - Adopt usage of Uri: This must be completet in follow-up commits!
Comment 2 Sven Gothel 2014-09-08 05:13:45 CEST
2d615932505d4870f3fd0dd37f21fb3d308ab536
  - Uri.PATH_LEGAL: Remove reserved 'punct', 
    encoding all reserved chars but '!', allows removal of PATH_MIN_LEGAL
  - Add comment for Harmony values for review

6322991799268166e46aeeacb142c11d45950f48    
    - Refine Uri
      - remove System.err.print*
      - scheme is of type Encode
    
    - Refine Uri.Encode
      - substring(..) shall return type Encode
    
    - Fix unit tests (passing on GNU/Linux, OSX and Windows)

dde91a061cb0bc209442fe0e74a532b91d1bb4b8
 Complete Uri impl. and adoption throughout GlueGen
    
 - Uri:
   - Add error correction (fix) of path at ctor
     in case a a contained Uri is requested from an opaque one.
     The latter might come from URI/URL and is not properly encoded!
     See Uri.PARSE_HINT_FIX_PATH
    
   - Simplify conversion methods:
     - valueOf(URI/URL): Re-encode only if not opaque
     - getNativeFilePath() -> toFile()
    
   - Move IOUtil Uri related constants to class Uri
    
   - Add DEBUG and DEBUG_SHOWFIX
    
 - Complete adoption of URI -> Uri changes
   - IOUtil, JarUtil and TempJarCache still holds some
     left over deprecated methods, which will be removed
     after officially starting 2.3.0 (JOGL dependencies)
    
   - Otherwise not URI utilization left
    
 - Tests
   - Cleaned TestUri01 and TestUri03Resolving
    
   - TestUri03Resolving also tests URL -> Uri,
     and hence mentioned Uri.PARSE_HINT_FIX_PATH
Comment 3 Sven Gothel 2014-09-08 13:58:00 CEST
6a466e3f1e92a1e831ea61d1bb72c32f56b2a28d
  Further Uri completion - As a result of JOGL Uri adoption

jogl 1bdc495c19d3c8798a56d8476247084f0c870b48
    Uri adoption
    
    - ShaderCode:
      - Using Uri
      - Also encode the rel. 'includeFile' (was missing earlier)
    
    - GLMediaPlayer
      - Exposes Uri in API, removed URI
Comment 4 Sven Gothel 2014-09-10 07:23:15 CEST
c97e35377aea70cb293cabdd205bcc5da64b95c6

 - Refine API doc
   - Add notion of {@code host} and {@code port} validation
    
 - Add create(Encoded ..), allowing creation of variants w/o re-encoding
    
 - Provide common impl. for getNormalized(), getDirectory(), 
                            getParent() and getRelativeOf()
   Above feature methods share common goals, hence use same implementation:
   - If opaque, cut-off query and merge after operation
   - cleanup path, i.e. /dummy/../test/ -> /test/
   - cutoff file, dir - if requested
   - append optional appendix and cleanup again
    
   Return behavior various thought, i.e. null, this or allow exception.
    
 Enhanced test of above features.