This discussion is archived
1 Reply Latest reply: Jul 30, 2013 9:01 AM by greybird RSS

Key with a slash character

Apostolis Newbie
Currently Being Moderated

Hello,

 

In my tests I see that when I add a key component that contains a slash character "/", Oracle NoSQL encodes it as "%2F".

For example:

ArrayList<String> majorComponents = new ArrayList<String>();
majorComponents.add("forums.oracle.com/community");
Key myKey = Key.createKey(majorComponents);
System.out.println(myKey.toString());

this prints:

forums.oracle%2Fcommunity

I tried to URLDecode.decode the string before I add it to the majorComponents but it doesn't work.

Therefore, my question is if there is a way to have a key that contains slash characters. Please have in mind that I would prefer not to split the string into multiple components every time a slash character occurs in the string.

 

Thank you very much in advance,

Apostolos Giannakidis

  • 1. Re: Key with a slash character
    greybird Expert
    Currently Being Moderated

    Hi,

     

    All Unicode characters are allowed in a key component, including slashes.  Your code to create the key is correct, and the key component does contain a slash.  The slash is escaped by the Key.toString method for two reasons: 1) to delineate key components, 2) to provide a URI syntax.  If you call Key.getMajorPath and look at the component, you'll see the un-escaped slash.  The Key.toString javadoc contains complete documentation of the string format.

     

    --mark

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points