本文整理了Java中org.restlet.data.Reference.getQuery
方法的一些代码示例,展示了Reference.getQuery
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getQuery
方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:getQuery
[英]Returns the optional query component for hierarchical identifiers.
Note that no URI decoding is done by this method.
[中]返回分层标识符的可选查询组件。
请注意,此方法不会执行URI解码。
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optionnally decoded query component.
*
* @param decode
* Indicates if the result should be decoded using the {@link #decode(String)} method.
* @return The optionnally decoded query component.
* @see #getQuery()
*/
public String getQuery(boolean decode) {
return decode ? decode(getQuery()) : getQuery();
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the optionnally decoded query component.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @return The optionnally decoded query component.
* @see #getQuery()
*/
public String getQuery(boolean decode) {
return decode ? decode(getQuery()) : getQuery();
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the optionnally decoded query component.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @return The optionnally decoded query component.
* @see #getQuery()
*/
public String getQuery(boolean decode) {
return decode ? decode(getQuery()) : getQuery();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optional query component as a form.
*
* @return The optional query component as a form.
*/
public Form getQueryAsForm() {
return new Form(getQuery());
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the optional query component as a form submission.
*
* @param characterSet
* The supported character encoding.
* @return The optional query component as a form submission.
*/
public Form getQueryAsForm(CharacterSet characterSet) {
return new Form(getQuery(), characterSet);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the optional query component as a form.
*
* @return The optional query component as a form.
*/
public Form getQueryAsForm() {
return new Form(getQuery());
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optional query component as a form.
*
* @param decode
* Indicates if the names and values should be automatically
* decoded.
* @return The optional query component as a form.
*/
public Form getQueryAsForm(boolean decode) {
return new Form(getQuery(), decode);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optional query component as a form submission.
*
* @param characterSet
* The supported character encoding.
* @return The optional query component as a form submission.
*/
public Form getQueryAsForm(CharacterSet characterSet) {
return new Form(getQuery(), characterSet);
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the optional query component as a form.
*
* @return The optional query component as a form.
*/
public Form getQueryAsForm() {
return new Form(getQuery());
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the optional query component as a form.
*
* @param decode
* Indicates if the names and values should be automatically
* decoded.
* @return The optional query component as a form.
*/
public Form getQueryAsForm(boolean decode) {
return new Form(getQuery(), decode);
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the optional query component as a form submission.
*
* @param characterSet
* The supported character encoding.
* @return The optional query component as a form submission.
*/
public Form getQueryAsForm(CharacterSet characterSet) {
return new Form(getQuery(), characterSet);
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
/**
* Get the URI query parameters of the current request.
*
* @param decode
* controls whether sequences of escaped octets in parameter
* names and values are decoded (true) or not (false).
* @param caseSensitive
* should the parameter name should keep their case, set to true
* @return an unmodifiable map of query parameter names and values
* @throws java.lang.IllegalStateException
* if called outside the scope of a request
* @see UriInfo#getQueryParameters(boolean)
*/
public MultivaluedMap<String, String> getQueryParameters(boolean decode,
boolean caseSensitive) {
if (decode) {
return getQueryParameters();
}
if (this.queryParametersEncoded == null) {
Form queryForm = Converter.toFormEncoded(this.referenceOriginal
.getQuery());
this.queryParametersEncoded = UnmodifiableMultivaluedMap
.getFromSeries(queryForm, caseSensitive);
}
return this.queryParametersEncoded;
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server
private boolean shouldShowCommandForm( Method interactionMethod )
{
// Show form on GET/HEAD
if( Request.getCurrent().getMethod().isSafe() )
{
return true;
}
if( interactionMethod.getParameterTypes().length > 0 )
{
return !( interactionMethod.getParameterTypes()[ 0 ].equals( Response.class ) || Request.getCurrent()
.getEntity()
.isAvailable() || Request.getCurrent().getEntityAsText() != null || Request.getCurrent()
.getResourceRef()
.getQuery() != null );
}
return false;
}
代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server
private boolean shouldShowCommandForm( Method interactionMethod )
{
// Show form on GET/HEAD
if( Request.getCurrent().getMethod().isSafe() )
{
return true;
}
if( interactionMethod.getParameterTypes().length > 0 )
{
return !( interactionMethod.getParameterTypes()[ 0 ].equals( Response.class ) || Request.getCurrent()
.getEntity()
.isAvailable() || Request.getCurrent().getEntityAsText() != null || Request.getCurrent()
.getResourceRef()
.getQuery() != null );
}
return false;
}
代码示例来源:origin: apache/attic-polygene-java
private boolean shouldShowCommandForm( Method interactionMethod )
{
// Show form on GET/HEAD
if( Request.getCurrent().getMethod().isSafe() )
{
return true;
}
if( interactionMethod.getParameterTypes().length > 0 )
{
return !( interactionMethod.getParameterTypes()[ 0 ].equals( Response.class ) || Request.getCurrent()
.getEntity()
.isAvailable() || Request.getCurrent().getEntityAsText() != null || Request.getCurrent()
.getResourceRef()
.getQuery() != null );
}
return false;
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
@Override
public Object getParamValue() {
final Reference resourceRef = this.tlContext.get().getRequest()
.getResourceRef();
final String queryString = resourceRef.getQuery();
final Form form = Converter.toFormEncoded(queryString);
final String paramName = this.queryParam.value();
try {
return super.getParamValue(form, paramName);
} catch (ConvertParameterException e) {
throw new ConvertQueryParamException(e);
}
}
}
代码示例来源:origin: unchartedsoftware/aperture-tiles
/**
* GET request. Returns a JSON response from the translation service specified
*/
@Get
public Representation translate() throws ResourceException {
// get the params from
try {
// No alternate versions supported. But if we did:
String version = (String) getRequest().getAttributes().get("version");
if ( version == null ) {
version = LayerConfiguration.DEFAULT_VERSION;
}
// decode and build JSONObject from request parameters
JSONObject decodedQueryParams = QueryParamDecoder.decode( getRequest().getResourceRef().getQuery() );
return new JsonRepresentation( _service.getTranslation(decodedQueryParams) );
} catch ( Exception e) {
throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST,
"Unable to translate text. Check parameters.", e);
}
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@Override
public Representation handle() {
if (!this.directoryRedirection) {
return super.handle();
}
// detected a directory, but the current reference lacks the trailing "/", let's redirect.
Reference directoryReference = (this.originalRef != null) ? this.originalRef : getReference().getTargetRef();
if (directoryReference.hasQuery()) {
redirectSeeOther(directoryReference.toString(false, false) + "/?" + directoryReference.getQuery());
} else {
redirectSeeOther(directoryReference.toString(false, false) + "/");
}
return null;
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
/**
* @param ref
* @param b
* @return
* @throws IllegalArgumentException
*/
private UriBuilder fillUriBuilder(Reference ref, final UriBuilder b)
throws IllegalArgumentException {
b.scheme(ref.getScheme(false));
b.userInfo(ref.getUserInfo(false));
b.host(ref.getHostDomain(false));
b.port(ref.getHostPort());
b.path(ref.getPath(false));
b.replaceQuery(ref.getQuery(false));
b.fragment(ref.getFragment(false));
return b;
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!