Examples of WriterRepresentation


Examples of org.restlet.representation.WriterRepresentation

        return new StringRepresentation( result.toString(), MediaType.APPLICATION_JSON );
    }

    private Representation createTextHtmlRepresentation( final Object result, final Response response )
    {
        return new WriterRepresentation( MediaType.TEXT_HTML )
                    {
                        @Override
                        public void write( Writer writer )
                            throws IOException
                        {
View Full Code Here

Examples of org.restlet.representation.WriterRepresentation

                    };
    }

    private Representation createAtomRepresentation( final Object result, final Response response )
    {
        return new WriterRepresentation( MediaType.APPLICATION_ATOM )
        {
            @Override
            public void write( Writer writer )
                throws IOException
            {
View Full Code Here

Examples of org.restlet.representation.WriterRepresentation

                return true;
            }
            else if( MediaType.TEXT_HTML.equals( type ) )
            {
                Representation rep = new WriterRepresentation( MediaType.TEXT_HTML )
                {
                    @Override
                    public void write( Writer writer )
                        throws IOException
                    {
View Full Code Here

Examples of org.restlet.representation.WriterRepresentation

                response.setEntity( new StringRepresentation( resourceValue.toString(), MediaType.APPLICATION_JSON ) );
                return true;
            }
            else if( MediaType.TEXT_HTML.equals( type ) )
            {
                Representation rep = new WriterRepresentation( MediaType.TEXT_HTML )
                {
                    @Override
                    public void write( Writer writer )
                        throws IOException
                    {
View Full Code Here

Examples of org.restlet.resource.WriterRepresentation

    }
   
    public Representation represent(Variant variant) throws ResourceException {
        Representation representation;
        if (variant.getMediaType() == MediaType.APPLICATION_XML) {
            representation = new WriterRepresentation(MediaType.APPLICATION_XML) {
                public void write(Writer writer) throws IOException {
                    XmlMarshaller.marshalDocument(writer,"script", makeDataModel());
                }
            };
        } else {
            representation = new WriterRepresentation(MediaType.TEXT_HTML) {
                public void write(Writer writer) throws IOException {
                    ScriptResource.this.writeHtml(writer);
                }
            };
        }
View Full Code Here

Examples of org.restlet.resource.WriterRepresentation

            throw new ResourceException(404);
        }

        Representation representation;
        if (variant.getMediaType() == MediaType.APPLICATION_XML) {
            representation = new WriterRepresentation(MediaType.APPLICATION_XML) {
                public void write(Writer writer) throws IOException {
                    XmlMarshaller.marshalDocument(writer, "beans", makeDataModel());
                }
            };
        } else {
            representation = new WriterRepresentation(
                    MediaType.TEXT_HTML) {
                public void write(Writer writer) throws IOException {
                    BeanBrowseResource.this.writeHtml(writer);
                }
            };
View Full Code Here

Examples of org.restlet.resource.WriterRepresentation

            throw new ResourceException(404);
        }

        Representation representation = null;
        if (variant.getMediaType() == MediaType.APPLICATION_XML) {
            representation = new WriterRepresentation(MediaType.APPLICATION_XML) {
                public void write(Writer writer) throws IOException {
                    CrawlJobModel model = makeDataModel();
                    model.put("heapReport", getEngine().heapReportData());
                    XmlMarshaller.marshalDocument(writer, "job", model);
                }
            };
        } else {
            representation = new WriterRepresentation(MediaType.TEXT_HTML) {
                public void write(Writer writer) throws IOException {
                    JobResource.this.writeHtml(writer);
                }
            };
        }
View Full Code Here

Examples of org.restlet.resource.WriterRepresentation

        return _templateConfiguration;
    }
    public Representation represent(Variant variant) throws ResourceException {
        Representation representation;
        if (variant.getMediaType() == MediaType.APPLICATION_XML) {
            representation = new WriterRepresentation(MediaType.APPLICATION_XML) {
                public void write(Writer writer) throws IOException {
                    XmlMarshaller.marshalDocument(writer, "engine", makeDataModel());
                }
            };
        } else {
            representation = new WriterRepresentation(MediaType.TEXT_HTML) {
                public void write(Writer writer) throws IOException {
                    EngineResource.this.writeHtml(writer);
                }
            };
        }
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.