Examples of InputRepresentation


Examples of org.restlet.resource.InputRepresentation

                }
            }

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

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

Examples of org.restlet.resource.InputRepresentation

    @Override
    public Representation getRepresentation(MediaType defaultMediaType,
            int timeToLive) {
        final InputStream ris = getServletContext().getResourceAsStream(path);
        return (ris == null) ? null : new InputRepresentation(ris,
                defaultMediaType);
    }
View Full Code Here

Examples of org.restlet.resource.InputRepresentation

    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

Examples of org.restlet.resource.InputRepresentation

                    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

Examples of org.restlet.resource.InputRepresentation

                }
            }

            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

Examples of org.restlet.resource.InputRepresentation

     */
    public Representation getResponseEntity() {
        Representation result = null;

        if (getResponseStream() != null) {
            result = new InputRepresentation(getResponseStream(), null);
        } else if (getResponseChannel() != null) {
            result = new ReadableRepresentation(getResponseChannel(), null);
        } else if (getMethod().equals(Method.HEAD.getName())) {
            result = new Representation() {
                @Override
View Full Code Here

Examples of org.restlet.resource.InputRepresentation

            // 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

Examples of org.restlet.resource.InputRepresentation

                // Return the entry content
                MetadataService metadataService = getMetadataService(request);
                InputStream ris = getServletContext().getResourceAsStream(
                        basePath);
                if (ris != null) {
                    output = new InputRepresentation(ris, metadataService
                            .getDefaultMediaType());
                    output.setIdentifier(request.getResourceRef());
                    updateMetadata(metadataService, entry, output);

                    // See if the Servlet context specified a particular Mime
View Full Code Here

Examples of org.restlet.resource.InputRepresentation

     */
    public Representation getResponseEntity() {
        Representation result = null;

        if (getResponseStream() != null) {
            result = new InputRepresentation(getResponseStream(), null);
        } else if (getResponseChannel() != null) {
            result = new ReadableRepresentation(getResponseChannel(), null);
        } else if (getMethod().equals(Method.HEAD.getName())) {
            result = new Representation() {
                @Override
View Full Code Here

Examples of org.restlet.resource.InputRepresentation

            int timeToLive) {
        Representation result = null;

        InputStream ris = getServletContext().getResourceAsStream(path);
        if (ris != null) {
            result = new InputRepresentation(ris, defaultMediaType);
            // Sets the modification date
            String realPath = getServletContext().getRealPath(path);
            if (realPath != null) {
                File file = new File(realPath);
                if (file != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.