|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.linkedin.groovy.util.net.GroovyNetUtils
class GroovyNetUtils
Contains utilities for net
Method Summary | |
---|---|
static java.lang.String
|
guessFilename(java.net.URI uri)
Method which tries to infer the filename from the uri. |
static java.net.URI
|
toURI(java.lang.Object s)
Converts the provided parameter into a URI... handle: File, strings, URI, URL, |
static java.net.URL
|
toURL(java.lang.Object s)
Encapsulates the creation of a URL by first trying the normal way and if it fails, it
falls back to the |
static java.lang.Object
|
withHttpEchoServer(groovy.lang.Closure closure)
Equivalent to call withHttpEchoServer(int, Closure) with 0 for the port |
static java.lang.Object
|
withHttpEchoServer(int port, groovy.lang.Closure closure)
Create a simple http server on localhost on the given port for the duration of the closure. |
static java.lang.Object
|
withHttpServer(int port, java.util.Map handlers, groovy.lang.Closure closure)
Create a simple http server on localhost on the given port for the duration of the closure. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Method Detail |
---|
static java.lang.String guessFilename(java.net.URI uri)
static java.net.URI toURI(java.lang.Object s)
null
static java.net.URL toURL(java.lang.Object s)
SingletonURLStreamHandlerFactory
static java.lang.Object withHttpEchoServer(groovy.lang.Closure closure)
static java.lang.Object withHttpEchoServer(int port, groovy.lang.Closure closure)
port
- the port on which to bind the server (0 means pick an ephemeral port)closure
- code to execute while the echo server is up and running. Parameter to the
closure = port bound
static java.lang.Object withHttpServer(int port, java.util.Map handlers, groovy.lang.Closure closure)
port
- the port on which to bind the server (0 means pick an ephemeral port)handlers
- a map of path (ex: /echo) to handler (a closure or an instance of
HttpHandler
)closure
- code to execute while the echo server is up and running. Parameter to the
closure = port bound
Groovy Documentation