maskit commented on issue #2888: PIP-25: Token based authentication
URL: https://github.com/apache/pulsar/pull/2888#issuecomment-441600275
 
 
   If we added all the parsers as URLStreamHandlers, users would be able to 
read any of them like this without taking care of the scheme.
   ```java
   import org.apache.pulsar.client.api.url.URL;
   import java.net.URLConnection;
   
   URLConnection urlConnection = new URL(keyConfUrl).openConnection();
   String keyData = CharStreams.toString(new InputStreamReader((InputStream) 
urlConnection.getContent()));
   ```
   
   Since `openConnection()` is defined in `java.net.URL`. The only thing users 
need to do is changing `import` line. Then they can use it as the same as 
`java.net.URL`.
   https://docs.oracle.com/javase/8/docs/api/java/net/URL.html#openConnection--
   
   I don't remember why I didn't implement `URL#getContent()` (it's a shorthand 
for `openConnection().getContent()`) but if we did, it would be much easier.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to