- java.lang.Object
-
- org.ojalgo.netio.ResourceLocator
-
public final class ResourceLocator extends java.lang.ObjectLocate/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
ServiceClientis instead built around theHttpClientintroduced with Java 11. Think ofServiceClientas 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
URLbased use cases.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResourceLocator.KeyedValuesstatic classResourceLocator.Methodstatic classResourceLocator.Requeststatic classResourceLocator.Responsestatic classResourceLocator.Session
-
Field Summary
Fields Modifier and Type Field Description static ResourceLocator.KeyedValuesDEFAULTSDefault session parametersprivate ResourceLocator.RequestmyRequestprivate ResourceLocator.SessionmySession(package private) static java.lang.StringUTF_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 ResourceLocatorform(java.lang.String key, java.lang.String value)ResourceLocatorfragment(java.lang.String fragment)java.io.InputStreamgetInputStream()java.io.ReadergetStreamReader()Open connection and return an input stream reader.ResourceLocatorhost(java.lang.String host)ResourceLocatormethod(ResourceLocator.Method method)ResourceLocatorpath(java.lang.String path)ResourceLocatorport(int port)The default (null) value is -1.ResourceLocatorquery(java.lang.String key, java.lang.String value)private ResourceLocator.Requestrequest()private ResourceLocator.Responseresponse()ResourceLocatorscheme(java.lang.String scheme)Protocol The default value is "https"static ResourceLocator.Sessionsession()java.lang.StringtoString()(package private) static java.lang.Stringurldecode(java.lang.String encoded)(package private) static java.lang.Stringurlencode(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:
toStringin classjava.lang.Object
-
request
private ResourceLocator.Request request()
-
response
private ResourceLocator.Response response()
-
-