use of org.opensextant.data.TextInput in project Xponents by OpenSextant.
the class TaggerResource method processGet.
/**
* HTTP GET -- vanilla. Do not use in production, unless you have really small data packages.
* This is useful for testing. Partial contract:
*
* miscellany: 'cmd' = 'ping' |... other commands.
* processing: 'docid' = ?, 'text' = ?
*
* @param params
* the params
* @return the representation
*/
@Get("application/json;charset=utf-8")
public Representation processGet(Representation params) {
Form inputs = getRequest().getResourceRef().getQueryAsForm();
String cmd = inputs.getFirstValue("cmd");
if ("ping".equalsIgnoreCase(cmd)) {
return ping();
} else if ("stop".equalsIgnoreCase(cmd)) {
info("Stopping Xponents Xlayer Service Requested by CLIENT=" + getRequest().getClientInfo().getAddress());
stop();
}
String input = inputs.getFirstValue("text");
String docid = inputs.getFirstValue("docid");
String lang = inputs.getFirstValue("lang");
TextInput item = new TextInput(docid, input);
item.langid = lang;
RequestParameters job = fromRequest(inputs);
return process(item, job);
}
Aggregations