History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-984
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Graeme Rocher
Reporter: Michael Baehr
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Grails

redirect() in controller fails for Tomcat

Created: 27/Mar/07 09:16 AM   Updated: 13/Apr/07 01:23 PM
Component/s: Controllers
Affects Version/s: 0.5-RC1
Fix Version/s: 0.5-RC1

Time Tracking:
Not Specified


 Description  « Hide
Using redirect() in a controller works for Jetty, but not for Tomcat, as no redirect request is sent to the browser.

It is suspected that the new url mapping feature causes this.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Graeme Rocher - 29/Mar/07 07:22 AM
implemented a fix. Appears to work on local tomcat 5.5.28

Michael Baehr - 29/Mar/07 03:07 PM
Works on my local tomcat 5.0.27 as well! Thanks alot!

Michael Baehr - 31/Mar/07 11:52 PM
Maybe I was a little fast ...

I'm sure it was working, but now it doesn't any more!

I tried a war in 5.0.28, 5.5.23 and 6.0.10 and the redirect did not work.

I installed the latest snapshot and created a new application. Again, the redirect() did not work in Tomcat!

Can you try again locally?


Michael Baehr - 02/Apr/07 01:22 PM
I checked out latest from trunk and build Grails myself.

I wrote a shell script that

  • deploys the Grails build
  • creates a new Grails application
  • creates a simple controller with two actions (actiona & actionb) where the one (actiona) redirects to the other (actionb)
  • creates a war
  • deploys it to a Tomcat webapps directory
  • starts Tomcat
  • accesses actiona via wget
  • checks if a redirection to actionb happened

On all my Tomat versions on Windows & Linux, redirect() didn't work.

So I'm afraid you'll have to reopen this issue.


Michael Baehr - 02/Apr/07 09:57 PM
Doesn't work in Glassfish V2 Milestone 4 either. Couldn't get the application to run at all under Resin 3.1, but that seems to be an unrelated issue

I think the priority should be raised to "Blocker".


Sergey Nebolsin - 03/Apr/07 12:25 AM
Not work for me on Tomcat 6.0.10 too.

Corey - 06/Apr/07 01:50 AM

Same here – apparently – I tried deploying to Jetty 6.1, and any actions that do redirects results in the browser just sitting there, churning along indefinitely without ever reaching the destination page/view/action.

Using a 0.5-SNAPSHOT from this morning.


Graeme Rocher - 11/Apr/07 11:02 AM
defo fixed this time

Michael Baehr - 11/Apr/07 01:39 PM
I wished I could confirm this, but here I still don't see redirect() working with Tomcat ...

Graeme Rocher - 11/Apr/07 03:24 PM
Can you please attache a test case. It works locally for me.

Michael Baehr - 11/Apr/07 04:15 PM
Ok, I just saw that while fiddling around to find the cause of this problem, I replaced the redirect() with chain() in my test script.

Using redirect(), it indeed works here for me, too!

But shouldn't chain() work as well? I mean, isn't redirect(action:'otheraction') and chain(action:'otheraction') basically the same, ignoring that chain() can also pass model data around?


Graeme Rocher - 11/Apr/07 04:31 PM
They call different code, I'll look into chain too and fix it

Corey - 13/Apr/07 01:44 AM

Could someone else test on Jetty 6.1.1? Things are better than they were, however I'm still seeing some various problems that aren't making sense to me. Someone with more experience might be better apt to understand and correlate the issues.

Corey - 13/Apr/07 02:28 AM

OK - I think I see what's going on w/ jetty 6.1.1 now: it's as if both 'redirects()' and 'chains()' are just simply being ignored/discarded; instead what happens is the action will just do the default render gsp.

So:

// UserController.groovy

   def home = {

      redirect( controller: 'site', action: 'list' )

   }

doesn't actually redirect to the list action of SiteController, what it does is attempt to render .../views/user/home.gsp

( of course when home.gsp doesn't exist, then I get a:

HTTP ERROR: 500

/WEB-INF/grails-app/views/user/home.jsp

Graeme Rocher - 13/Apr/07 05:40 AM
Ok i've put in some new code that changes quite a few things, I haven't tested it against Jetty 6, but believe it will work, could you test again? Michael could you also re-test for you, it works on my local tomcat 5.5.28, on glassfish and jetty

Cheers
Graeme


Graeme Rocher - 13/Apr/07 05:41 AM
Also note this should hopefully also correct the chain method

Sergey Nebolsin - 13/Apr/07 05:51 AM
Works for me on local Tomcat 6.0.7 and production Tomcat 6.0.10

Michael Baehr - 13/Apr/07 08:27 AM
Both redirect() and chain() work on

Tomcat 5.0.28
Tomcat 5.5.23 (I always wonder where you get 5.5.28 from ...)
Tomcat 6.0.10


Corey - 13/Apr/07 01:08 PM

Using a snapshot downloaded one hour ago, I see no change in the behavior when deployed to jetty-6.1.1 .

redirect's and chain's are simply being ignored, and the default view is rendered for the action regardless.


Corey - 13/Apr/07 01:23 PM

Apologies - I accidentally tested using a war generated against yesterday's snapshot and not the most recent snapshot. Sorry for the noise.

It works!

Many, many sincere thanks to you Graeme - I can deploy!