Package org.restlet.representation

Examples of org.restlet.representation.Variant


    public static class GetTestResource extends ServerResource {

        public GetTestResource() {

            getVariants().add(new Variant(MediaType.TEXT_PLAIN));
        }
View Full Code Here


*/
public class SslClientContextGetTestCase extends SslBaseConnectorsTestCase {
    public static class GetTestResource extends ServerResource {

        public GetTestResource() {
            getVariants().add(new Variant(MediaType.TEXT_PLAIN));
        }
View Full Code Here

     * Test resource that answers to PUT requests by sending back the received
     * entity.
     */
    public static class PutTestResource extends ServerResource {
        public PutTestResource() {
            getVariants().add(new Variant(MediaType.TEXT_PLAIN));
            setNegotiated(false);
        }
View Full Code Here

        this.password = (cr != null) ? new String(cr.getSecret()) : null;
        this.user = findUser();

        if (this.user != null) {
            this.variants = new ArrayList<Variant>();
            this.variants.add(new Variant(MediaType.TEXT_PLAIN));
        }

        modifiable = true;
    }
View Full Code Here

    @Override
    public void doInit() {
        super.doInit();
        getVariants().clear();
        if (getUser() != null) {
            getVariants().add(new Variant(MediaType.TEXT_HTML));
        }
    }
View Full Code Here

public class GetChunkedTestCase extends BaseConnectorsTestCase {

    public static class GetChunkedTestResource extends ServerResource {

        public GetChunkedTestResource() {
            getVariants().add(new Variant(MediaType.TEXT_PLAIN));
        }
View Full Code Here

     *            The list of references contained in the directory index.
     * @return The variant representations of a directory.
     */
    public List<Variant> getIndexVariants(ReferenceList indexContent) {
        final List<Variant> result = new ArrayList<Variant>();
        result.add(new Variant(MediaType.TEXT_HTML));
        result.add(new Variant(MediaType.TEXT_URI_LIST));
        return result;
    }
View Full Code Here

     */
    protected Representation doNegotiatedHandle() throws ResourceException {
        Representation result = null;

        if ((getVariants() != null) && (!getVariants().isEmpty())) {
            Variant preferredVariant = getClientInfo().getPreferredVariant(
                    getVariants(), getMetadataService());

            if (preferredVariant == null) {
                // No variant was found matching the client preferences
                doError(Status.CLIENT_ERROR_NOT_ACCEPTABLE);
View Full Code Here

     * @param variants
     *            The available variants.
     * @return The preferred variant.
     */
    protected Variant getPreferredVariant(List<Variant> variants) {
        Variant result = null;

        // If variants were found, select the best matching one
        if ((variants != null) && (!variants.isEmpty())) {
            result = getClientInfo().getPreferredVariant(
                    variants,
View Full Code Here

     * specified in the request.
     *
     * @return The preferred WADL variant.
     */
    protected Variant getPreferredWadlVariant() {
        Variant result = null;

        // Compute the preferred variant
        result = getRequest().getClientInfo().getPreferredVariant(
                getWadlVariants(),
                (getApplication() == null) ? null : getApplication()
View Full Code Here

TOP

Related Classes of org.restlet.representation.Variant

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.