public class Mech2WithBase extends Object
This class is useful when
| コンストラクタと説明 |
|---|
Mech2WithBase(Mech2 mech2,
URI baseURI) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
Mech2WithBase |
disableRedirectHandling()
Disable redirect handling.
|
Mech2Request |
get(String path)
Create new GET request.
|
URI |
getBaseURI()
Get base URI
|
Mech2Request |
getf(String pathFormat,
Object... args)
Create new GET request using
String.format(String, Object...). |
Mech2 |
getMech2()
Get a mech2 instance.
|
Mech2Request |
post(String path)
Create new POST request.
|
Mech2Request |
postJSON(String path,
Object data)
Create new POST request contains JSON.
|
Mech2RequestMultipart |
postMultipart(String path)
Create multi-part POST request(Charset is UTF-8).
|
Mech2RequestMultipart |
postMultipart(String path,
Charset charset)
Create new multi-part POST request.
|
public Mech2 getMech2()
public URI getBaseURI()
public Mech2Request get(String path) throws URISyntaxException
path - request pathURISyntaxExceptionpublic Mech2Request getf(String pathFormat, Object... args) throws URISyntaxException
String.format(String, Object...).
It's same as
mech.get(String.format("/member/%s", member.getId())
. But readable.pathFormat - path formatargs - parameters.URISyntaxExceptionpublic Mech2WithBase disableRedirectHandling()
public Mech2Request post(String path) throws URISyntaxException
path - pathURISyntaxExceptionpublic Mech2Request postJSON(String path, Object data) throws URISyntaxException, com.fasterxml.jackson.core.JsonProcessingException
path - path to requestdata - source of JSON. It'll serialize by jackson.URISyntaxExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionpublic Mech2RequestMultipart postMultipart(String path)
path - path to requestpublic Mech2RequestMultipart postMultipart(String path, Charset charset)
path - path to requestcharset - charsetCopyright © 2015. All rights reserved.