view flys-client/src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java @ 240:4cdf9030854f

Added i18n strings for the computed discharge curve. flys-client/trunk@1816 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 04 May 2011 07:36:20 +0000
parents 7ea004d0ffbc
children 6838e4112eeb
line wrap: on
line source
package de.intevation.flys.client.server;

import java.io.OutputStream;
import java.io.IOException;

import org.w3c.dom.Document;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import de.intevation.artifacts.common.utils.ClientProtocolUtils;

import de.intevation.artifacts.httpclient.http.HttpClient;
import de.intevation.artifacts.httpclient.http.HttpClientImpl;


/**
 * This service is used to request a chart from the artifact server. The
 * response is directed directly to the output stream, so the image that is
 * retrieved is displayed in the UI afterwards.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class ChartOutputServiceImpl
extends      HttpServlet
{
    public void doGet(HttpServletRequest req, HttpServletResponse resp) {
        System.out.println("ChartOutputServiceImpl.doGet");

        try {
            OutputStream out = resp.getOutputStream();

            String serverUrl = req.getParameter("server");
            String uuid      = req.getParameter("uuid");
            String type      = req.getParameter("type");
            String mimeType  = "image/png";

            Document request = ClientProtocolUtils.newOutCollectionDocument(
                uuid, type);

            HttpClient client = new HttpClientImpl(serverUrl);
            client.collectionOut(request, uuid, "chart", out);

            out.close();
            out.flush();
        }
        catch (IOException ioe) {
            System.err.println(ioe.getMessage());
        }
    }
}

http://dive4elements.wald.intevation.org