本文整理了Java中org.restlet.data.Reference.getLastSegment
方法的一些代码示例,展示了Reference.getLastSegment
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getLastSegment
方法的具体详情如下:
包路径:org.restlet.data.Reference
类名称:Reference
方法名:getLastSegment
[英]Returns the last segment of a hierarchical path.
For example the "/a/b/c" and "/a/b/c/" paths have the same segments: "a", "b", "c.
Note that no URI decoding is done by this method.
[中]返回分层路径的最后一段。
例如“/a/b/c”和“/a/b/c/”路径具有相同的段:“a”、“b”、“c”。
请注意,此方法不会执行URI解码。
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the optionnally decoded last segment.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @return The optionnally decoded last segment.
* @see #getLastSegment()
*/
public String getLastSegment(boolean decode) {
return getLastSegment(decode, false);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optionnally decoded last segment.
*
* @param decode
* Indicates if the result should be decoded using the {@link #decode(String)} method.
* @return The optionnally decoded last segment.
* @see #getLastSegment()
*/
public String getLastSegment(boolean decode) {
return getLastSegment(decode, false);
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the optionnally decoded last segment.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @return The optionnally decoded last segment.
* @see #getLastSegment()
*/
public String getLastSegment(boolean decode) {
return getLastSegment(decode, false);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Indicates if this reference has a matrix.
*
* @return True if there is a matrix.
* @see #getMatrix()
*/
public boolean hasMatrix() {
return (getLastSegment().indexOf(';') != -1);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Indicates if this reference has a matrix.
*
* @return True if there is a matrix.
* @see #getMatrix()
*/
public boolean hasMatrix() {
return (getLastSegment().indexOf(';') != -1);
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Indicates if this reference has a matrix.
*
* @return True if there is a matrix.
* @see #getMatrix()
*/
public boolean hasMatrix() {
return (getLastSegment().indexOf(';') != -1);
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the optional matrix for hierarchical identifiers. A matrix part
* starts after the first ';' character of the last path segment. It is a
* sequence of 'name=value' parameters separated by ';' characters. The
* value can be ommited.<br>
* Note that no URI decoding is done by this method.
*
* @return The matrix or null.
*/
public String getMatrix() {
final String lastSegment = getLastSegment();
if (lastSegment != null) {
final int matrixIndex = lastSegment.indexOf(';');
if (matrixIndex != -1) {
return lastSegment.substring(matrixIndex + 1);
}
}
// No matrix found
return null;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optional matrix for hierarchical identifiers. A matrix part
* starts after the first ';' character of the last path segment. It is a
* sequence of 'name=value' parameters separated by ';' characters. The
* value can be ommitted.<br>
* Note that no URI decoding is done by this method.
*
* @return The matrix or null.
*/
public String getMatrix() {
String lastSegment = getLastSegment();
if (lastSegment != null) {
final int matrixIndex = lastSegment.indexOf(';');
if (matrixIndex != -1) {
return lastSegment.substring(matrixIndex + 1);
}
}
// No matrix found
return null;
}
代码示例来源:origin: org.geoserver/restconfig
/**
* Determines the upload method from a request.
*/
protected String getUploadMethod(Request request) {
return ((String) request.getResourceRef().getLastSegment()).toLowerCase();
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the optionnally decoded last segment.
*
* @param decode
* Indicates if the result should be decoded using the {@link #decode(String)} method.
* @param excludeMatrix
* @return The optionnally decoded last segment.
* @see #getLastSegment()
*/
public String getLastSegment(boolean decode, boolean excludeMatrix) {
String result = getLastSegment();
if (excludeMatrix && (result != null)) {
final int matrixIndex = result.indexOf(';');
if (matrixIndex != -1) {
result = result.substring(0, matrixIndex);
}
}
return decode ? decode(result) : result;
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Returns the optionnally decoded last segment.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @param excludeMatrix
* @return The optionnally decoded last segment.
* @see #getLastSegment()
*/
public String getLastSegment(boolean decode, boolean excludeMatrix) {
String result = getLastSegment();
if (excludeMatrix && (result != null)) {
final int matrixIndex = result.indexOf(';');
if (matrixIndex != -1) {
result = result.substring(0, matrixIndex);
}
}
return decode ? decode(result) : result;
}
代码示例来源:origin: DeviceConnect/DeviceConnect-Android
/**
* Returns the optionnally decoded last segment.
*
* @param decode
* Indicates if the result should be decoded using the
* {@link #decode(String)} method.
* @param excludeMatrix
* @return The optionnally decoded last segment.
* @see #getLastSegment()
*/
public String getLastSegment(boolean decode, boolean excludeMatrix) {
String result = getLastSegment();
if (excludeMatrix && (result != null)) {
final int matrixIndex = result.indexOf(';');
if (matrixIndex != -1) {
result = result.substring(0, matrixIndex);
}
}
return decode ? decode(result) : result;
}
代码示例来源:origin: org.restlet.osgi/org.restlet
public int compare(Representation rep0, Representation rep1) {
boolean bRep0Null = (rep0.getLocationRef() == null);
boolean bRep1Null = (rep1.getLocationRef() == null);
if (bRep0Null && bRep1Null) {
return 0;
}
if (bRep0Null) {
return -1;
}
if (bRep1Null) {
return 1;
}
return rep0.getLocationRef().getLastSegment()
.compareTo(rep1.getLocationRef().getLastSegment());
}
};
代码示例来源:origin: org.qi4j.library/org.qi4j.library.rest-server
private String getUsecaseName( Request request )
{
if( request.getMethod().equals( org.restlet.data.Method.DELETE ) )
{
return "delete";
}
else
{
return request.getResourceRef().getLastSegment();
}
}
代码示例来源:origin: apache/attic-polygene-java
private String getUsecaseName( Request request )
{
if( request.getMethod().equals( org.restlet.data.Method.DELETE ) )
{
return "delete";
}
else
{
return request.getResourceRef().getLastSegment();
}
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.rest-server
private String getUsecaseName( Request request )
{
if( request.getMethod().equals( org.restlet.data.Method.DELETE ) )
{
return "delete";
}
else
{
return request.getResourceRef().getLastSegment();
}
}
代码示例来源:origin: org.geoserver/restconfig
@Override
public Resource findTarget(Request request, Response response) {
if (request.getResourceRef().getLastSegment().endsWith(".ftl")) {
return new FreemarkerTemplateResource(request, response, catalog);
} else {
return new FreemarkerTemplateListResource(getContext(), request, response, catalog);
}
}
}
代码示例来源:origin: saleemshafi/nexus-artifact-usage-plugin
@Override
public Object get(Context context, Request request, Response response,
Variant variant) throws ResourceException {
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"getting usage of "
+ request.getResourceRef().getLastSegment());
}
Collection<ArtifactUser> artifactList = artifactUsageStore
.getArtifactUsers(new GAV(request.getResourceRef()
.getLastSegment()));
// limiting depth of the data to n levels so that we don't stall out
String jsonText = "{" + ArtifactUsageSerializer.toJson(artifactList, 5)
+ "}";
return new StringRepresentation(jsonText, MediaType.APPLICATION_JSON);
}
代码示例来源:origin: saleemshafi/nexus-artifact-usage-plugin
@Override
public Object get(Context context, Request request, Response response,
Variant variant) throws ResourceException {
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"getting usage of "
+ request.getResourceRef().getLastSegment());
}
Collection<ArtifactUser> artifactList = artifactUsageStore
.getArtifactUsers(new GAV(request.getResourceRef()
.getLastSegment()));
Set<GAV> artifacts = new TreeSet<GAV>();
collectArtifacts(artifacts, artifactList);
String jsonText = "{" + ArtifactUsageSerializer.toJson(artifacts) + "}";
return new StringRepresentation(jsonText, MediaType.APPLICATION_JSON);
}
代码示例来源:origin: ontopia/ontopia
protected void redirectTo(TMO object) {
Reference baseRef = getRequest().getResourceRef().getBaseRef();
if (!baseRef.getLastSegment().endsWith("/")) {
baseRef = new Reference(baseRef.toString() + "/");
}
// todo: maybe this should be '302 Found' instead
redirectSeeOther(new Reference(baseRef, object.getObjectId()).getTargetRef());
}
}
内容来源于网络,如有侵权,请联系作者删除!