|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectplay.PlayPlugin
play.libs.WS
public class WS
Simple HTTP client to make webservices requests.
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();
}
| Nested Class Summary | |
|---|---|
static class |
WS.FileParam
|
static class |
WS.HttpResponse
An HTTP response wrapper |
static class |
WS.Scheme
|
static interface |
WS.WSImpl
|
static class |
WS.WSRequest
|
| Field Summary |
|---|
| Fields inherited from class play.PlayPlugin |
|---|
index |
| Constructor Summary | |
|---|---|
WS()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
encode(java.lang.String part)
URL-encode an UTF-8 string to be used as a query string parameter. |
void |
onApplicationStop()
Called at application stop (and before each reloading) Time to shutdown statefull things. |
static WS.WSRequest |
url(java.lang.String url)
Build a WebService Request with the given URL. |
static WS.WSRequest |
url(java.lang.String url,
java.lang.String... params)
Build a WebService Request with the given URL. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WS()
| Method Detail |
|---|
public void onApplicationStop()
PlayPlugin
onApplicationStop in class PlayPluginpublic static java.lang.String encode(java.lang.String part)
part - string to encode
public static WS.WSRequest url(java.lang.String url)
url - of the request
public static WS.WSRequest url(java.lang.String url,
java.lang.String... params)
url - to format using the given params.params - the params passed to format the URL.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||