/** * Returns the optional query component for hierarchical identifiers.<br> * Note that no URI decoding is done by this method. * * @return The query component or null. */ public String getQuery() { if (hasQuery()) { // Query found if (hasFragment()) { if (this.queryIndex < this.fragmentIndex) { // Fragment found and query sign not inside fragment return this.internalRef.substring(this.queryIndex + 1, this.fragmentIndex); } return null; } // No fragment found return this.internalRef.substring(this.queryIndex + 1); } // No query found return null; }
/** * Returns the optional query component for hierarchical identifiers.<br> * Note that no URI decoding is done by this method. * * @return The query component or null. */ public String getQuery() { if (hasQuery()) { // Query found if (hasFragment()) { if (this.queryIndex < this.fragmentIndex) { // Fragment found and query sign not inside fragment return this.internalRef.substring(this.queryIndex + 1, this.fragmentIndex); } return null; } // No fragment found return this.internalRef.substring(this.queryIndex + 1); } // No query found return null; }
/** * Returns the optional query component for hierarchical identifiers.<br> * Note that no URI decoding is done by this method. * * @return The query component or null. */ public String getQuery() { if (hasQuery()) { // Query found if (hasFragment()) { if (this.queryIndex < this.fragmentIndex) { // Fragment found and query sign not inside fragment return this.internalRef.substring(this.queryIndex + 1, this.fragmentIndex); } return null; } // No fragment found return this.internalRef.substring(this.queryIndex + 1); } // No query found return null; }
if (hasQuery() && hasFragment() && (this.queryIndex > this.fragmentIndex)) {
final boolean emptyQueryString = ((query == null) || (query.length() <= 0)); if (hasQuery()) {
/** * Sets the relative part for relative references only. * * @param relativePart * The relative part to set. */ public void setRelativePart(String relativePart) { relativePart = encodeInvalidCharacters(relativePart); if (relativePart == null) { relativePart = ""; } if (!hasScheme()) { // This is a relative reference, no scheme found if (hasQuery()) { // Query found this.internalRef = relativePart + this.internalRef.substring(this.queryIndex); } else if (hasFragment()) { // Fragment found this.internalRef = relativePart + this.internalRef.substring(this.fragmentIndex); } else { // No fragment found this.internalRef = relativePart; } } updateIndexes(); }
/** * Sets the relative part for relative references only. * * @param relativePart * The relative part to set. */ public void setRelativePart(String relativePart) { relativePart = encodeInvalidCharacters(relativePart); if (relativePart == null) { relativePart = ""; } if (!hasScheme()) { // This is a relative reference, no scheme found if (hasQuery()) { // Query found this.internalRef = relativePart + this.internalRef.substring(this.queryIndex); } else if (hasFragment()) { // Fragment found this.internalRef = relativePart + this.internalRef.substring(this.fragmentIndex); } else { // No fragment found this.internalRef = relativePart; } } updateIndexes(); }
/** * Sets the relative part for relative references only. * * @param relativePart * The relative part to set. */ public void setRelativePart(String relativePart) { relativePart = encodeInvalidCharacters(relativePart); if (relativePart == null) { relativePart = ""; } if (!hasScheme()) { // This is a relative reference, no scheme found if (hasQuery()) { // Query found this.internalRef = relativePart + this.internalRef.substring(this.queryIndex); } else if (hasFragment()) { // Fragment found this.internalRef = relativePart + this.internalRef.substring(this.fragmentIndex); } else { // No fragment found this.internalRef = relativePart; } } updateIndexes(); }
/** * Returns the request URI. * * @param resourceRef * The resource reference. * @param isProxied * Indicates if the request goes through a proxy and requires an * absolute URI. * @param request * The parent request. * @return The absolute request URI. */ public static String format(Reference resourceRef, boolean isProxied, Request request) { String result = null; Reference requestRef = update(resourceRef, request); if (isProxied) { result = requestRef.getIdentifier(); } else { if (requestRef.hasQuery()) { result = requestRef.getPath() + "?" + requestRef.getQuery(); } else { result = requestRef.getPath(); } if ((result == null) || (result.equals(""))) { result = "/"; } } return result; }
if ( getRequest().getResourceRef().hasQuery() ) {
@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; }
if (getTarget().getOriginalRef().hasQuery()) { params.putAll( getTarget().getOriginalRef().getQueryAsForm(true).getValuesMap()