Hi
i am getting a
string as ouptput of
java bean method
This string is an xml file.I am applying stylesheet to
this xml file and displaying it in browser window by making
use of output stream of
jsp page.
This works fine when i give full file path but when i use
http://someurl which is in authenticated realm of webserver
it thorws XSLTProcessorException saying file with given URL
not found but file exists actually
i am attaching jsp page
<%@ page language="java" contentType="text/html; charset=UTF-8"
import = "java.util.*,wt.httpgw.*,wt.util.*,rs.jsp.bean.*,rs.report.*,rs.customization.RSCustomViewHolder,rs.desc.*,rs.jsp.util.*,java.net.URL,org.apache.xalan.xslt.*,java.io.*,rs.jsp.helpe r.*,wt.util.WTMessage,wt.httpgw.EncodingConverter" %>
<jsp:useBean id="wtcontext" class="wt.httpgw.WTContextBean" scope="session"/>
<jsp:setProperty name="wtcontext" property="request" value="<%=request%>"/>
<%
String option = request.getParameter("option_name");
XSLTProcessor xprocessor = null;
Properties prop = WTProperties.getLocalProperties();
String urlname = prop.getProperty("wt.server.codebase");
String wind_home = prop.getProperty("wt.home");
String xml_file_path = wind_home + "\\temp";
File xmlfile = null;
String stylesheet = null;
if (option != null)
{
StringWriter strWriter = new StringWriter();
try{
if (option.equals("Document Hierarchy"))
{
RSReportHelper.getDocumentViewHierarchy(strWriter);
System.out.println("REACHED HERE : 0");
}else
{
RSReportHelper.getSystemViewHierarchy(strWriter);
}
stylesheet = urlname.concat("/rs/jsp/jsp/hierachy.xsl");
System.out.println("The URL generated :" + stylesheet);
try
{
xprocessor = XSLTProcessorFactory.getProcessor();
}catch(Exception e)
{
e.printStackTrace();
System.out.println("################ This gives the SAXPareseException ####################");
}
xprocessor.process(new XSLTInputSource(new StringReader(strWriter.toString())),new XSLTInputSource(stylesheet),new XSLTResultTarget(out));
}catch(Exception e)
{
System.out.println("some kind of error in hierarchy section");
}
}else
{
try{
long templateid = (new Long(request.getParameter("templateid"))).longValue();
System.out.println("Template id " + templateid);
RSReportBean report = new RSReportBean();
report.initialize("rs.report.RSReportTemplate",templateid);
String key = request.getParameter("key");
if (key != null)
{
RSTreeNodeDescriptor desc = (RSTreeNodeDescriptor)( ((RSFolderBean)session.getValue(key)).getDescriptor());
report.setDataDescriptor(desc);
}else
{
RSTreeNodeDescriptor desc = (RSTreeNodeDescriptor)session.getValue("DescForReport");
report.setDataDescriptor(desc);
}
stylesheet = urlname.concat("/rs/jsp/jsp/testingxsl.xsl");
System.out.println("The URL generated :" + stylesheet);
try
{
xprocessor = XSLTProcessorFactory.getProcessor();
}catch(Exception e)
{
e.printStackTrace();
System.out.println("################ This gives the SAXPareseException ####################");
}
xprocessor.process(new XSLTInputSource(new StringReader(report.getReportData())),new XSLTInputSource(stylesheet),new XSLTResultTarget(out));
}catch(Exception e)
{
System.out.println("############################################################");
e.printStackTrace();
System.out.println("####### some kind of error in non-hierarchialsection section #######");
}
}
%>
help needed .
Regards
sharang