Search in sources :

Example 1 with GetRecordById

use of org.geotoolkit.csw.xml.GetRecordById in project geotoolkit by Geomatys.

the class AbstractGetRecordById method getResponseStream.

/**
 * {@inheritDoc}
 */
@Override
public InputStream getResponseStream() throws IOException {
    final URL url = getURL();
    URLConnection conec = url.openConnection();
    conec = security.secure(conec);
    conec.setDoOutput(true);
    conec.setRequestProperty("Content-Type", "text/xml");
    OutputStream stream = conec.getOutputStream();
    stream = security.encrypt(stream);
    try {
        final Marshaller marsh = POOL.acquireMarshaller();
        final ElementSetName set = CswXmlFactory.createElementSetName(version, elementSetName);
        final GetRecordById recordByIdXml = CswXmlFactory.createGetRecordById(version, "CSW", set, outputFormat, outputSchema, Arrays.asList(ids));
        marsh.marshal(recordByIdXml, stream);
        POOL.recycle(marsh);
    } catch (JAXBException ex) {
        throw new IOException(ex);
    }
    stream.close();
    return security.decrypt(conec.getInputStream());
}
Also used : Marshaller(javax.xml.bind.Marshaller) ElementSetName(org.geotoolkit.csw.xml.ElementSetName) OutputStream(java.io.OutputStream) JAXBException(javax.xml.bind.JAXBException) IOException(java.io.IOException) GetRecordById(org.geotoolkit.csw.xml.GetRecordById) URL(java.net.URL) URLConnection(java.net.URLConnection)

Aggregations

IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 JAXBException (javax.xml.bind.JAXBException)1 Marshaller (javax.xml.bind.Marshaller)1 ElementSetName (org.geotoolkit.csw.xml.ElementSetName)1 GetRecordById (org.geotoolkit.csw.xml.GetRecordById)1