Package org.ojalgo.netio
Class ResourceLocator
- java.lang.Object
-
- org.ojalgo.netio.ResourceLocator
-
public final class ResourceLocator extends java.lang.Object
Locate/fetch resources such as csv, json or text/html.Started out as something relatively simple built around
URL
(and related stuff in the java.net package) but grew into a complete http client.The newer
ServiceClient
is instead built around theHttpClient
introduced with Java 11. Think ofServiceClient
as v2 ofResourceLocator
, and what you should use for http/https calls.This class is not (yet) deprecated, but if it is further developed it will not be primarily as an http/https client. The focus will then be on other
URL
based use cases.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResourceLocator.KeyedValues
static class
ResourceLocator.Method
static class
ResourceLocator.Request
static class
ResourceLocator.Response
static class
ResourceLocator.Session
-
Field Summary
Fields Modifier and Type Field Description static ResourceLocator.KeyedValues
DEFAULTS
Default session parametersprivate ResourceLocator.Request
myRequest
private ResourceLocator.Session
mySession
(package private) static java.lang.String
UTF_8
-
Constructor Summary
Constructors Constructor Description ResourceLocator()
ResourceLocator(java.lang.String url)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceLocator
form(java.lang.String key, java.lang.String value)
ResourceLocator
fragment(java.lang.String fragment)
java.io.InputStream
getInputStream()
java.io.Reader
getStreamReader()
Open connection and return an input stream reader.ResourceLocator
host(java.lang.String host)
ResourceLocator
method(ResourceLocator.Method method)
ResourceLocator
path(java.lang.String path)
ResourceLocator
port(int port)
The default (null) value is -1.ResourceLocator
query(java.lang.String key, java.lang.String value)
private ResourceLocator.Request
request()
private ResourceLocator.Response
response()
ResourceLocator
scheme(java.lang.String scheme)
Protocol The default value is "https"static ResourceLocator.Session
session()
java.lang.String
toString()
(package private) static java.lang.String
urldecode(java.lang.String encoded)
(package private) static java.lang.String
urlencode(java.lang.String unencoded)
-
-
-
Field Detail
-
DEFAULTS
public static ResourceLocator.KeyedValues DEFAULTS
Default session parameters
-
UTF_8
static final java.lang.String UTF_8
-
myRequest
private transient ResourceLocator.Request myRequest
-
mySession
private final ResourceLocator.Session mySession
-
-
Method Detail
-
session
public static ResourceLocator.Session session()
-
urldecode
static java.lang.String urldecode(java.lang.String encoded)
-
urlencode
static java.lang.String urlencode(java.lang.String unencoded)
-
form
public ResourceLocator form(java.lang.String key, java.lang.String value)
-
fragment
public ResourceLocator fragment(java.lang.String fragment)
-
getInputStream
public java.io.InputStream getInputStream()
-
getStreamReader
public java.io.Reader getStreamReader()
Open connection and return an input stream reader.
-
host
public ResourceLocator host(java.lang.String host)
-
method
public ResourceLocator method(ResourceLocator.Method method)
-
path
public ResourceLocator path(java.lang.String path)
-
port
public ResourceLocator port(int port)
The default (null) value is -1.
-
query
public ResourceLocator query(java.lang.String key, java.lang.String value)
-
scheme
public ResourceLocator scheme(java.lang.String scheme)
Protocol The default value is "https"
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
request
private ResourceLocator.Request request()
-
response
private ResourceLocator.Response response()
-
-