public static StreamingOutput buildResponseOfDomLR ( final IStorage pDatabase , final IBackendFactory pStorageFac , final IRevisioning pRevision ) { final StreamingOutput sOutput = new StreamingOutput ( ) { @ Override public void write ( final OutputStream output ) throws IOException , WebApplicationException { Document document ; try { document = createSurroundingXMLResp ( ) ; final Element resElement = RESTResponseHelper . createResultElement ( document ) ; List < Element > collections ; try { collections = RESTResponseHelper . createCollectionElementDBs ( pDatabase , document , pStorageFac , pRevision ) ; } catch ( final TTException exce ) { throw new WebApplicationException ( exce ) ; } for ( final Element resource : collections ) { resElement . appendChild ( resource ) ; } document . appendChild ( resElement ) ; final DOMSource domSource = new DOMSource ( document ) ; final StreamResult streamResult = new StreamResult ( output ) ; final Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; transformer . transform ( domSource , streamResult ) ; } catch ( final ParserConfigurationException exce ) { throw new WebApplicationException ( exce ) ; } catch ( final TransformerConfigurationException exce ) { throw new WebApplicationException ( exce ) ; } catch ( final TransformerFactoryConfigurationError exce ) { throw new WebApplicationException ( exce ) ; } catch ( final TransformerException exce ) { throw new WebApplicationException ( exce ) ; } } } ; return sOutput ; }
This method builds the overview for the resources and collection we offer in our implementation .