Andy, It looks as though the execution of the JavaScript statement highlighted (between the <b> tags) is causing problems.
The text "if (path.charAt(path.length-1) != '/')" will cause problems if the path variable is null. Try changing the code in the system.script.xml to check for a null return from the call to getPathInfo(). If this is the case, then Tomcat seems be doing different things than JServ. Which would suck, because then I'll have to install yet another servlet engine and work with it. I have to leave right now, but I'll check for your response first thing in the morning! Mike > -----Original Message----- > From: Andy Glick [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 20, 2000 4:21 PM > To: xang devel > Subject: problem with get() from system.script.xml looks to be... > > > Mike, > > In this incarnation of the problem there appears to be some bad html > characters generated in the get() method. The script is now being > dumped to the browser window with the stack traces. I've include all > of the output. > > Look for this chunk of code in the get method. > > ---------------------------------------------------------------------- > // require a trailing slash. > var path; > path = context.getRequest().getPathInfo(); > <b> if (path.charAt(path.length-1) != '/') > </b> { > app.redirectTo(context,path+"/"); > return; > } > ----------------------------------------------------------------------- > > Any ideas? > > -a > > > > <html><body><h2>System error</h2>Error in handler for > 'onGet'<pre>Runtime error Conversion to object unsupported by null > detected at line 117 of function 'get' in string starting with: > 'get();'... > called at line 1 in string starting with: > 'get();'...</pre></body></html><!-- > FESI.jslib.JSException: Runtime error Conversion to object unsupported > by null > detected at line 117 of function 'get' in string starting with: > 'get();'... > called at line 1 in string starting with: 'get();'... > FESI.jslib.JSException: Runtime error Conversion to object unsupported > by null > detected at line 117 of function 'get' in string starting with: > 'get();'... > called at line 1 in string starting with: 'get();'... > at FESI.Data.JSWrapper.evalAsFunction(JSWrapper.java) > at > org.apache.xang.scriptEngine.FesiEngine.run(FesiEngine.java:108) > at > org.apache.xang.net.http.object.impl.HTTPScriptedObject.dispatchTo > Script(HTTPScriptedObject.java:198) > at > org.apache.xang.net.http.object.impl.HTTPScriptedObject.dispatch(H > TTPScriptedObject.java:144) > at > org.apache.xang.net.http.object.impl.HTTPRequestHandler.service(HT > TPRequestHandler.java:293) > at > org.apache.xang.net.http.object.impl.HTTPRequestHandler.service(HT > TPRequestHandler.java:242) > at > org.apache.xang.net.http.object.impl.HTTPObjectServer.service(HTTP > ObjectServer.java:144) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > at > org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper > .java:503) > at > org.apache.tomcat.core.ContextManager.service(ContextManager.java:559) > at > org.apache.tomcat.service.http.HttpConnectionHandler.processConnec > tion(HttpConnectionHandler.java:160) > at > org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoin > t.java:338) > at java.lang.Thread.run(Unknown Source) > due to: > FESI.Exceptions.EcmaScriptException: Runtime error Conversion to object > unsupported by null > detected at line 117 of function 'get' in string starting with: > 'get();'... > called at line 1 in string starting with: 'get();'... > FESI.Exceptions.EcmaScriptException: Runtime error Conversion to object > unsupported by null > detected at line 117 of function 'get' in string starting with: > 'get();'... > called at line 1 in string starting with: 'get();'... > at FESI.Data.ESValue.toESObject(ESValue.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at > FESI.AST.ASTCompositeReference.jjtAccept(ASTCompositeReference.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at > FESI.AST.ASTBinaryExpressionSequence.jjtAccept(ASTBinaryExpression > Sequence.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at > FESI.AST.ASTFunctionCallParameters.jjtAccept(ASTFunctionCallParame > ters.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at > FESI.AST.ASTCompositeReference.jjtAccept(ASTCompositeReference.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at > FESI.AST.ASTBinaryExpressionSequence.jjtAccept(ASTBinaryExpression > Sequence.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at FESI.AST.ASTIfStatement.jjtAccept(ASTIfStatement.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at FESI.AST.ASTStatement.jjtAccept(ASTStatement.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at FESI.AST.ASTStatementList.jjtAccept(ASTStatementList.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.evaluateFunction(EcmaSc > riptEvaluateVisitor.java) > at FESI.Interpreter.Evaluator.evaluateFunction(Evaluator.java) > at > FESI.Data.ConstructedFunctionObject.callFunction(ConstructedFuncti > onObject.java) > at FESI.Data.ESObject.doIndirectCallInScope(ESObject.java) > at FESI.Interpreter.ScopeChain.doIndirectCall(ScopeChain.java) > at FESI.Interpreter.Evaluator.doIndirectCall(Evaluator.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at > FESI.AST.ASTCompositeReference.jjtAccept(ASTCompositeReference.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at FESI.AST.ASTStatement.jjtAccept(ASTStatement.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluat > eVisitor.java) > at FESI.AST.ASTProgram.jjtAccept(ASTProgram.java) > at > FESI.Interpreter.EcmaScriptEvaluateVisitor.evaluateProgram(EcmaScr > iptEvaluateVisitor.java) > at FESI.Interpreter.Evaluator.evaluate(Evaluator.java) > at FESI.Interpreter.Evaluator.evaluate(Evaluator.java) > at FESI.Interpreter.Evaluator.evaluate(Evaluator.java) > at FESI.Data.JSWrapper.evalAsFunction(JSWrapper.java) > at > org.apache.xang.scriptEngine.FesiEngine.run(FesiEngine.java:108) > at > org.apache.xang.net.http.object.impl.HTTPScriptedObject.dispatchTo > Script(HTTPScriptedObject.java:198) > at > org.apache.xang.net.http.object.impl.HTTPScriptedObject.dispatch(H > TTPScriptedObject.java:144) > at > org.apache.xang.net.http.object.impl.HTTPRequestHandler.service(HT > TPRequestHandler.java:293) > at > org.apache.xang.net.http.object.impl.HTTPRequestHandler.service(HT > TPRequestHandler.java:242) > at > org.apache.xang.net.http.object.impl.HTTPObjectServer.service(HTTP > ObjectServer.java:144) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > at > org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper > .java:503) > at > org.apache.tomcat.core.ContextManager.service(ContextManager.java:559) > at > org.apache.tomcat.service.http.HttpConnectionHandler.processConnec > tion(HttpConnectionHandler.java:160) > at > org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoin > t.java:338) > at java.lang.Thread.run(Unknown Source) > > --><pre> > > > > /** Base browser method. Override to provide object specific > functionality. > */ > function doObjectEdit(context,returnTypes,parameters) > { > parameters.put("layout","editor.xsl"); > get(context,returnTypes,parameters); > } > > function doObjectBrowser(context,returnTypes,parameters) > { > > parameters.put("layout","editor_browse.xsl"); > get(context,returnTypes,parameters); > } > > /** Base editor method. Override to provide object specific > functionality. > */ > function doObjectEditor(context,returnTypes,parameters) > { > parameters.put("layout","editor_edit.xsl"); > get(context,returnTypes,parameters); > } > > /** Base update method > */ > function doObjectUpdate(context,returnTypes,parameters) > { > doc = context.getResponse().getWriter(); > for (prop in parameters.keys()) > { > if (prop.indexOf('prop_') == 0) > { > value = parameters.get(prop); > attrib = prop.substring(5); > if (value == null || value=="") > { > xml.removeAttribute(attrib); > } > else > { > xml.setAttribute(attrib,value); > } > > } > } > > context.getResponse().setContentType("text/html"); > > doc.println("<html><body>OK</body></html > >"); > } > > function doObjectAddProp(context,returnTypes,parameters) > { > name = parameters.get('name'); > value = parameters.get('value'); > xml.setAttribute(name,value); > > context.getResponse().setContentType("text/html"); > doc = context.getResponse().getWriter(); > > doc.println("<html><body>"+name+"=" > ;+value+"</body></html>"); > } > > > > > > function debug(s) > { > Packages.java.lang.System.out.println(s); > } > > function getInheritedAttribute(element,name) > { > var value; > value=null; > > while ((element != null) && (element.getNodeType() == > 1)) > { > value = element.getAttribute(name); > if (value != null && value != "") > break; > > element = element.getParentNode(); > } > return value; > } > > function getLayout(element) > { > return getInheritedAttribute(element,'layout'); > } > > /** > * This determines which XSL stylesheet to use and applies the stylesheet > to the targeted > * element. > */ > function get(context,returnTypes,parameters) > { > var doc; > var layout; > > debug('in get()'); > doc = context.getResponse().getWriter(); > > // check for object > if (xml == null) > { > context.getResponse().sendError(404,"Page not > found."); > return; > } > > // require a trailing slash. > var path; > path = context.getRequest().getPathInfo(); > <b> if (path.charAt(path.length-1) != '/') > </b> { > app.redirectTo(context,path+"/"); > return; > } > > // get the url to the XSL to use for the transform. > base = getInheritedAttribute(xml,'resources.server'); > > layout = parameters.get('layout'); > if (layout == null) > { > layout = getLayout(xml); > } > > if (base != null && (layout.indexOf(':') <= 1)) > { > media_root = > Packages.org.apache.xang.util.ServletUtil.getRealPath(context); > layout = media_root + "/" + base + layout; > layout = > "file:///"+Packages.org.apache.xang.util.ServletUtil.res > olveURL(layout); > } > > if (layout != null) > { > > context.getResponse().setContentType("text/html"); > // do XSL via Xalan > { > processor = > Packages.org.apache.xalan.xslt.XSLTProcessorFactory.getProcessorUs > ingLiaisonName("org.apache.xalan.xpath.xdom.XercesLiaison"); > > source = new > Packages.org.apache.xalan.xslt.XSLTInputSource(); > source.setNode(xml); > > stylesheet = new > Packages.org.apache.xalan.xslt.XSLTInputSource(); > stylesheet.setSystemId(layout); > > output = new > Packages.org.apache.xalan.xslt.XSLTResultTarget(); > output.setCharacterStream(doc); > > processor.process(source,stylesheet,output); > } > > doc.flush(); > } > } > > function getXML(context,returnTypes,parameters) > { > doc = context.getResponse().getWriter(); > doc.println("<?xml version='1.0' ?>"); > doc.println("<!-- cool huh? -->"); > doc.println(xml.getXML()); > } > > function getScript(context,returnTypes,parameters) > { > var doc; > var s; > var util; > > doc = context.getResponse().getWriter(); > > util = new Packages.org.apache.xang.util.TextUtil(); > > > s = "<html><body><pre>"; > s += util.encodeToHTML(app.loadScript(null)); > s += "</pre></body></html>"; > doc.println(s); > doc.flush(); > } > > > </pre> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]
