本文整理匯總了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();
}