本文整理了Java中org.restlet.data.Reference.setQuery
方法的一些代码示例,展示了Reference.setQuery
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.setQuery
方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:setQuery
[英]Sets the query component for hierarchical identifiers.
[中]设置层次标识符的查询组件。
代码示例来源:origin: internetarchive/heritrix3
pw.println(fileRepresentation.getFile());
Reference viewRef = dirResource.getRequest().getOriginalRef().clone();
viewRef.setQuery(null);
pw.println("<a href='"+viewRef+"'>view</a>");
Flash.renderFlashesHTML(pw, dirResource.getRequest());
代码示例来源:origin: internetarchive/heritrix3
/**
* Construct navigational URI for given parameters.
*
* @param pos desired position in file
* @param lines desired signed line count
* @param reverse if line ordering should be displayed in reverse
* @return String URI appropriate to navigate to desired view
*/
protected String getControlUri(long pos, int lines, boolean reverse) {
Form query = new Form();
query.add("format","paged");
if(pos!=0) {
query.add("pos", Long.toString(pos));
}
if(lines!=128) {
if(Math.abs(lines)<1) {
lines = 1;
}
query.add("lines",Integer.toString(lines));
}
if(reverse) {
query.add("reverse","y");
}
Reference viewRef = dirResource.getRequest().getOriginalRef().clone();
viewRef.setQuery(query.getQueryString());
return viewRef.toString();
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.oauth
public Reference toReference(String uri) {
String query;
try {
query = form.encode();
} catch (IOException ex) {
Logger.getLogger(OAuthParameters.class.getName()).log(Level.SEVERE,
null, ex);
throw new ResourceException(ex);
}
Reference reference = new Reference(uri);
reference.setQuery(query);
return reference;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Adds a parameter to the query component. The name and value are
* automatically encoded if necessary.
*
* @param name
* The parameter name.
* @param value
* The optional parameter value.
* @return The updated reference.
*/
public Reference addQueryParameter(String name, String value) {
final String query = getQuery();
if (query == null) {
if (value == null) {
setQuery(encode(name));
} else {
setQuery(encode(name) + '=' + encode(value));
}
} else {
if (value == null) {
setQuery(query + '&' + encode(name));
} else {
setQuery(query + '&' + encode(name) + '=' + encode(value));
}
}
return this;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Adds a parameter to the query component. The name and value are
* automatically URL encoded if necessary.
*
* @param name
* The parameter name.
* @param value
* The optional parameter value.
* @return The updated reference.
*/
public Reference addQueryParameter(String name, String value) {
String query = getQuery();
if (query == null) {
if (value == null) {
setQuery(encode(name));
} else {
setQuery(encode(name) + '=' + encode(value));
}
} else {
if (value == null) {
setQuery(query + '&' + encode(name));
} else {
setQuery(query + '&' + encode(name) + '=' + encode(value));
}
}
return this;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Adds a parameter to the query component. The name and value are
* automatically URL encoded if necessary.
*
* @param name
* The parameter name.
* @param value
* The optional parameter value.
* @return The updated reference.
*/
public Reference addQueryParameter(String name, String value) {
String query = getQuery();
if (query == null) {
if (value == null) {
setQuery(encode(name));
} else {
setQuery(encode(name) + '=' + encode(value));
}
} else {
if (value == null) {
setQuery(query + '&' + encode(name));
} else {
setQuery(query + '&' + encode(name) + '=' + encode(value));
}
}
return this;
}
代码示例来源:origin: org.archive.heritrix/heritrix-engine
pw.println(fileRepresentation.getFile());
Reference viewRef = dirResource.getRequest().getOriginalRef().clone();
viewRef.setQuery(null);
pw.println("<a href='"+viewRef+"'>view</a>");
Flash.renderFlashesHTML(pw, dirResource.getRequest());
代码示例来源:origin: org.geoserver.extension/monitor-core
void setKVP(Request req, String... kvp) {
Reference ref = new Reference();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < kvp.length; i += 2) {
sb.append(kvp[i]).append("=").append(kvp[i+1]).append("&");
}
sb.setLength(sb.length()-1);
ref.setQuery(sb.toString());
req.setResourceRef(ref);
}
代码示例来源:origin: org.restlet/org.restlet
result.setQuery(query);
modified = true;
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Sets the query value for the named parameter. If no query is defined, it
* creates one. If the same parameter exists, it replaces it altogether.
*
* @param name
* The query parameter name.
* @param value
* The query parameter value.
*/
public void setQueryValue(String name, String value) {
Form query = getQuery();
if (query == null) {
query = new Form();
}
query.set(name, value);
try {
getReference().setQuery(query.encode());
} catch (IOException e) {
getLogger().fine("Unable to set the query value");
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public boolean writeRequest(Object requestObject, Request request) throws ResourceException
{
if (requestObject instanceof Form)
{
// Form as query parameters
if (request.getMethod().equals(Method.GET))
request.getResourceRef().setQuery(((Form)requestObject).getQueryString());
else
request.setEntity(((Form)requestObject).getWebRepresentation(CharacterSet.UTF_8));
return true;
}
return false;
}
}
代码示例来源:origin: org.archive.heritrix/heritrix-engine
/**
* Construct navigational URI for given parameters.
*
* @param pos desired position in file
* @param lines desired signed line count
* @param reverse if line ordering should be displayed in reverse
* @return String URI appropriate to navigate to desired view
*/
protected String getControlUri(long pos, int lines, boolean reverse) {
Form query = new Form();
query.add("format","paged");
if(pos!=0) {
query.add("pos", Long.toString(pos));
}
if(lines!=128) {
if(Math.abs(lines)<1) {
lines = 1;
}
query.add("lines",Integer.toString(lines));
}
if(reverse) {
query.add("reverse","y");
}
Reference viewRef = dirResource.getRequest().getOriginalRef().clone();
viewRef.setQuery(query.getQueryString());
return viewRef.toString();
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
result.setAuthority(authority);
result.setPath(path);
result.setQuery(query);
} else {
result.setAuthority(baseReference.getAuthority());
result.setQuery(query);
} else {
result.setQuery(baseReference.getQuery());
result.setQuery(query);
代码示例来源:origin: org.restlet/org.restlet
result.setAuthority(authority);
result.setPath(path);
result.setQuery(query);
} else {
result.setAuthority(baseReference.getAuthority());
result.setQuery(query);
} else {
result.setQuery(baseReference.getQuery());
result.setQuery(query);
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
result.setAuthority(authority);
result.setPath(path);
result.setQuery(query);
} else {
result.setAuthority(baseReference.getAuthority());
result.setQuery(query);
} else {
result.setQuery(baseReference.getQuery());
result.setQuery(query);
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.oauth
cb.setQuery("");
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
location.setQuery("");
代码示例来源:origin: org.restlet.osgi/org.restlet.ext.oauth
location.setQuery("");
代码示例来源:origin: apache/attic-polygene-java
ref.setQuery( null );
descriptor.state().properties().forEach( propertyDescriptor -> {
try
代码示例来源:origin: org.restlet.osgi/org.restlet
request.getResourceRef().setQuery(query.getQueryString(CharacterSet.UTF_8));
内容来源于网络,如有侵权,请联系作者删除!