Examples of InputRepresentation


Examples of org.restlet.representation.InputRepresentation

            response.setEntity("", MediaType.TEXT_PLAIN);
        } else if (body instanceof Response) {
            // its already a restlet response, so dont do anything
            LOG.debug("Using existing Restlet Response from exchange body: {}", body);
        } else if (body instanceof InputStream) {
            response.setEntity(new InputRepresentation(out.getBody(InputStream.class), mediaType));
        } else if (body instanceof File) {
            response.setEntity(new FileRepresentation(out.getBody(File.class), mediaType));
        } else {
            // fallback and use string
            String text = out.getBody(String.class);
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

                    image[i] = (byte)(i + 1);
                }
                ByteArrayInputStream inputStream = new ByteArrayInputStream(image);

                from("restlet:http://0.0.0.0:" + portNum + "/images/{symbol}?restletMethods=get")
                    .setBody().constant(new InputRepresentation(inputStream, MediaType.IMAGE_PNG, 10));
            }
        };
    }
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

            // its already a restlet response, so dont do anything
            LOG.debug("Using existing Restlet Response from exchange body: {}", body);
        } else if (body instanceof Representation) {
            response.setEntity(out.getBody(Representation.class));
        } else if (body instanceof InputStream) {
            response.setEntity(new InputRepresentation(out.getBody(InputStream.class), mediaType));
        } else if (body instanceof File) {
            response.setEntity(new FileRepresentation(out.getBody(File.class), mediaType));
        } else {
            // fallback and use string
            String text = out.getBody(String.class);
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

            response.setEntity("", MediaType.TEXT_PLAIN);
        } else if (body instanceof Response) {
            // its already a restlet response, so dont do anything
            LOG.debug("Using existing Restlet Response from exchange body: {}", body);
        } else if (body instanceof InputStream) {
            response.setEntity(new InputRepresentation(out.getBody(InputStream.class), mediaType));
        } else if (body instanceof File) {
            response.setEntity(new FileRepresentation(out.getBody(File.class), mediaType));
        } else {
            // fallback and use string
            String text = out.getBody(String.class);
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

        {
            // TODO There's probably a helper somewhere that can do this more nicely
            if( getRequest().getOriginalRef().getLastSegment().equals( "sparqlhtml.xsl" ) )
            {
                InputStream resourceAsStream = getClass().getResourceAsStream( "sparqlhtml.xsl" );
                return new InputRepresentation( resourceAsStream, MediaType.TEXT_XML );
            }

            Form form;
            if( getRequest().getMethod().equals( Method.POST ) )
            {
                form = new Form(getRequest().getEntity());
            }
            else
            {
                form = getRequest().getResourceRef().getQueryAsForm();
            }

            final RepositoryConnection conn = repository.getConnection();

            String queryStr = form.getFirstValue( "query" );

            if( queryStr == null )
            {
                InputStream resourceAsStream = getClass().getResourceAsStream( "sparqlform.html" );
                return new InputRepresentation( resourceAsStream, MediaType.TEXT_HTML );
            }

            Query query = getQuery( repository, conn, queryStr );

            if( query instanceof TupleQuery )
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

            // its already a restlet response, so dont do anything
            LOG.debug("Using existing Restlet Response from exchange body: {}", body);
        } else if (body instanceof Representation) {
            response.setEntity(out.getBody(Representation.class));
        } else if (body instanceof InputStream) {
            response.setEntity(new InputRepresentation(out.getBody(InputStream.class), mediaType));
        } else if (body instanceof File) {
            response.setEntity(new FileRepresentation(out.getBody(File.class), mediaType));
        } else {
            // fallback and use string
            String text = out.getBody(String.class);
View Full Code Here

Examples of org.restlet.representation.InputRepresentation

            response.setEntity("", MediaType.TEXT_PLAIN);
        } else if (body instanceof Response) {
            // its already a restlet response, so dont do anything
            LOG.debug("Using existing Restlet Response from exchange body: {}", body);
        } else if (body instanceof InputStream) {
            response.setEntity(new InputRepresentation(out.getBody(InputStream.class), mediaType));
        } else if (body instanceof File) {
            response.setEntity(new FileRepresentation(out.getBody(File.class), mediaType));
        } else {
            // fallback and use string
            String text = out.getBody(String.class);
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

    @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

                    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);
                    response.setEntity(output);
                    response.setStatus(Status.SUCCESS_OK);
                }
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.