cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From coli...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom FOM_JavaScriptInterpreter.java
Date Sun, 20 Jul 2003 21:28:26 GMT
coliver     2003/07/20 14:28:26

  Modified:    src/java/org/apache/cocoon/components/flow/javascript/fom
                        FOM_JavaScriptInterpreter.java
  Log:
  Fixed getSessionScope() to not automatically create a session
  
  Revision  Changes    Path
  1.5       +11 -10    cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_JavaScriptInterpreter.java
  
  Index: FOM_JavaScriptInterpreter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_JavaScriptInterpreter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FOM_JavaScriptInterpreter.java	19 Jul 2003 20:16:27 -0000	1.4
  +++ FOM_JavaScriptInterpreter.java	20 Jul 2003 21:28:26 -0000	1.5
  @@ -265,12 +265,14 @@
           throws Exception {
           Map objectModel = environment.getObjectModel();
           Request request = ObjectModelHelper.getRequest(objectModel);
  -        Session session = request.getSession(true);
           Scriptable scope = null;
  -        HashMap userScopes = (HashMap)session.getAttribute(USER_GLOBAL_SCOPE);
  -        if (userScopes != null) {
  -            String uriPrefix = environment.getURIPrefix();
  -            scope = (Scriptable)userScopes.get(uriPrefix);
  +        Session session = request.getSession(false);
  +        if (session != null) {
  +            HashMap userScopes = (HashMap)session.getAttribute(USER_GLOBAL_SCOPE);
  +            if (userScopes != null) {
  +                String uriPrefix = environment.getURIPrefix();
  +                scope = (Scriptable)userScopes.get(uriPrefix);
  +            }
           }
           if (scope == null) {
               scope = createThreadScope();
  @@ -305,7 +307,6 @@
               session.setAttribute(USER_GLOBAL_SCOPE, userScopes);
           }
           String uriPrefix = environment.getURIPrefix();
  -        System.out.println("Session: setting :" + uriPrefix + ": " + System.identityHashCode(scope));
           userScopes.put(uriPrefix, scope);
           return scope;
       }
  @@ -409,7 +410,7 @@
           // Check if we need to compile and/or execute scripts
           synchronized (compiledScripts) {
               List execList = new ArrayList();
  -            boolean needsRefresh = lastExecTime == 0;
  +            boolean needsRefresh = false;
               if (reloadScripts) {
                   long now = System.currentTimeMillis();
                   if (now >= lastTimeCheck + checkTime) {
  @@ -423,7 +424,7 @@
               // then create a list of scripts to compile/execute
               if (lastExecTime == 0 || needsRefresh || needResolve.size() > 0) {
                   topLevelScripts.addAll(needResolve);
  -                if (!needsRefresh) {
  +                if (lastExecTime != 0 && !needsRefresh) {
                       execList.addAll(needResolve);
                   } else {
                       execList.addAll(topLevelScripts);
  @@ -548,7 +549,7 @@
                   cocoon.setParameters(parameters);
                   Object fun = ScriptableObject.getProperty(thrScope, funName);
                   if (fun == Scriptable.NOT_FOUND) {
  -                    fun = funName; // this will produce a better error message
  +                    throw new ResourceNotFoundException("Function \"javascript:"+funName+
"()\" not found");
                   }
                   ScriptRuntime.call(context, fun, thrScope, 
                                      funArgs, thrScope);
  
  
  

Mime
View raw message