/appName/controllerName/actionName/id url does not work?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

/appName/controllerName/actionName/id url does not work?

Yasu
Hello,
  I started playing with Grails a few days ago and think that it has a
lot of potential. I especially like the ability to specify the arbitrary
Hibernate mapping.  This would be really useful when connectivity to  a
legacy database  is requirement.

I am building small application for testing.  Along the way, I
encountered a problem with url mapping.

I checked Grails out from cvs repository on Saturday.  After I did cvs
update yesterday,  I found that /appName/controllerName/actionName/id
style url, which was working until Sunday, stopped working.  It still
works if I specify the id as key=value style url parameter. (like
/app/controller/action?id=1)
Following is a excerpt of the log file where this problem occurred.

   [script] Opening single Hibernate Session in OpenSessionInViewFilter
   [script] Testing handler map
[org.codehaus.groovy.grails.web.servlet.mvc.GrailsUrlHandlerMapping@17447c5]
in DispatcherServlet with name 'grails'
   [script] Looking up handler for [/user/show/1]
   [script] No handler found in getLastModified
   [script] DispatcherServlet with name 'grails' received request for
[/mobilerss/user/show/1]
   [script] Testing handler map
[org.codehaus.groovy.grails.web.servlet.mvc.GrailsUrlHandlerMapping@17447c5]
in DispatcherServlet with name 'grails'
   [script] Looking up handler for [/user/show/1]
   [script] No mapping for [/mobilerss/user/show/1] in DispatcherServlet
with name 'grails'
   [script] Successfully completed request
   [script] Closing single Hibernate Session in OpenSessionInViewFilter

Interestingly, this type of url mapping still works for scaffolding
actions.  I am new to both groovy and grails, so it is entirely possible
that I am missing something, but above error seem to occur only when the
action is a closure.

Any insight?

Reply | Threaded
Open this post in threaded view
|

Re: /appName/controllerName/actionName/id url does not work?

Yasu
Ok, I am answering to my own question.

The cause was missing "/controllerName/closureName/**" mapping for
non-scaffolding actions in
 org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass.java.
After adding
                uri2closureMap.put(tmpUri + SLASH + "**", closureName);
at line 128, the url started working.

Now, looking at the CVS history, I think I might be wrong in saying that
the url used to work, I may be mistaken the scaffolding with normal
closure actions.  But I think it should work since 'grails
generate-views' will create views using the /controller/action/id style url.


Yasuhiko Sakakibara wrote:

> Hello,
>  I started playing with Grails a few days ago and think that it has a
> lot of potential. I especially like the ability to specify the
> arbitrary Hibernate mapping.  This would be really useful when
> connectivity to  a legacy database  is requirement.
> I am building small application for testing.  Along the way, I
> encountered a problem with url mapping.
>
> I checked Grails out from cvs repository on Saturday.  After I did cvs
> update yesterday,  I found that /appName/controllerName/actionName/id
> style url, which was working until Sunday, stopped working.  It still
> works if I specify the id as key=value style url parameter. (like
> /app/controller/action?id=1)
> Following is a excerpt of the log file where this problem occurred.
>
>   [script] Opening single Hibernate Session in OpenSessionInViewFilter
>   [script] Testing handler map
> [org.codehaus.groovy.grails.web.servlet.mvc.GrailsUrlHandlerMapping@17447c5]
> in DispatcherServlet with name 'grails'
>   [script] Looking up handler for [/user/show/1]
>   [script] No handler found in getLastModified
>   [script] DispatcherServlet with name 'grails' received request for
> [/mobilerss/user/show/1]
>   [script] Testing handler map
> [org.codehaus.groovy.grails.web.servlet.mvc.GrailsUrlHandlerMapping@17447c5]
> in DispatcherServlet with name 'grails'
>   [script] Looking up handler for [/user/show/1]
>   [script] No mapping for [/mobilerss/user/show/1] in
> DispatcherServlet with name 'grails'
>   [script] Successfully completed request
>   [script] Closing single Hibernate Session in OpenSessionInViewFilter
>
> Interestingly, this type of url mapping still works for scaffolding
> actions.  I am new to both groovy and grails, so it is entirely
> possible that I am missing something, but above error seem to occur
> only when the action is a closure.
>
> Any insight?
>

Reply | Threaded
Open this post in threaded view
|

Re: /appName/controllerName/actionName/id url does not work?

graemer
Thanks for the report I this is fixed in CVS head and I have added
more unit tests so that it does'nt happen again

Cheers
Graeme

On 3/22/06, Yasuhiko Sakakibara <[hidden email]> wrote:

> Ok, I am answering to my own question.
>
> The cause was missing "/controllerName/closureName/**" mapping for
> non-scaffolding actions in
>  org.codehaus.groovy.grails.commons.DefaultGrailsControllerClass.java.
> After adding
>                 uri2closureMap.put(tmpUri + SLASH + "**", closureName);
> at line 128, the url started working.
>
> Now, looking at the CVS history, I think I might be wrong in saying that
> the url used to work, I may be mistaken the scaffolding with normal
> closure actions.  But I think it should work since 'grails
> generate-views' will create views using the /controller/action/id style url.
>
>
> Yasuhiko Sakakibara wrote:
>
> > Hello,
> >  I started playing with Grails a few days ago and think that it has a
> > lot of potential. I especially like the ability to specify the
> > arbitrary Hibernate mapping.  This would be really useful when
> > connectivity to  a legacy database  is requirement.
> > I am building small application for testing.  Along the way, I
> > encountered a problem with url mapping.
> >
> > I checked Grails out from cvs repository on Saturday.  After I did cvs
> > update yesterday,  I found that /appName/controllerName/actionName/id
> > style url, which was working until Sunday, stopped working.  It still
> > works if I specify the id as key=value style url parameter. (like
> > /app/controller/action?id=1)
> > Following is a excerpt of the log file where this problem occurred.
> >
> >   [script] Opening single Hibernate Session in OpenSessionInViewFilter
> >   [script] Testing handler map
> > [org.codehaus.groovy.grails.web.servlet.mvc.GrailsUrlHandlerMapping@17447c5]
> > in DispatcherServlet with name 'grails'
> >   [script] Looking up handler for [/user/show/1]
> >   [script] No handler found in getLastModified
> >   [script] DispatcherServlet with name 'grails' received request for
> > [/mobilerss/user/show/1]
> >   [script] Testing handler map
> > [org.codehaus.groovy.grails.web.servlet.mvc.GrailsUrlHandlerMapping@17447c5]
> > in DispatcherServlet with name 'grails'
> >   [script] Looking up handler for [/user/show/1]
> >   [script] No mapping for [/mobilerss/user/show/1] in
> > DispatcherServlet with name 'grails'
> >   [script] Successfully completed request
> >   [script] Closing single Hibernate Session in OpenSessionInViewFilter
> >
> > Interestingly, this type of url mapping still works for scaffolding
> > actions.  I am new to both groovy and grails, so it is entirely
> > possible that I am missing something, but above error seem to occur
> > only when the action is a closure.
> >
> > Any insight?
> >
>
>