comparison artifact-database/src/main/java/de/intevation/artifactdatabase/rest/OutRepresentation.java @ 29:22b03d5c84c5

Added REST out handler for artifacts reachable via HTTP GET '/artifact/{uuid}/{type}'. artifacts/trunk@69 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 10 Sep 2009 15:49:17 +0000
parents
children c4d85a8532d1
comparison
equal deleted inserted replaced
28:019b9f02d523 29:22b03d5c84c5
1 package de.intevation.artifactdatabase.rest;
2
3 import org.restlet.representation.OutputRepresentation;
4
5 import de.intevation.artifacts.Artifact;
6
7 import org.restlet.data.MediaType;
8
9 import java.io.OutputStream;
10 import java.io.IOException;
11
12 import org.w3c.dom.Document;
13
14 /**
15 * @author Sascha L. Teichmann (sascha.teichmann@intevation)
16 */
17 public class OutRepresentation
18 extends OutputRepresentation
19 {
20 protected Artifact artifact;
21 protected Document document;
22 protected Object context;
23
24 public OutRepresentation(
25 MediaType mediaType,
26 Artifact artifact,
27 Document document,
28 Object context
29 ) {
30 super(mediaType);
31 this.artifact = artifact;
32 this.document = document;
33 this.context = context;
34 }
35
36 public void write(OutputStream outputStream) throws IOException {
37 byte [] bytes = artifact.out(document, context);
38 outputStream.write(bytes);
39 }
40 }
41 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org