Navigation

View: New views
2 Messages — Rating Filter:   Alert me  

Navigation

by Rebel Geek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I thought I knew what I was doing, but evidence show that I don't...

Path-actions:

I am under the impression that path-actions are independant actions
(i.e. not ties to any page) that will execute when it is matched by a
particular URL. This is not what is happening.

The action of my form is called "processAction", but when I submit my
form, JPublish complains that there is no "processAction/index.html".
So what I did was create a blank page so that the action executes and
it does, BUT I stuff things into the context and redirect to another
page (context.put("redirect","index.html")). When I look at the logs,
JPublish has cleared the context before calling index.html. Here is a
sample of the log...

(home.bsh is the action for index.html)

2006-06-20 13:19:52,048 DEBUG [JPublishEngine] Executing global actions.
2006-06-20 13:19:52,048 DEBUG [ScriptAction] Executing script:
/actions/global.bsh
2006-06-20 13:19:52,048 DEBUG [BSFScriptHandler] Executing script:
/actions/global.bsh
2006-06-20 13:19:52,078 DEBUG [bsh] In global.bsh
2006-06-20 13:19:52,088 DEBUG [bsh] Putting owner in context
2006-06-20 13:19:52,118 DEBUG [bsh] Contacts is null
2006-06-20 13:19:52,118 INFO  [ScriptAction] Elapsed time for
localhost://actions/global.bsh:70ms
2006-06-20 13:19:52,118 DEBUG [JPublishEngine] Executing path actions,
path: /processAction.html
2006-06-20 13:19:52,118 DEBUG [ScriptAction] Executing script:
/actions/processAction.bsh
2006-06-20 13:19:52,118 DEBUG [ScriptAction] Loading updated or new
script: /actions/processAction.bsh
2006-06-20 13:19:52,118 DEBUG [BSFScriptHandler] Executing script:
/actions/processAction.bsh
2006-06-20 13:19:52,128 DEBUG [bsh] In processAction.bsh
2006-06-20 13:19:52,228 DEBUG [bsh] Owner name is No User
2006-06-20 13:19:52,228 DEBUG [bsh] User clicked Find...
2006-06-20 13:19:52,228 DEBUG [bsh] Putting tina in context as nameToSearch
2006-06-20 13:19:52,238 INFO  [ScriptAction] Elapsed time for
localhost://actions/processAction.bsh:120ms
2006-06-20 13:19:52,238 DEBUG [JPublishEngine] Executing
post-evaluation actions.
2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Real path: /index.html
2006-06-20 13:19:52,268 DEBUG [PathUtilities] Wildcard index: 0
2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Creating session facade
2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Session facade:
org.jpublish.servlet.HttpSessionFacade@993aaa
2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Content type for
extension html is text/html; charset=ISO-8859-1

*************************** Here's the culprit
**********************************
2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Cleared the context

2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Putting session in the context
2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Rendering: /index.html
2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Adding
org.jpublish.repository.DefaultRepository as content_repository
2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Executing pre-evaluation actions.
2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Checking if static
resource exists: /index.html
2006-06-20 13:19:52,268 DEBUG [DefaultResourceManager]
FileSystemManager:
org.apache.commons.vfs.impl.DefaultFileSystemManager@a801b0
2006-06-20 13:19:52,268 DEBUG [DefaultResourceManager] Base file: /static
2006-06-20 13:19:52,268 DEBUG [DefaultResourceManager] File: /static/index.html
2006-06-20 13:19:52,268 DEBUG [DefaultResourceManager] File exists? false
2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Static resource
'/index.html' not found
2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Loading the page.
2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page name: index
2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page type: html
2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page path: /index
2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page parent:
2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Resolving page index.xml
2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Looking for
page:/pages/index.xml
2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page definition
(/index) found in cache.
2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Getting page
instance for /index.html
2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Page path: /index.html
2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Executing global actions.
2006-06-20 13:19:52,268 DEBUG [ScriptAction] Executing script:
/actions/global.bsh
2006-06-20 13:19:52,268 DEBUG [BSFScriptHandler] Executing script:
/actions/global.bsh
2006-06-20 13:19:52,278 DEBUG [bsh] In global.bsh
2006-06-20 13:19:52,278 DEBUG [bsh] Putting owner in context
2006-06-20 13:19:52,288 DEBUG [bsh] Contacts is null
2006-06-20 13:19:52,288 INFO  [ScriptAction] Elapsed time for
localhost://actions/global.bsh:20ms
2006-06-20 13:19:52,288 DEBUG [JPublishEngine] Executing path actions,
path: /index.html
2006-06-20 13:19:52,288 DEBUG [ScriptAction] Executing script: /actions/home.bsh
2006-06-20 13:19:52,288 DEBUG [BSFScriptHandler] Executing script:
/actions/home.bsh
2006-06-20 13:19:52,288 DEBUG [bsh] In home.bsh
2006-06-20 13:19:52,288 DEBUG [bsh] Getting nameToSearch...
2006-06-20 13:19:52,288 DEBUG [bsh] nameToSearch = null
2006-06-20 13:19:52,288 DEBUG [bsh] Calling getContacts...

The context is not cleared when the global script is called. So I made
processAction a global action and I'm still getting the same result.
Does redirect clear the context?

Thanks.


--
Rebel Geek
rebel.geek@...
954-839-6234


_______________________________________________
Jpublish-developer mailing list
Jpublish-developer@...
https://lists.sourceforge.net/lists/listinfo/jpublish-developer

Re: Navigation

by Florin T.PATRASCU :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Geek :)

Now let me refresh my memories....

1st of all, the PathActions *are* working the way you described and  
they are tied to the filter definition, the URL. What you experience  
is maybe a bug in 3.0?! I have to look at the code later on.

In respect of the context. Any redirect from an action will stop the  
rendering chain for the current page and the servlet will receive a  
new request *and* a new context is created for that specific request.  
I don't know if my English is good enough to explain this properly :
( sorry.

This is why some web frameworks are using all sort of tricks for  
maintaining the data on redirects:
  - use the Session
  - converting the context contents or the Session ones into an html  
encoded URL and then redirect with parameters
  - etc.

Basically a redirect will create a new server Request.

Cheers,
-florin


On 20-Jun-06, at 1:55 PM, Rebel Geek wrote:

> Hi all,
>
> I thought I knew what I was doing, but evidence show that I don't...
>
> Path-actions:
>
> I am under the impression that path-actions are independant actions
> (i.e. not ties to any page) that will execute when it is matched by a
> particular URL. This is not what is happening.
>
> The action of my form is called "processAction", but when I submit my
> form, JPublish complains that there is no "processAction/index.html".
> So what I did was create a blank page so that the action executes and
> it does, BUT I stuff things into the context and redirect to another
> page (context.put("redirect","index.html")). When I look at the logs,
> JPublish has cleared the context before calling index.html. Here is a
> sample of the log...
>
> (home.bsh is the action for index.html)
>
> 2006-06-20 13:19:52,048 DEBUG [JPublishEngine] Executing global  
> actions.
> 2006-06-20 13:19:52,048 DEBUG [ScriptAction] Executing script:
> /actions/global.bsh
> 2006-06-20 13:19:52,048 DEBUG [BSFScriptHandler] Executing script:
> /actions/global.bsh
> 2006-06-20 13:19:52,078 DEBUG [bsh] In global.bsh
> 2006-06-20 13:19:52,088 DEBUG [bsh] Putting owner in context
> 2006-06-20 13:19:52,118 DEBUG [bsh] Contacts is null
> 2006-06-20 13:19:52,118 INFO  [ScriptAction] Elapsed time for
> localhost://actions/global.bsh:70ms
> 2006-06-20 13:19:52,118 DEBUG [JPublishEngine] Executing path actions,
> path: /processAction.html
> 2006-06-20 13:19:52,118 DEBUG [ScriptAction] Executing script:
> /actions/processAction.bsh
> 2006-06-20 13:19:52,118 DEBUG [ScriptAction] Loading updated or new
> script: /actions/processAction.bsh
> 2006-06-20 13:19:52,118 DEBUG [BSFScriptHandler] Executing script:
> /actions/processAction.bsh
> 2006-06-20 13:19:52,128 DEBUG [bsh] In processAction.bsh
> 2006-06-20 13:19:52,228 DEBUG [bsh] Owner name is No User
> 2006-06-20 13:19:52,228 DEBUG [bsh] User clicked Find...
> 2006-06-20 13:19:52,228 DEBUG [bsh] Putting tina in context as  
> nameToSearch
> 2006-06-20 13:19:52,238 INFO  [ScriptAction] Elapsed time for
> localhost://actions/processAction.bsh:120ms
> 2006-06-20 13:19:52,238 DEBUG [JPublishEngine] Executing
> post-evaluation actions.
> 2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Real path: /index.html
> 2006-06-20 13:19:52,268 DEBUG [PathUtilities] Wildcard index: 0
> 2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Creating session  
> facade
> 2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Session facade:
> org.jpublish.servlet.HttpSessionFacade@993aaa
> 2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Content type for
> extension html is text/html; charset=ISO-8859-1
>
> *************************** Here's the culprit
> **********************************
> 2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Cleared the context
>
> 2006-06-20 13:19:52,268 DEBUG [JPublishServlet] Putting session in  
> the context
> 2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Rendering: /index.html
> 2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Adding
> org.jpublish.repository.DefaultRepository as content_repository
> 2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Executing pre-
> evaluation actions.
> 2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Checking if static
> resource exists: /index.html
> 2006-06-20 13:19:52,268 DEBUG [DefaultResourceManager]
> FileSystemManager:
> org.apache.commons.vfs.impl.DefaultFileSystemManager@a801b0
> 2006-06-20 13:19:52,268 DEBUG [DefaultResourceManager] Base file: /
> static
> 2006-06-20 13:19:52,268 DEBUG [DefaultResourceManager] File: /
> static/index.html
> 2006-06-20 13:19:52,268 DEBUG [DefaultResourceManager] File exists?  
> false
> 2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Static resource
> '/index.html' not found
> 2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Loading the page.
> 2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page name: index
> 2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page type: html
> 2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page path: /index
> 2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page parent:
> 2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Resolving page  
> index.xml
> 2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Looking for
> page:/pages/index.xml
> 2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Page definition
> (/index) found in cache.
> 2006-06-20 13:19:52,268 DEBUG [DefaultPageManager] Getting page
> instance for /index.html
> 2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Page path: /index.html
> 2006-06-20 13:19:52,268 DEBUG [JPublishEngine] Executing global  
> actions.
> 2006-06-20 13:19:52,268 DEBUG [ScriptAction] Executing script:
> /actions/global.bsh
> 2006-06-20 13:19:52,268 DEBUG [BSFScriptHandler] Executing script:
> /actions/global.bsh
> 2006-06-20 13:19:52,278 DEBUG [bsh] In global.bsh
> 2006-06-20 13:19:52,278 DEBUG [bsh] Putting owner in context
> 2006-06-20 13:19:52,288 DEBUG [bsh] Contacts is null
> 2006-06-20 13:19:52,288 INFO  [ScriptAction] Elapsed time for
> localhost://actions/global.bsh:20ms
> 2006-06-20 13:19:52,288 DEBUG [JPublishEngine] Executing path actions,
> path: /index.html
> 2006-06-20 13:19:52,288 DEBUG [ScriptAction] Executing script: /
> actions/home.bsh
> 2006-06-20 13:19:52,288 DEBUG [BSFScriptHandler] Executing script:
> /actions/home.bsh
> 2006-06-20 13:19:52,288 DEBUG [bsh] In home.bsh
> 2006-06-20 13:19:52,288 DEBUG [bsh] Getting nameToSearch...
> 2006-06-20 13:19:52,288 DEBUG [bsh] nameToSearch = null
> 2006-06-20 13:19:52,288 DEBUG [bsh] Calling getContacts...
>
> The context is not cleared when the global script is called. So I made
> processAction a global action and I'm still getting the same result.
> Does redirect clear the context?
>
> Thanks.
>
>
> --
> Rebel Geek
> rebel.geek@...
> 954-839-6234
>
>
> _______________________________________________
> Jpublish-developer mailing list
> Jpublish-developer@...
> https://lists.sourceforge.net/lists/listinfo/jpublish-developer



_______________________________________________
Jpublish-developer mailing list
Jpublish-developer@...
https://lists.sourceforge.net/lists/listinfo/jpublish-developer
LightInTheBox - Buy quality products at wholesale price