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); } }; } // TODO: remove if not necessary in future? representation.setCharacterSet(CharacterSet.UTF_8); return representation; }
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); } }; } // TODO: remove if not necessary in future? representation.setCharacterSet(CharacterSet.UTF_8); return representation; }
public Representation represent(Variant variant) throws ResourceException { if (appCtx == null) { 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); } }; } // TODO: remove if not necessary in future? representation.setCharacterSet(CharacterSet.UTF_8); return representation; }
public Representation represent(Variant variant) throws ResourceException { if (cj == null) { 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); } }; } // TODO: remove if not necessary in future? // honor requested charset? representation.setCharacterSet(CharacterSet.UTF_8); return representation; }
@Override public void setCharacterSet(CharacterSet characterSet) { getWrappedRepresentation().setCharacterSet(characterSet); }
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); } }; } // TODO: remove if not necessary in future? representation.setCharacterSet(CharacterSet.UTF_8); return representation; }
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); } }; } // TODO: remove if not necessary in future? representation.setCharacterSet(CharacterSet.UTF_8); return representation; }
public Representation represent(Variant variant) throws ResourceException { if (appCtx == null) { 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); } }; } // TODO: remove if not necessary in future? representation.setCharacterSet(CharacterSet.UTF_8); return representation; }
public Representation represent(Variant variant) throws ResourceException { if (cj == null) { 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); } }; } // TODO: remove if not necessary in future? // honor requested charset? representation.setCharacterSet(CharacterSet.UTF_8); return representation; }
representation.setCharacterSet(CharacterSet.UTF_8);
/** * Transforms a source XML representation by applying an XSLT transform * sheet to it. * * @param source * The source XML representation. * @return The generated result representation. */ public Representation transform(Representation source) { final Representation result = new TransformRepresentation(getContext(), source, getTransformSheet()); if (this.resultLanguages != null) { result.getLanguages().addAll(getResultLanguages()); } result.setCharacterSet(getResultCharacterSet()); if (this.resultEncodings != null) { result.getEncodings().addAll(getResultEncodings()); } result.setMediaType(getResultMediaType()); return result; }