Hi,
Why am I getting the above error message?
I have defined one .js file called login.js which has one function in it called login():

function login(){

importClass(Packages.test.User);
var msg = "Success";
var obj = new User();


obj.getUser(cocoon.request.get("password"));


while (true){

cocoon.sendPageAndWait("login.jx", { " : msg} );
if (obj) {
if (obj == null){
error = "The username and password combination you entered does not exist. Please try again.";
}else{
break;
}
}
}


cocoon.sendPage("success.jx", {" : msg} );


}

What I am try to achieve here is:

1. Instantiate a user object
2. call the method getUser and pass it 2 parameters
3. while (true), while the username and password do not exist redirect the user back to the login page


My form is defined as (login.jx):

<?xml version="1.0"?>
<html xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
<head>
<title>beyaRecords - Login</title>
</head>
<body>
<h2>${msg}</h2>
<form method="post" action="${cocoon.continuation.id}.kont">
<input type="text" name="username"/>
<input type="text" name="password"/>
<input type="submit"/>
</form>
</body>
</html>


The full stack trace is :


Original Exception: ReferenceError: "Continuation" is not defined. (resource://org/apache/cocoon/components/flow/javascript/fom/fom_system.js; line 1)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:557)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1076)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2265)
at org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:62)
at org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:55)
at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.setupContext(FOM_JavaScriptInterpreter.java:612)
at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.callFunction(FOM_JavaScriptInterpreter.java:690)
at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:160)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:165)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:107)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:162)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:107)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:136)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:371)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:312)
at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:133)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:165)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:107)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:162)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:107)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:136)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:371)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:312)
at org.apache.cocoon.Cocoon.process(Cocoon.java:656)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:324)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:395)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:615)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:552)

What am I missing here?

Peter
On 20 Apr 2004, at 11:51, beyaNet Consultancy wrote:

Ok,
i have discovered that the following line caused my sitemap to bomb out:

<map:flow-interpreters default="JavaScript"/>

What does this line do, is it required, will commenting it out prevent flowscript from working properly????


Peter
On 20 Apr 2004, at 11:37, beyaNet Consultancy wrote:

Hi,
just to add that I am using version 2.1.4 of cocoon.

Peter
On 20 Apr 2004, at 11:31, beyaNet Consultancy wrote:

hi,
I have added the following lines of code to my sitemap, and am now getting the above mentioned error message:

<map:flow-interpreters default="JavaScript"/>

<map:selector name="exception" src="org.apache.cocoon.selection.XPathExceptionSelector">

<exception name="invalid-continuation" class="org.apache.cocoon.components.flow.InvalidContinuationException"/>
<exception class="java.lang.Throwable" unroll="true"/>
</map:selector>

<map:flow language="javascript">

<map:script src="flow/login.js"/>
</map:flow>

<map:match pattern="*.jx">

<map:generate type="jx" src="jx/{1}.jx"/>
<map:serialize type="xhtml"/>
</map:match>


<map:match pattern="*.kont">
<map:call continuation="{1}"/>
</map:match>

<map:match pattern="invalidContinuation">

<map:generate src="exceptions/invalidContinuation.xml"/>
<map:serialize type="xml"/>
</map:match>


<map:handle-errors>
<map:select type="exception">
<map:when test="invalid-continuation">
<map:generate src="exceptions/invalidContinuation.html"/>
<map:serialize type="xhtml"/>
</map:when>
</map:select>
</map:handle-errors>

What am I missing?

Peter

On 20 Apr 2004, at 10:45, beyaNet Consultancy wrote:

Hi,
ok, so I have been using actions thus far to perform things like login, and now discover the beauty and simplicity of flowscript. So why actions? Anyway, I want to convert an action I currently have to check a users login details to flowscript. So my question is, what do I need to do? My user class is of the getter and setter variety and in my sitemap I have the following code to read the user/password details into the action:

<map:match pattern="login">
<map:act type="auth-login">
<map:parameter name="handler" value="beyarecords"/>
<map:parameter name="parameter_name" value="{request-param:user}"/>
<map:parameter name="parameter_password" value="{request-param:pass}"/>
<map:redirect-to uri="registerd_user_area"/>
</map:act>
<!-- authentication failed: -->
<map:redirect-to uri="login.html"/>
</map:match>


I now want to change this code so that it can read the values into a flowscript, which in turn queries a user object ( User user = User.getUser(userName, userPassword) ). If the user does not exist i want the user to be re-directed back to the login page, otherwise they are re-directed to my protected area:

<map:match pattern="registerd_user_area">
<map:act type="auth-protect">
<map:parameter name="handler" value="beyarecords"/>
<map:aggregate element="home">
<map:part src="cocoon:/support/beya-menu"/>
<map:part src="cocoon:/support/contract-summary"/>
<map:part src="context://beyarecords/content/adv-xyz-01.xml"/>
<map:part src="cocoon:/support/banner"/>
</map:aggregate>


<map:transform type="xslt" src="style/home-page.xsl"/>
<map:call resource="serialize"/>
</map:act>
</map:match>


Of course I appreciate that those parts of my sitemap which used the map:act type="auth-protect" would now need to be changed to reflect using a flowscript instead, something like:

<map:call function="userLoggedIn"/>??? In the above instance, how would I still utilise the map:aggregate???


Peter

Reply via email to