view src/main/java/org/dive4elements/artifacts/httpclient/http/response/DocumentResponseHandler.java @ 116:c92b50c9c99a

Slightly improved error handling if response entity could not be parsed.
author gernotbelger
date Wed, 13 Jun 2018 15:37:12 +0200
parents 133281653904
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */
package org.dive4elements.artifacts.httpclient.http.response;

import java.io.IOException;

import org.dive4elements.artifacts.httpclient.utils.XMLUtils;
import org.restlet.Response;
import org.restlet.representation.Representation;

/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class DocumentResponseHandler implements ResponseHandler {

    @Override
    public Object handle(final Response response) throws IOException {
        final Representation output = response.getEntity();
            // FIXME: stream not closed?
            return XMLUtils.readDocument(output.getStream());
    }
}

http://dive4elements.wald.intevation.org