public class WS extends PlayPlugin
Get latest BBC World news as a RSS content
HttpResponse response = WS.url("http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml").get(); Document xmldoc = response.getXml(); // the real pain begins here...
Search what Yahoo! thinks of google (starting from the 30th result).
HttpResponse response = WS.url("http://search.yahoo.com/search?p=%s&pstart=1&b=%s", "Google killed me", "30").get(); if (response.getStatus() == 200) { html = response.getString(); }
Modifier and Type | Class and Description |
---|---|
static class |
WS.FileParam |
static class |
WS.HttpResponse
An HTTP response wrapper
|
static class |
WS.Scheme |
static interface |
WS.WSImpl |
static class |
WS.WSRequest |
static class |
WS.WSWithEncoding
Internal class exposing all the methods previously exposed by WS.
|
PlayPlugin.Filter<T>
index
Constructor and Description |
---|
WS() |
Modifier and Type | Method and Description |
---|---|
static String |
encode(String part)
URL-encode a string to be used as a query string parameter.
|
void |
onApplicationStart()
Called at application start (and at each reloading)
Time to start stateful things.
|
void |
onApplicationStop()
Called at application stop (and before each reloading)
Time to shutdown stateful things.
|
static WS.WSRequest |
url(String url)
Build a WebService Request with the given URL.
|
static WS.WSRequest |
url(String url,
String... params)
Build a WebService Request with the given URL.
|
static WS.WSWithEncoding |
withEncoding(String encoding)
Use thos method to get an instance to WS with diferent encoding
|
addMimeTypes, addTemplateExtensions, afterActionInvocation, afterApplicationStart, afterFixtureLoad, afterInvocation, beforeActionInvocation, beforeDetectingChanges, beforeInvocation, bind, bind, bind, bindBean, compareTo, compileAll, compileSources, detectChange, detectClassesChange, enhance, getFilter, getFunctionalTests, getJsonStatus, getMessage, getStatus, getUnitTests, hasFilter, invocationFinally, loadTemplate, modelFactory, onActionInvocationFinally, onActionInvocationResult, onApplicationReady, onClassesChange, onConfigurationRead, onEvent, onInvocationException, onInvocationSuccess, onLoad, onRequestRouting, onRoutesLoaded, onTemplateCompilation, overrideTemplateSource, postEvent, rawInvocation, routeRequest, runTest, serveStatic, unBind, willBeValidated
public static WS.WSWithEncoding withEncoding(String encoding)
encoding
- the encoding to use in the communicationpublic void onApplicationStop()
PlayPlugin
onApplicationStop
in class PlayPlugin
public void onApplicationStart()
PlayPlugin
onApplicationStart
in class PlayPlugin
public static String encode(String part)
part
- string to encodepublic static WS.WSRequest url(String url)
url
- of the requestpublic static WS.WSRequest url(String url, String... params)
url
- to format using the given params.params
- the params passed to format the URL.Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly