mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 21:02:08 -08:00
Mage.Stats WS module for getting server stats in json format
This commit is contained in:
parent
78c0d76088
commit
71614becc2
43 changed files with 1587 additions and 0 deletions
|
|
@ -0,0 +1,24 @@
|
|||
package com.xmage.ws.representer;
|
||||
|
||||
import com.xmage.ws.model.SimpleResponse;
|
||||
import com.xmage.ws.resource.Resource;
|
||||
import net.minidev.json.JSONObject;
|
||||
|
||||
/**
|
||||
* This is useful when we have {@link SimpleResponse}
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class SimpleResponseRepresenter implements Representer<SimpleResponse> {
|
||||
|
||||
public JSONObject toJSON(Resource<SimpleResponse> resource) {
|
||||
SimpleResponse response = resource.getDefault();
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", response.getCode());
|
||||
json.put("message", response.getMessage());
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue