/** * 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); }
/** * 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); }
/** * 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); }
/** * Indicates if this reference has a matrix. * * @return True if there is a matrix. * @see #getMatrix() */ public boolean hasMatrix() { return (getLastSegment().indexOf(';') != -1); }
/** * Indicates if this reference has a matrix. * * @return True if there is a matrix. * @see #getMatrix() */ public boolean hasMatrix() { return (getLastSegment().indexOf(';') != -1); }
/** * Indicates if this reference has a matrix. * * @return True if there is a matrix. * @see #getMatrix() */ public boolean hasMatrix() { return (getLastSegment().indexOf(';') != -1); }
/** * 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; }
/** * 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; }
/** * Determines the upload method from a request. */ protected String getUploadMethod(Request request) { return ((String) request.getResourceRef().getLastSegment()).toLowerCase(); }
/** * 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; }
/** * 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; }
/** * 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; }
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()); } };
private String getUsecaseName( Request request ) { if( request.getMethod().equals( org.restlet.data.Method.DELETE ) ) { return "delete"; } else { return request.getResourceRef().getLastSegment(); } }
private String getUsecaseName( Request request ) { if( request.getMethod().equals( org.restlet.data.Method.DELETE ) ) { return "delete"; } else { return request.getResourceRef().getLastSegment(); } }
private String getUsecaseName( Request request ) { if( request.getMethod().equals( org.restlet.data.Method.DELETE ) ) { return "delete"; } else { return request.getResourceRef().getLastSegment(); } }
@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); } } }
@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); }
@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); }
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()); } }