org.fusesource.restygwt.client
Class Method
java.lang.Object
org.fusesource.restygwt.client.Method
- Direct Known Subclasses:
- JsonpMethod
public class Method
- extends Object
- Author:
- Hiram Chirino
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
builder
public RequestBuilder builder
Method
protected Method()
Method
public Method(Resource resource,
String method)
user
public Method user(String user)
password
public Method password(String password)
header
public Method header(String header,
String value)
headers
public Method headers(Map<String,String> headers)
text
public Method text(String data)
json
public Method json(JSONValue data)
xml
public Method xml(Document data)
timeout
public Method timeout(int timeout)
expect
public Method expect(int... statuses)
- sets the expected response status code. If the response status code does not match
any of the values specified then the request is considered to have failed. Defaults to accepting
200,201,204. If set to -1 then any status code is considered a success.
isExpected
public boolean isExpected(int status)
- Local file-system (file://) does not return any status codes.
Therefore - if we read from the file-system we accept all codes.
This is for instance relevant when developing a PhoneGap application with
restyGwt.
send
public void send(RequestCallback callback)
throws RequestException
- Throws:
RequestException
send
public void send(TextCallback callback)
send
public void send(JsonCallback callback)
send
public void send(XmlCallback callback)
send
public <T extends JavaScriptObject> void send(OverlayCallback<T> callback)
getRequest
public Request getRequest()
getResponse
public Response getResponse()
defaultContentType
protected void defaultContentType(String type)
defaultAcceptType
protected void defaultAcceptType(String type)
getDispatcher
public Dispatcher getDispatcher()
setDispatcher
public void setDispatcher(Dispatcher dispatcher)
addData
public void addData(String key,
String value)
- add some information onto the method which could be interesting when this method
comes back to the dispatcher.
- Parameters:
key - value -
getData
public Map<String,String> getData()
- get all data fields which was previously added
- Returns:
Copyright © 2010-2011 FuseSource, Corp.. All Rights Reserved.