org.restlet.data.Reference.getQueryAsForm()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中org.restlet.data.Reference.getQueryAsForm方法的一些代码示例,展示了Reference.getQueryAsForm的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getQueryAsForm方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:getQueryAsForm

Reference.getQueryAsForm介绍

[英]Returns the optional query component as a form.
[中]以表单形式返回可选的查询组件。

代码示例

代码示例来源:origin: internetarchive/heritrix3

public List<Variant> getVariants() {
  List<Variant> variants = super.getVariants();
  Form f = getRequest().getResourceRef().getQueryAsForm();
  String format = f.getFirstValue("format");
  if("textedit".equals(format)) {

代码示例来源:origin: org.restlet.jse/org.restlet.ext.lucene

/**
 * Returns the request query form.
 * 
 * @return The request query form.
 */
protected Form getForm() {
  return request.getResourceRef().getQueryAsForm();
}

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.oauth

private String getAccessTokenFromQuery(Request request) {
  // Try to find token in URI query
  Form params = request.getOriginalRef().getQueryAsForm();
  String token = params.getFirstValue(OAuthServerResource.ACCESS_TOKEN);
  if (token != null && !token.isEmpty()) {
    logger.fine("Found Bearer Token in URI query.");
    return token;
  }
  return null;
}

代码示例来源:origin: org.sonatype.nexus/nexus-rest-api

protected boolean isLocal( Request request, String resourceStorePath )
{
  // check do we need local only access
  boolean isLocal = request.getResourceRef().getQueryAsForm().getFirst( IS_LOCAL_PARAMETER ) != null;
  if ( resourceStorePath != null )
  {
    // overriding isLocal is we know it will be a collection
    isLocal = isLocal || resourceStorePath.endsWith( RepositoryItemUid.PATH_SEPARATOR );
  }
  return isLocal;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

private boolean isAllTasks(Request request) {
 Form form = request.getResourceRef().getQueryAsForm();
 if (form != null) {
  String result = form.getFirstValue("allTasks");
  if (result != null) {
   return result.equalsIgnoreCase("true");
  }
 }
 return false;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

protected boolean isLocal(Request request, String resourceStorePath) {
 // check do we need local only access
 boolean isLocal = request.getResourceRef().getQueryAsForm().getFirst(IS_LOCAL_PARAMETER) != null;
 if (resourceStorePath != null) {
  // overriding isLocal is we know it will be a collection
  isLocal = isLocal || resourceStorePath.endsWith(RepositoryItemUid.PATH_SEPARATOR);
 }
 return isLocal;
}

代码示例来源:origin: org.sonatype.nexus/nexus-rest-api

private boolean isAllTasks( Request request )
{
  Form form = request.getResourceRef().getQueryAsForm();
  if ( form != null )
  {
    String result = form.getFirstValue( "allTasks" );
    if ( result != null )
    {
      return result.equalsIgnoreCase( "true" );
    }
  }
  return false;
}

代码示例来源:origin: org.sonatype.nexus/nexus-rest-api

protected boolean isDescribe( Request request )
{
  // check do we need describe
  return request.getResourceRef().getQueryAsForm().getFirst( IS_DESCRIBE_PARAMETER ) != null;
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Returns the parsed query of the request's target resource reference as a
 * form (series of parameters).
 * 
 * @return The parsed query.
 * @see Reference#getQueryAsForm()
 */
public Form getQuery() {
  return getRequest().getResourceRef().getQueryAsForm();
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Returns the resource reference's optional query. Note that modifications
 * to the returned {@link Form} object aren't reported to the underlying
 * reference.
 * 
 * @return The resource reference's optional query.
 * @see Reference#getQueryAsForm()
 */
public Form getQuery() {
  return getReference() == null ? null : getReference().getQueryAsForm();
}

代码示例来源:origin: org.sonatype.nexus/nexus-rest-api

protected boolean isRemote( Request request, String resourceStorePath )
{
  // check do we need remote only access
  boolean isRemote = request.getResourceRef().getQueryAsForm().getFirst( IS_REMOTE_PARAMETER ) != null;
  return isRemote;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

protected boolean isDescribe(Request request) {
 // check do we need describe
 return request.getResourceRef().getQueryAsForm().getFirst(IS_DESCRIBE_PARAMETER) != null;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

protected boolean isRemote(Request request, String resourceStorePath) {
 // check do we need remote only access
 return request.getResourceRef().getQueryAsForm().getFirst(IS_REMOTE_PARAMETER) != null;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

protected boolean asExpired(Request request, String resourceStorePath) {
 // check do we need expired access
 return request.getResourceRef().getQueryAsForm().getFirst(AS_EXPIRED_PARAMETER) != null;
}

代码示例来源:origin: org.sonatype.nexus/nexus-it-helper-plugin

@Override
 public Object get(Context context, Request request, Response response, Variant variant)
   throws ResourceException
 {
  Form form = request.getResourceRef().getQueryAsForm();

  int requestedStatus = Integer.parseInt(form.getFirstValue("status"));

  throw new ResourceException(requestedStatus);
 }
}

代码示例来源:origin: org.geoserver/rest

public static String getQueryStringValue(Request request, String key) {
  String value = request.getResourceRef().getQueryAsForm().getFirstValue(key);
  return decode(value);
}

代码示例来源:origin: org.codeartisans.qipki/qipki-ca-http

protected final String ensureQueryParamValue( String key, Status ifAbsent )
{
  String value = getRequest().getResourceRef().getQueryAsForm().getFirstValue( key );
  if ( Strings.isEmpty( value ) ) {
    LOGGER.trace( "{}: No query parameter named {}", ifAbsent, key );
    throw new ResourceException( ifAbsent );
  }
  return value;
}

代码示例来源:origin: bioinformatics-ua/dicoogle

protected boolean getQSBoolean(String name) {
  Parameter param = getRequest().getResourceRef().getQueryAsForm().getFirst(name);
  return param != null && (param.getValue() == null || param.getValue().equalsIgnoreCase("true"));
}

代码示例来源:origin: org.codeartisans.qipki/qipki-ca-http

protected final String getQueryParamValue( String key, String defaultValue )
{
  String value = getRequest().getResourceRef().getQueryAsForm().getFirstValue( key );
  if ( Strings.isEmpty( value ) ) {
    value = defaultValue;
  }
  return value;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

public String getRestRepoRemoteStatus(ProxyRepository repository, Request request, Response response)
  throws ResourceException
{
 Form form = request.getResourceRef().getQueryAsForm();
 boolean forceCheck = form.getFirst("forceCheck") != null;
 RemoteStatus rs =
   repository.getRemoteStatus(new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT), forceCheck);
 if (RemoteStatus.UNKNOWN.equals(rs)) {
  // set status to ACCEPTED, since we have incomplete info
  response.setStatus(Status.SUCCESS_ACCEPTED);
 }
 return rs == null ? null : rs.toString() + (rs.getReason() == null ? "" : ":" + rs.getReason());
}

相关文章

Reference类方法