本文整理汇总了Java中org.restlet.data.Form.getQueryString方法的典型用法代码示例。如果您正苦于以下问题:Java Form.getQueryString方法的具体用法?Java Form.getQueryString怎么用?Java Form.getQueryString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.restlet.data.Form
的用法示例。
在下文中一共展示了Form.getQueryString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Handler
import org.restlet.data.Form; //导入方法依赖的package包/类
public Handler(Query query, Form form) throws ResourceException {
this.query = query;
this.queryString = form.getQueryString();
for (QueryParameter p : query.getParameters()) {
String name = p.getName();
String svalue = form.getFirstValue(name, true);
switch (p.getType()) {
case DATE:
parameters.put(p, readParameterValue(Date.class, p, svalue));
break;
case NUMBER:
parameters.put(p, readParameterValue(BigDecimal.class, p, svalue));
break;
case STRING:
parameters.put(p, readParameterValue(String.class, p, svalue));
break;
case CLOB:
case BLOB:
throw new ClientErrorException(Status.CLIENT_ERROR_BAD_REQUEST, String.format("LOBs are not supported as parameters: %s", name));
}
}
if (log.isDebugEnabled()) {
for (QueryParameter qp: parameters.keySet()) {
log.debug(qp.toString(parameters.get(qp)));
}
}
}
示例2: createCookieValue
import org.restlet.data.Form; //导入方法依赖的package包/类
public static String createCookieValue(String idType, String identifier,
Properties properties) {
// Create the expiration date for the cookie. This is added to be sure
// that the server has control over this even if a malicious client
// extends the date of a cookie.
long expiryMillis = (new Date()).getTime() + COOKIE_DEFAULT_AGE * 1000L;
String expiryDate = Long.toString(expiryMillis);
// Create a form (and query) that contains the authentication
// information to be signed.
Form form = new Form();
form.add(COOKIE_IDTYPE, idType);
form.add(COOKIE_IDENTIFIER, identifier);
if (!properties.containsKey(COOKIE_EXPIRY_DATE)) {
form.add(COOKIE_EXPIRY_DATE, expiryDate);
}
// Add all parameters
for (Entry<Object, Object> entry : properties.entrySet()) {
form.add((String) entry.getKey(), (String) entry.getValue());
}
properties.put(COOKIE_IDENTIFIER, identifier);
String claimsToken = createToken(properties);
form.add(COOKIE_SIGNATURE, claimsToken);
return form.getQueryString();
}