Package org.restlet.resource

Examples of org.restlet.resource.StreamRepresentation


                    || request.getMethod().equals(Method.POST)) {
                //connection.setDoOutput(true);
                copyStream(request.getEntity().getStream(), connection.getOutputStream());
            }
               
            response.setEntity(new StreamRepresentation(new MediaType(connection
                    .getContentType())) {
                @Override
                public void write(OutputStream out) throws IOException {
                    copyStream(connection.getInputStream(), out);
                }
View Full Code Here


        router.attach("/", new Restlet() {

            @Override
            public void handle(Request request, Response response)
            {
                response.setEntity(new StreamRepresentation(MediaType.TEXT_HTML) {
                   
                    @Override
                    public InputStream getStream() throws IOException
                    {                   
                        return null;
View Full Code Here

            } else {
                resourceName = res;
            }
        }
        MediaType mediaType = guessMediaType(resourceName);
        getResponse().setEntity(new StreamRepresentation(mediaType) {

            @Override
            public void write(OutputStream outputStream) throws IOException {
                // System.out.println("returning " + resourceName);
                ByteStreams.copy(getStream(), outputStream);
View Full Code Here

            if (checkPermission(resolved, connection.getContentType()) != true) {
                throw new RestletException("Request for nonpermitted content type or hostname",
                        Status.CLIENT_ERROR_BAD_REQUEST);
            }
               
            response.setEntity(new StreamRepresentation(new MediaType(connection
                    .getContentType())) {
                @Override
                public void write(OutputStream out) throws IOException {
                    copyStream(connection.getInputStream(), out);
                }
View Full Code Here

TOP

Related Classes of org.restlet.resource.StreamRepresentation

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.