Class StandardInternetAccess
- java.lang.Object
-
- nl.colorize.multimedialib.renderer.java2d.StandardInternetAccess
-
- All Implemented Interfaces:
InternetAccess
public class StandardInternetAccess extends java.lang.Object implements InternetAccess
Sends HTTP requests using the HTTP client included as part of the Java standard library. It also provides web socket support through the Java-WebSocket library.
-
-
Constructor Summary
Constructors Constructor Description StandardInternetAccess()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebSocketConnectionconnectWebSocket(java.lang.String uri)Connects to the web socket located at the specified URI.nl.colorize.util.Promise<java.lang.String>get(java.lang.String url, nl.colorize.util.http.Headers headers)Sends a HTTP GET request to the specified URL.booleanisWebSocketSupported()nl.colorize.util.Promise<java.lang.String>post(java.lang.String url, nl.colorize.util.http.Headers headers, nl.colorize.util.http.PostData body)Sends a HTTP POST request to the specified URL.nl.colorize.util.Promise<java.lang.String>send(nl.colorize.util.http.Method method, java.lang.String url, nl.colorize.util.http.Headers headers, nl.colorize.util.http.PostData body)
-
-
-
Method Detail
-
get
public nl.colorize.util.Promise<java.lang.String> get(java.lang.String url, nl.colorize.util.http.Headers headers)Description copied from interface:InternetAccessSends a HTTP GET request to the specified URL.- Specified by:
getin interfaceInternetAccess- Returns:
- A
Promisethat can be used to process the response once it has been received.
-
post
public nl.colorize.util.Promise<java.lang.String> post(java.lang.String url, nl.colorize.util.http.Headers headers, nl.colorize.util.http.PostData body)Description copied from interface:InternetAccessSends a HTTP POST request to the specified URL. The request body will be encoded using theapplication/x-www-form-urlencodedcontent type.- Specified by:
postin interfaceInternetAccess- Returns:
- A
Promisethat can be used to process the response once it has been received.
-
send
public nl.colorize.util.Promise<java.lang.String> send(nl.colorize.util.http.Method method, java.lang.String url, nl.colorize.util.http.Headers headers, nl.colorize.util.http.PostData body)
-
isWebSocketSupported
public boolean isWebSocketSupported()
- Specified by:
isWebSocketSupportedin interfaceInternetAccess
-
connectWebSocket
public WebSocketConnection connectWebSocket(java.lang.String uri)
Description copied from interface:InternetAccessConnects to the web socket located at the specified URI. Note that some platforms may only allow the secure web socket protocol (i.e."wss://").- Specified by:
connectWebSocketin interfaceInternetAccess
-
-