本文整理汇总了Java中org.restlet.data.Form.getValues方法的典型用法代码示例。如果您正苦于以下问题:Java Form.getValues方法的具体用法?Java Form.getValues怎么用?Java Form.getValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.restlet.data.Form
的用法示例。
在下文中一共展示了Form.getValues方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDate
import org.restlet.data.Form; //导入方法依赖的package包/类
public static Date getDate(Form form, String name) {
Date value = null;
if(form.getValues(name) != null) {
String input = form.getValues(name);
//this is zero time so we need to add that TZ indicator for
if (input.endsWith("Z")) {
input = input.substring( 0, input.length() - 1) + "GMT-00:00";
} else {
int inset = 6;
String s0 = input.substring(0, input.length() - inset);
String s1 = input.substring(input.length() - inset, input.length());
input = s0 + "GMT" + s1;
}
try {
value = df.parse(input);
} catch(Exception e) {
throw new ActivitiException("Failed to parse date " + input);
}
}
return value;
}
示例2: getDate
import org.restlet.data.Form; //导入方法依赖的package包/类
public static Date getDate(Form form, String name) {
Date value = null;
if (form.getValues(name) != null) {
String input = form.getValues(name);
// this is zero time so we need to add that TZ indicator for
if (input.endsWith("Z")) {
input = input.substring(0, input.length() - 1) + "GMT-00:00";
} else {
int inset = 6;
String s0 = input.substring(0, input.length() - inset);
String s1 = input.substring(input.length() - inset, input.length());
input = s0 + "GMT" + s1;
}
try {
value = longDateFormat.parse(input);
} catch (Exception e) {
throw new FoxbpmPluginException("Failed to parse date " + input,"Rest服务");
}
}
return value;
}
示例3: getDate
import org.restlet.data.Form; //导入方法依赖的package包/类
public static Date getDate(Form form, String name) {
Date value = null;
if(form.getValues(name) != null) {
String input = form.getValues(name);
//this is zero time so we need to add that TZ indicator for
if (input.endsWith("Z")) {
input = input.substring( 0, input.length() - 1) + "GMT-00:00";
} else {
int inset = 6;
String s0 = input.substring(0, input.length() - inset);
String s1 = input.substring(input.length() - inset, input.length());
input = s0 + "GMT" + s1;
}
try {
value = longDateFormat.parse(input);
} catch(Exception e) {
throw new ActivitiException("Failed to parse date " + input);
}
}
return value;
}
示例4: fromRequest
import org.restlet.data.Form; //导入方法依赖的package包/类
/**
* // Get parameters for processing? None currently, but may be:
* // - lower case tagging or filtering
* // - coordinate parsing on|off
* //
* // Get parameters for formatting. JSON, HTML, mainly.
* // Output represents filters + format.
* //
*
* @param inputs
* @return
*/
private RequestParameters fromRequest(Form inputs) {
RequestParameters job = new RequestParameters();
String list = inputs.getValues("features");
Set<String> features = new HashSet<>();
job.tag_coordinates = true;
job.tag_countries = true;
job.tag_places = true;
if (isNotBlank(list)) {
features.addAll(TextUtils.string2list(list.toLowerCase(), ","));
job.output_coordinates = features.contains("coordinates");
job.output_countries = features.contains("countries");
job.output_places = features.contains("places");
}
String fmt = inputs.getFirstValue("format");
if (fmt != null) {
job.format = fmt;
}
return job;
}
示例5: getBoolean
import org.restlet.data.Form; //导入方法依赖的package包/类
public static boolean getBoolean(Form form, String name, boolean defaultValue) {
boolean value = defaultValue;
if(form.getValues(name) != null) {
value = Boolean.valueOf(form.getValues(name));
}
return value;
}
示例6: getInteger
import org.restlet.data.Form; //导入方法依赖的package包/类
public static int getInteger(Form form, String name, int defaultValue) {
int value = defaultValue;
if(form.getValues(name) != null) {
value = Integer.valueOf(form.getValues(name));
}
return value;
}
示例7: paginateList
import org.restlet.data.Form; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public DataResult paginateList(Form form, Query query, String defaultSort, Map<String, QueryProperty> properties) {
// Collect parameters
int start = RequestUtil.getInteger(form, "start", 0);
int size = RequestUtil.getInteger(form, "size", 10);
String sort = form.getValues("sort");
if (sort == null) {
sort = defaultSort;
}
String order = form.getValues("order");
if (order == null) {
order = "asc";
}
// Sort order
if (sort != null && properties.size() > 0) {
QueryProperty qp = properties.get(sort);
if (qp == null) {
throw new FoxbpmPluginException("Value for param 'sort' is not valid, '" + sort + "' is not a valid property","rest服务");
}
((AbstractQuery) query).orderBy(qp);
if (order.equals("asc")) {
query.asc();
} else if (order.equals("desc")) {
query.desc();
} else {
throw new FoxbpmPluginException("Value for param 'order' is not valid : '" + order + "', must be 'asc' or 'desc'","rest服务");
}
}
List list = processList(query.listPage(start, size));
DataResult response = new DataResult();
response.setSort(sort);
response.setOrder(order);
response.setData(list);
return response;
}
示例8: getBoolean
import org.restlet.data.Form; //导入方法依赖的package包/类
public static boolean getBoolean(Form form, String name, boolean defaultValue) {
boolean value = defaultValue;
if (form.getValues(name) != null) {
value = Boolean.valueOf(form.getValues(name));
}
return value;
}
示例9: getInteger
import org.restlet.data.Form; //导入方法依赖的package包/类
public static int getInteger(Form form, String name, int defaultValue) {
int value = defaultValue;
if (form.getValues(name) != null) {
value = Integer.valueOf(form.getValues(name));
}
return value;
}
示例10: handleCommand
import org.restlet.data.Form; //导入方法依赖的package包/类
@Post("form")
public void handleCommand(Form form) {
if (form != null) {
String logMessage = form.getValues("log") ;
//TODO: log message...
}
cancelJob(job) ;
//TODO: return 202 Accepted w/ representation stating "Canceling job..." and link to job page
//can use HTTP-EQUIV meta tag to redirect client to job page after delay...
redirectSeeOther(getNamespace().jobRef(entryName, modelName, jobName, true)) ;
}
示例11: paginateList
import org.restlet.data.Form; //导入方法依赖的package包/类
/**
* uses the pagination parameters form the request and makes sure to order the result and set all pagination
* attributes for the response to render
*
* @param req The request containing the pagination parameters
* @param query The query to get the paged list from
* @param listName The name model attribute name to use for the result list
* @param model The model to put the list and the pagination attributes in
* @param defaultSort THe default sort column (the rest attribute) that later will be mapped to an internal engine name
*/
@SuppressWarnings("rawtypes")
public DataResponse paginateList(Form form, Query query,
String defaultSort, Map<String, QueryProperty> properties) {
// Collect parameters
int start = RequestUtil.getInteger(form, "start", 0);
int size = RequestUtil.getInteger(form, "size", 10);
String sort = form.getValues("sort");
if(sort == null) {
sort = defaultSort;
}
String order = form.getValues("order");
if(order == null) {
order = "asc";
}
// Sort order
if (sort != null && properties.size() > 0) {
QueryProperty qp = properties.get(sort);
if (qp == null) {
throw new ActivitiException("Value for param 'sort' is not valid, '" + sort + "' is not a valid property");
}
((AbstractQuery) query).orderBy(qp);
if (order.equals("asc")) {
query.asc();
}
else if (order.equals("desc")) {
query.desc();
}
else {
throw new ActivitiException("Value for param 'order' is not valid : '" + order + "', must be 'asc' or 'desc'");
}
}
// Get result and set pagination parameters
List list = processList(query.listPage(start, size));
DataResponse response = new DataResponse();
response.setStart(start);
response.setSize(list.size());
response.setSort(sort);
response.setOrder(order);
response.setTotal(query.count());
response.setData(list);
return response;
}