Package org.restlet.resource

Examples of org.restlet.resource.InputRepresentation


                }
            }

            if (url != null) {
                try {
                    final Representation output = new InputRepresentation(url
                            .openStream(), metadataService
                            .getDefaultMediaType());
                    output.setIdentifier(request.getResourceRef());
                    output.setModificationDate(modificationDate);

                    // Update the expiration date
                    long timeToLive = getTimeToLive();
                    if (timeToLive == 0) {
                        output.setExpirationDate(new Date());
                    } else if (timeToLive > 0) {
                        output.setExpirationDate(new Date(System
                                .currentTimeMillis()
                                + (1000L * timeToLive)));
                    }

                    // Update the metadata based on file extensions
View Full Code Here


                }
            }

            if (url != null) {
                try {
                    final Representation output = new InputRepresentation(url
                            .openStream(), metadataService
                            .getDefaultMediaType());
                    output.setIdentifier(request.getResourceRef());
                    output.setModificationDate(modificationDate);

                    // Update the metadata based on file extensions
                    final String name = path
                            .substring(path.lastIndexOf('/') + 1);
                    updateMetadata(metadataService, name, output);
View Full Code Here

                    response.setEntity(rl.getTextRepresentation());
                    response.setStatus(Status.SUCCESS_OK);
                } else {
                    // Return the file content
                    Representation output = new InputRepresentation(war
                            .getInputStream(entry), null);
                    updateMetadata(getMetadataService(request), path, output);
                    output.setIdentifier(request.getResourceRef());
                    response.setEntity(output);
                    response.setStatus(Status.SUCCESS_OK);
                }
            } catch (IOException e) {
                getLogger().log(Level.WARNING,
View Full Code Here

                }
            }

            if (url != null) {
                try {
                    Representation output = new InputRepresentation(url
                            .openStream(), metadataService
                            .getDefaultMediaType());
                    output.setIdentifier(request.getResourceRef());

                    // Update the metadata based on file extensions
                    String name = path.substring(path.lastIndexOf('/') + 1);
                    updateMetadata(metadataService, name, output);
View Full Code Here

            // Extract the header values
            MediaType contentMediaType = null;
            long contentLength = Representation.UNKNOWN_SIZE;

            if (requestStream != null) {
                result = new InputRepresentation(requestStream,
                        contentMediaType, contentLength);
            } else {
                result = new ReadableRepresentation(requestChannel,
                        contentMediaType, contentLength);
            }
View Full Code Here

    protected Request newRequestPOST(String path, String body, String contentType) {
        Request request = new Request();
        request.setMethod( Method.POST );
        request.setResourceRef( "http://localhost/" + path );
        request.setEntity(
            new InputRepresentation( new ByteArrayInputStream( body.getBytes() ), new MediaType( contentType ) )
        );
        return request;
    }
View Full Code Here

TOP

Related Classes of org.restlet.resource.InputRepresentation

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.