• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FrontMan dispatch to do a GET on a page/command?

 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I now know that I don't grok the difference between "forwardToView" and "forwardToCommand" and how that ties into the GET or POST commands.
I've read Bear's javadocs, and the JEE javadocs, and I don't get it.

I've got a nice Bean that declares:

@FrontmanCommand("avatarload")

at the end of its execute() function, I want to cause a GET on the page foo.jsp.
Neither forwardToCommand() nor forwardToView() does what I want, and I don't see how the redirectTo* would do better.

Enlightenment? or pointeres? greatly appreciated.

Thanks
Pat
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you want is the redirect. A forward simply forwards the current request to another resource. A redirect mandates that the browser issue another request -- your GET.
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:What you want is the redirect.



This seems to partly be the answer. From the FrontMan javadocs, it appears that
ctx.redirectToView("foo");
and
ctx.redirect("foo");
are the same, with the former just a conveniece wrapper to the latter. But I get different results.
Specifically, the latter works great. The first version throws an exception:


StandardWrapperValve[CommandBroker]: PWC1406: Servlet.service() for servlet CommandBroker threw exception
org.bibeault.frontman.ViewNotFoundException: View with name of foo not found
at org.bibeault.frontman.CommandBroker.findViewPath(CommandBroker.java:341)
at org.bibeault.frontman.CommandContextImplementation.makeViewURL(CommandContextImplementation.java:363)



So they clearly are not the same. What's the real difference? Why does one work and the other complain?

Thanks
Pat

p.s. there is a typo in the javadocs for "JavascriptStringEncoder"
it says "sue" when it should say "use"
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
redirect() redirects to the URl that you pass to it.

redirectToView() constructs a URL to the specified view (as a convenience) and then redirects to it. In your example, it will construct a redirect to foo.jsp in the folder that you specified as the views root in the init config.
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not getting this.

ctx.redirectToView("foo");

fails terribly

and
ctx.redirect("foo");

works perfectly. No need to move the foo.jsp file, or change anything.

I would expect them both to fail or both to work. But I'm not seeing this.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm actually surprised that the vanilla redirect works with that parameter. What exactly are you trying to redirect to?
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:I'm actually surprised that the vanilla redirect works with that parameter. What exactly are you trying to redirect to?



a simple JSP. I was using forwardToView, but it wasn't doing the GET, which led me to the initial posting in this thread.
It worked at one level using forwardToView, but was just finishing the initial request GET/POST. and I really want a new request.

Actually, I really would rather not clank out to the browser, but if that's what it takes, OK.

 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any ideas on how to debug this?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic