Examples of InputRepresentation


Examples of org.restlet.representation.InputRepresentation

            } else if (Form.class.isAssignableFrom(target)) {
                result = new Form(source);
            } else if (InputStream.class.isAssignableFrom(target)) {
                result = source.getStream();
            } else if (InputRepresentation.class.isAssignableFrom(target)) {
                result = new InputRepresentation(source.getStream());
            } else if (Reader.class.isAssignableFrom(target)) {
                result = source.getReader();
            } else if (ReaderRepresentation.class.isAssignableFrom(target)) {
                result = new ReaderRepresentation(source.getReader());
            } else if (Serializable.class.isAssignableFrom(target)
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

                    MediaType.getMostSpecific(target.getMediaType(),
                            MediaType.APPLICATION_OCTET_STREAM));
        } else if (source instanceof Form) {
            result = ((Form) source).getWebRepresentation();
        } else if (source instanceof InputStream) {
            result = new InputRepresentation((InputStream) source,
                    MediaType.getMostSpecific(target.getMediaType(),
                            MediaType.APPLICATION_OCTET_STREAM));
        } else if (source instanceof Reader) {
            result = new ReaderRepresentation((Reader) source,
                    MediaType.getMostSpecific(target.getMediaType(),
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

        String s = buf.toString();
        Reader r = new StringReader(s);
        InputStream is = new ReaderInputStream(r);

        InputRepresentation ir = new InputRepresentation(is);
        ir.setCharacterSet(CharacterSet.ISO_8859_1);

        assertEquals("Value", s, ir.getText());
    }
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

                }
            }

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

                    // Update the expiration date
                    long timeToLive = getTimeToLive();

                    if (timeToLive == 0) {
                        output.setExpirationDate(null);
                    } else if (timeToLive > 0) {
                        output.setExpirationDate(new Date(System
                                .currentTimeMillis()
                                + (1000L * timeToLive)));
                    }

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

Examples of org.restlet.representation.InputRepresentation

     * @param stream
     *            The response input stream.
     * @return The wrapping representation.
     */
    protected Representation getRepresentation(InputStream stream) {
        return new InputRepresentation(stream, null);
    }
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

                    }

                    connection
                            .setAllowUserInteraction(isAllowUserInteraction());
                    connection.setUseCaches(isUseCaches());
                    response.setEntity(new InputRepresentation(connection
                            .getInputStream()));

                    // Try to infer the metadata from the file extensions
                    Entity.updateMetadata(request.getResourceRef().getPath(),
                            response.getEntity(), true, getMetadataService());
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

                    getLogger().fine("Unable to read request entity");
                }
            }

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

Examples of org.restlet.representation.InputRepresentation

                try {
                    FileRepresentation fr = new FileRepresentation(
                            "file:///c:/TEST/restlet-jse-2.0.5-ff.zip",
                            MediaType.APPLICATION_ZIP);
                    System.out.println("Size sent: " + fr.getSize());
                    InputRepresentation ir = new InputRepresentation(
                            fr.getStream(), fr.getMediaType());
                    response.setEntity(ir);
                } catch (IOException e) {
                    e.printStackTrace();
                }
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

        ClientResource resource = new ClientResource("http://localhost:8554/");
        FileRepresentation fr = new FileRepresentation("file:///c:/test.mpg",
                MediaType.VIDEO_MPEG);
        System.out.println("Size sent: " + fr.getSize());
        InputRepresentation ir = new InputRepresentation(fr.getStream(), fr
                .getMediaType());

        try {
            resource.post(ir);
        } catch (ResourceException e) {
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

    public void testValidateMethod() {
        System.out.println("-- testValidateMethod");
        InputStream is = getClass().getResourceAsStream(
                "/org/restlet/Component.xsd");
        assertNotNull("Component.xsd stream MUST NOT be null", is);
        Representation schemaRepresentation = new InputRepresentation(is,
                MediaType.APPLICATION_W3C_SCHEMA);

        DomRepresentation configRepresentation = new DomRepresentation(
                new StringRepresentation(XML_WITH_XMLNS));
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.