You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Edward Q. Bridges" <ed...@buzznik.com> on 2000/06/14 19:46:45 UTC
weird technical issue with xalan
Below is a doGet method for a servlet that I'm having trouble with.
When I attempt to process a DOM Document using Xalan-J 1.0.1
where the Xalan-specific code is wrapped in a class (called HtmlRenderer),
it occasionally returns nothing. In other words, the http request to the
servlet completes successfully (Status 200), I get back a complete set
of headers, but there's no content after the headers. This happens
once in every 10 or so requests. The webserver is a Apache 1.3.12
running on my laptop running Linux. I'm using Apache JServ 1.1, and
the server is also configured to use mod_ssl and mod_perl.
I'm suspecting that this isn't really a Xalan issue, but rather a JServ/Apache
issue. But, I've never had any issues at all with
that until I started using Xalan; and given that it works fine when
the below code is uncommented and the two lines referring to HtmlRenderer
are removed, I can't honestly point the finger at Apache/Jserv just yet.
Note that the code in HtmlRenderer (which I can post if anyone likes) which
deals with Xalan is identical to what I have below in comments.
Has anyone run into a similar sort of scenario? Anyone have any ideas??
thanks in advance
--e--
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
String sql = "Select datetime 'now' as currenttime";
try {
/* DatabaseDom is a wrapper around a JDBC
* Connection which converts a ResultSet into a DOM
*/
DatabaseDom dom = new DatabaseDom( );
Statement test = dom.createStatement();
ResultSet rs = test.executeQuery( sql );
Document d = dom.getDocument( rs );
/*
XSLTProcessor processor =
XSLTProcessorFactory.getProcessor(new XercesLiaison());
XSLTInputSource xmlSource = new XSLTInputSource(d);
XSLTInputSource xslSheet = new XSLTInputSource("file:/docs/httpd/lib/java/com/sheckys/xml/Test.xsl");
XSLTResultTarget xmlResult = new XSLTResultTarget( out );
try {
processor.process(xmlSource, xslSheet, xmlResult);
} catch (SAXException e) {
out.println("<h2>Error: couldn't transform source: " + e.toString() +"</h2>");
}
*/
Renderer r = new HtmlRenderer(out,"file:/docs/httpd/lib/java/com/sheckys/xml/Test.xsl" );
r.draw( d );
} catch (Exception e) {
System.err.println("Error constructing DatabaseDom: " +
e.toString() );
e.printStackTrace();
}
}