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.dispatchToScript(HTTPScriptedObject.java:198)
at
org.apache.xang.net.http.object.impl.HTTPScriptedObject.dispatch(HTTPScriptedObject.java:144)
at
org.apache.xang.net.http.object.impl.HTTPRequestHandler.service(HTTPRequestHandler.java:293)
at
org.apache.xang.net.http.object.impl.HTTPRequestHandler.service(HTTPRequestHandler.java:242)
at
org.apache.xang.net.http.object.impl.HTTPObjectServer.service(HTTPObjectServer.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.processConnection(HttpConnectionHandler.java:160)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.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(EcmaScriptEvaluateVisitor.java)
at
FESI.AST.ASTCompositeReference.jjtAccept(ASTCompositeReference.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at
FESI.AST.ASTBinaryExpressionSequence.jjtAccept(ASTBinaryExpressionSequence.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at
FESI.AST.ASTFunctionCallParameters.jjtAccept(ASTFunctionCallParameters.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at
FESI.AST.ASTCompositeReference.jjtAccept(ASTCompositeReference.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at
FESI.AST.ASTBinaryExpressionSequence.jjtAccept(ASTBinaryExpressionSequence.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at FESI.AST.ASTIfStatement.jjtAccept(ASTIfStatement.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at FESI.AST.ASTStatement.jjtAccept(ASTStatement.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at FESI.AST.ASTStatementList.jjtAccept(ASTStatementList.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.evaluateFunction(EcmaScriptEvaluateVisitor.java)
at FESI.Interpreter.Evaluator.evaluateFunction(Evaluator.java)
at
FESI.Data.ConstructedFunctionObject.callFunction(ConstructedFunctionObject.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(EcmaScriptEvaluateVisitor.java)
at
FESI.AST.ASTCompositeReference.jjtAccept(ASTCompositeReference.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at FESI.AST.ASTStatement.jjtAccept(ASTStatement.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.visit(EcmaScriptEvaluateVisitor.java)
at FESI.AST.ASTProgram.jjtAccept(ASTProgram.java)
at
FESI.Interpreter.EcmaScriptEvaluateVisitor.evaluateProgram(EcmaScriptEvaluateVisitor.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.dispatchToScript(HTTPScriptedObject.java:198)
at
org.apache.xang.net.http.object.impl.HTTPScriptedObject.dispatch(HTTPScriptedObject.java:144)
at
org.apache.xang.net.http.object.impl.HTTPRequestHandler.service(HTTPRequestHandler.java:293)
at
org.apache.xang.net.http.object.impl.HTTPRequestHandler.service(HTTPRequestHandler.java:242)
at
org.apache.xang.net.http.object.impl.HTTPObjectServer.service(HTTPObjectServer.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.processConnection(HttpConnectionHandler.java:160)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.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.resolveURL(layout);
}
if (layout != null)
{
context.getResponse().setContentType("text/html");
// do XSL via Xalan
{
processor =
Packages.org.apache.xalan.xslt.XSLTProcessorFactory.getProcessorUsingLiaisonName("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>