Package org.restlet.data

Examples of org.restlet.data.ReferenceList


            results.addAll(resultSet);

            if (resultSet.isEmpty()) {
                if (this.directoryTarget && getDirectory().isListingAllowed()) {
                    final ReferenceList userList = new ReferenceList(
                            this.directoryContent.size());
                    // Set the list identifier
                    userList.setIdentifier(baseRef);

                    final SortedSet<Reference> sortedSet = new TreeSet<Reference>(
                            getDirectory().getComparator());
                    sortedSet.addAll(this.directoryContent);

                    for (final Reference ref : sortedSet) {
                        final String filePart = ref.toString(false, false)
                                .substring(rootLength);
                        final StringBuilder filePath = new StringBuilder();
                        if ((!baseRef.endsWith("/"))
                                && (!filePart.startsWith("/"))) {
                            filePath.append('/');
                        }
                        filePath.append(filePart);
                        userList.add(baseRef + filePath);
                    }
                    final List<Variant> list = getDirectory().getIndexVariants(
                            userList);
                    for (final Variant variant : list) {
                        results.add(getDirectory().getIndexRepresentation(
View Full Code Here


     *
     * @return The list of variants references
     */
    private ReferenceList getVariantsReferences() {
        this.uniqueReference = null;
        final ReferenceList result = new ReferenceList(0);
        try {
            final Request contextCall = new Request(Method.GET, this.targetUri);
            // Ask for the list of all variants of this resource
            contextCall.getClientInfo().getAcceptedMediaTypes().add(
                    new Preference<MediaType>(MediaType.TEXT_URI_LIST));
            final Response contextResponse = getClientDispatcher().handle(
                    contextCall);
            if (contextResponse.getEntity() != null) {
                // Test if the given response is the list of all variants for
                // this resource
                if (MediaType.TEXT_URI_LIST.equals(contextResponse.getEntity()
                        .getMediaType())) {
                    final ReferenceList listVariants = new ReferenceList(
                            contextResponse.getEntity());
                    Set<String> extensions = null;
                    String entryUri;
                    String fullEntryName;
                    String baseEntryName;
View Full Code Here

                getClientDispatcher().handle(contextRequest, contextResponse);
            } else {
                // Check if there is only one representation

                // Try to get the unique representation of the resource
                final ReferenceList references = getVariantsReferences();
                if (!references.isEmpty()) {
                    if (this.uniqueReference != null) {
                        contextRequest.setResourceRef(this.uniqueReference);
                        getClientDispatcher().handle(contextRequest,
                                contextResponse);
                    } else {
View Full Code Here

TOP

Related Classes of org.restlet.data.ReferenceList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.