public static void transform( byte[] doc, URL xsltUrl, OutputStream out ) throws URISyntaxException, TransformerException { ByteArrayInputStream inputStream = new ByteArrayInputStream( doc ); transform( inputStream, xsltUrl, out ); }
@Override public void serialize( InputStream capabilitiesXmlStream, OutputStream responseStream ) throws IOException { ClassLoader loader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader( workspace.getModuleClassLoader() ); try { XsltUtils.transform( capabilitiesXmlStream, this.xslt, responseStream ); } catch ( Exception e ) { LOG.warn( "Unable to transform Capabilities: {}.", e.getLocalizedMessage() ); LOG.trace( "Stack trace:", e ); } finally { Thread.currentThread().setContextClassLoader( loader ); } }
private void transform( InputStream stream, HttpResponseBuffer response ) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader( workspace.getModuleClassLoader() ); try { OutputStream outputStream = response.getOutputStream(); XsltUtils.transform( stream, this.xsltUrl, outputStream ); } catch ( Exception e ) { LOG.warn( "Unable to transform Capabilities: {}.", e.getLocalizedMessage() ); LOG.trace( "Stack trace:", e ); } finally { Thread.currentThread().setContextClassLoader( loader ); } }
LOG.debug( "GML before XSLT:\n{}", new String( bos.toByteArray(), "UTF-8" ) ); XsltUtils.transform( bos.toByteArray(), this.xslt, context.getOutputStream() ); } catch ( Throwable e ) { LOG.warn( "Unable to transform GML for feature info: {}.", e.getLocalizedMessage() );