/** * Returns the tile as an image. * * @return image, never <code>null</code> * @throws IOException * @throws XMLStreamException * @throws OWSExceptionReport */ public BufferedImage getAsImage() throws IOException, OWSExceptionReport, XMLStreamException { rawResponse.assertNoXmlContentTypeAndExceptionReport(); BufferedImage image = null; try { InputStream is = rawResponse.getAsBinaryStream(); image = HttpUtils.IMAGE.work( is ); } finally { rawResponse.close(); } return image; }
private void initCapabilities( URL capaUrl ) throws IOException, OWSExceptionReport, XMLStreamException { if ( shouldUseGet( capaUrl ) ) { OwsHttpResponse response = httpClient.doGet( capaUrl, null, null ); response.assertHttpStatus200(); XMLStreamReader responseAsXMLStream = response.getAsXMLStream(); try { XMLAdapter xmlAdapter = new XMLAdapter( responseAsXMLStream ); initCapabilities( xmlAdapter ); } finally { responseAsXMLStream.close(); response.close(); } } else { XMLAdapter xmlAdapter = new XMLAdapter( capaUrl ); initCapabilities( xmlAdapter ); } }
public TransactionResponse( OwsHttpResponse response ) throws XMLProcessingException, OWSExceptionReport, XMLStreamException { this.response = response; this.load( response.getAsXMLStream() ); }
StreamBufferStore tmpStore = null; try { xmlStream = response.getAsXMLStream(); tmpStore = XMLStreamUtils.serialize( xmlStream ); } finally { response.close();
/** * * @throws IOException */ public void close() throws IOException { rawResponse.close(); }
/** * Performs a <code>GetFeatureInfo</code> request and returns the response as a {@link FeatureCollection}. * * @param request * request parameter, must not be <code>null</code> * @param hardParams * raw parameters for augmenting overriding KVPs, must not be <code>null</code> * @return response parsed as feature collection, never <code>null</code> * @throws IOException * @throws OWSExceptionReport * @throws XMLStreamException */ public FeatureCollection doGetFeatureInfo( GetFeatureInfo request, Map<String, String> hardParams ) throws IOException, OWSExceptionReport, XMLStreamException { Map<String, String> params = buildGetFeatureInfoParamMap( request, hardParams ); overrideHardParams( params, hardParams ); OwsHttpResponse response = null; try { URL url = getGetUrl( GetFeatureInfo.name() ); response = httpClient.doGet( url, params, null ); response.assertHttpStatus200(); XMLStreamReader reader = response.getAsXMLStream(); String csvLayerNames = join( ",", request.getQueryLayers() ); return FeatureInfoParser.parseAsFeatureCollection( reader, csvLayerNames ); } finally { closeQuietly( response ); } }
public GetFeatureInfoResponse getFeatureInfo( GetFeatureInfo request ) throws OWSExceptionReport, XMLStreamException, IOException { Map<String, String> kvp = buildGetFeatureInfoKvpMap( request ); if ( request.getOverriddenParameters() != null ) { for ( Entry<String, String> e : request.getOverriddenParameters().entrySet() ) { if ( kvp.containsKey( e.getKey().toLowerCase() ) ) { kvp.put( e.getKey().toLowerCase(), e.getValue() ); } else kvp.put( e.getKey(), e.getValue() ); } } URL endPoint = getGetUrl( WMTSConstants.WMTSRequestType.GetTile.name() ); OwsHttpResponse response = httpClient.doGet( endPoint, kvp, null ); response.assertHttpStatus200(); response.assertNoXmlContentTypeAndExceptionReport(); return new GetFeatureInfoResponse( response, request ); }
private CloseRequiredInputStream getNativeFormatRemoteStream() throws TileIOException { CloseRequiredInputStream is = null; try { GetTileResponse response = client.getTile( request ); is = response.getAsRawResponse().getAsBinaryStream(); } catch ( Exception e ) { throw new TileIOException( e.getMessage(), e ); } return is; }
/** * Provides access to the feature objects and WFS provided information in the response. * * @return WFS feature collection, never <code>null</code> * * @throws OWSExceptionReport * @throws UnknownCRSException * @throws XMLStreamException * @throws XMLParsingException */ public WFSFeatureCollection<T> getAsWFSFeatureCollection() throws XMLParsingException, XMLStreamException, UnknownCRSException, OWSExceptionReport { return new WFSFeatureCollection<T>( response.getAsXMLStream(), gmlVersion, appSchema ); }
protected void closeQuietly( OwsHttpResponse response ) { if (response != null) { response.close(); } } }
/** * Performs the given {@link GetTile} request. * * @param request * <code>GetTile</code> requests, must not be <code>null</code> * @return server response, never <code>null</code> * @throws IOException * @throws OWSExceptionReport * @throws XMLStreamException */ public GetTileResponse getTile( GetTile request ) throws IOException, OWSExceptionReport, XMLStreamException { Map<String, String> kvp = buildGetTileKvpMap( request ); if ( request.getOverriddenParameters() != null ) { for ( Entry<String, String> e : request.getOverriddenParameters().entrySet() ) { if ( kvp.containsKey( e.getKey().toLowerCase() ) ) { kvp.put( e.getKey().toLowerCase(), e.getValue() ); } else kvp.put( e.getKey(), e.getValue() ); } } URL endPoint = getGetUrl( WMTSConstants.WMTSRequestType.GetTile.name() ); OwsHttpResponse response = httpClient.doGet( endPoint, kvp, null ); response.assertHttpStatus200(); response.assertNoXmlContentTypeAndExceptionReport(); return new GetTileResponse( response ); }
public GetRecordsResponse( OwsHttpResponse response ) throws XMLProcessingException, OWSExceptionReport, XMLStreamException { this.response = response; xmlStream = response.getAsXMLStream(); XMLStreamUtils.skipStartDocument( xmlStream ); XMLStreamUtils.moveReaderToFirstMatch( xmlStream, new QName( CSW_202_NS, "SearchResults" ) ); String noOfRecM = XMLStreamUtils.getAttributeValue( xmlStream, "numberOfRecordsMatched" ); numberOfRecordsMatched = noOfRecM != null ? Integer.parseInt( noOfRecM ) : 0; String noOfRecR = XMLStreamUtils.getAttributeValue( xmlStream, "numberOfRecordsReturned" ); numberOfRecordsReturned = noOfRecR != null ? Integer.parseInt( noOfRecR ) : 0; String nextRec = XMLStreamUtils.getAttributeValue( xmlStream, "nextRecord" ); nextRecord = nextRec != null ? Integer.parseInt( nextRec ) : 0; xmlStream.next(); while ( xmlStream.getEventType() != END_DOCUMENT && !xmlStream.isStartElement() && !xmlStream.isEndElement() ) { xmlStream.next(); } if ( xmlStream.getEventType() != END_DOCUMENT ) { recordElementName = xmlStream.getLocalName(); } }
/** * * @throws IOException */ public void close() throws IOException { response.close(); } }
public FeatureCollection getFeatures() throws OWSException, OWSExceptionReport { try { return FeatureInfoParser.parseAsFeatureCollection( rawResponse.getAsXMLStream(), request.getLayer() ); } catch ( XMLStreamException e ) { throw new OWSException( "Remote WMTS response was not recognized as feature collection: " + e.getLocalizedMessage(), e, OWSException.NO_APPLICABLE_CODE ); } }
/** * * @throws IOException */ public void close() throws IOException { rawResponse.close(); }
public MetadataRecord getRecordById( String fileIdentifier, String schema ) throws IOException, OWSExceptionReport, XMLStreamException { URL endPoint = getGetUrl( "GetRecordById" ); Map<String, String> params = getGetRecordByIdKvpParams( fileIdentifier, schema ); OwsHttpResponse response = httpClient.doGet( endPoint, params, null ); XMLStreamReader xmlStream = response.getAsXMLStream(); XMLStreamUtils.skipStartDocument( xmlStream ); moveToNextStartElement( xmlStream ); return MetadataRecordFactory.create( xmlStream ); }
public void close() throws IOException { response.close(); }
public void close() throws IOException { response.close(); }