Discussion:
spring controller redirect ModelAndView to a wicket panel class
extraquoo
2018-09-06 23:07:22 UTC
Permalink
Hi
my project is implemented by two frameworks: spring web flow and wicket.
Now in one of the spring controller, I want to the spring ModelAndView
redirects to an existing wicket panel class.

the code of spring controller is below :
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
......
if (StringHelper.isValid(startAppEvent)) {
return new
ModelAndView("redirect:../services/continueApplication?_eventId=startApp&_flowExecutionKey="+
flowExecutionKey);
}else if (StringHelper.isValid(cboVerifEvent)){
return new ModelAndView("");// want to redirect to wicket panel
}

I also have an existing panel class: ImageUploadsPanel

then how can ModelAndView redirect and pass parameters to call the panel
class?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Bas Gooren
2018-09-07 10:17:07 UTC
Permalink
Hi!

Wicket and Spring have different render cycles, so if you want to redirect
from spring to a wicket panel, you’ll need to put the wicket panel in a
page and expose that page on a public url by mounting it.

That wicket page can then take url parameters (either path or query
params), which you can extract and use to construct your panel in any way
you need.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 7 september 2018 bij 06:20:54, extraquoo (***@gmail.com) schreef:

Hi
my project is implemented by two frameworks: spring web flow and wicket.
Now in one of the spring controller, I want to the spring ModelAndView
redirects to an existing wicket panel class.

the code of spring controller is below :
protected ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
......
if (StringHelper.isValid(startAppEvent)) {
return new
ModelAndView("redirect:../services/continueApplication?_eventId=startApp&_flowExecutionKey="+

flowExecutionKey);
}else if (StringHelper.isValid(cboVerifEvent)){
return new ModelAndView("");// want to redirect to wicket panel
}

I also have an existing panel class: ImageUploadsPanel

then how can ModelAndView redirect and pass parameters to call the panel
class?
--
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
extraquoo
2018-09-07 16:14:51 UTC
Permalink
just correct that the panel class is CaseVerificationUploadsPanel

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
extraquoo
2018-09-07 16:12:45 UTC
Permalink
Thanks for your answer.

The panel class has its HTML file and it is mounting in the startup
initialization

mountBookmarkablePage("/CaseVerificationUpload.html",CaseVerificationUploadsPage.class);

when I am using
return new ModelAndView("redirect:../CaseVerificationUpload.html")
then the application kicks me out to the login page

then I change to
return new ModelAndView("/CaseVerificationUpload.html")
I get stack trace saying
org.apache.wicket.WicketRuntimeException: javax.servlet.ServletException: No
Tiles definition found for name 'CaseVerificationUpload.html'

am I missing some configuration ? Can you tell me what is the correct value
to put in the ModelAndView?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Bas Gooren
2018-09-08 08:49:28 UTC
Permalink
Hi!


I’m not sure why wicket is wrapping a spring exception. Sounds like wicket
is not handling the request, but passing it on to spring.


I don’t use spring on a daily basis, but from what I read you should be
using a “redirect:[url]”-style model and view.

Which login page is shown? Your wicket one or the spring one?


Of the two pages/urls in question (your spring endpoint running the code
you’ve shown and the wicket page), which ones require authentication?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 7 september 2018 bij 20:24:35, extraquoo (***@gmail.com) schreef:

Thanks for your answer.

The panel class has its HTML file and it is mounting in the startup
initialization br/> <
mountBookmarkablePage("/CaseVerificationUpload.html",CaseVerificationUploadsPage.class);


when I am using
return new ModelAndView("redirect:../CaseVerificationUpload.html")
then the application kicks me out to the login page

then I change to br/>return new
ModelAndView(""/CaseVerificationUpload.html")
I get stack trace saying br/>org.apache.wicket.WicketRuntimeEException:
javax.servlet.ServletException: No
Tiles definition found for name 'CaseVerificationUpload.html'

am I missing some configuration ? Can you tell me what is the correct value
to put in the ModelAndView? br/> <
--
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
extraquoo
2018-09-10 16:22:37 UTC
Permalink
the purpose is the clients want to reuse an existing wicket html page for
some enhancement in a spring mvc flow of business.
I am trying three ways "redirect:../[url]" , "redirect:[url]" and "/[url]"
.The first two just kicks me out and return to the application home page
which is coded by wicket. The last one is throwing stack trace of apache
tiles which is used by spring mvc/spring web flow.

you are right, the wicket owns authentication functionality when a user
logins the application. Maybe this is the root cause of kick out. Not sure
if it could pass the entire session of authentication by some additional
code or config file ?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Bas Gooren
2018-09-10 20:56:47 UTC
Permalink
Hi!


Sounds like wicket is redirecting to the login page due to the user not
being authenticated.


To handle cross-framework authorization, I suggest you either share the
http session, use a shared security framework (e.g. apache shiro) or (what
we do every now and then) have a shared list of one-time-tokens so you can
forward to wicket with that token and wicket can fetch the user based on
the token.


In any case, can you debug the code? If you set some breakpoint I think
you’ll figure out quickly where the problem lies :-)


Good luck.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 10 september 2018 bij 20:01:31, extraquoo (***@gmail.com) schreef:

the purpose is the clients want to reuse an existing wicket html page for
some enhancement in a spring mvc flow of business. br/>I am ttrying three
ways "redirect:../[url]" , "redirect:[url]" and "/[url]"
.The first two just kicks me out and return to the application home page
which is coded by wicket. The last one is throwing stack trace of apache
tiles which is used by spring mvc/spring web flow.

you are right, the wicket owns authentication functionality when a user
logins the application. Maybe this is the root cause of kick out. Not sure
if it could pass the entire session of authentication by some additional
code or config file ?
--
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
extraquoo
2018-09-11 16:01:31 UTC
Permalink
thank you for your advice. I will let our architect team investigate such an
integration problem.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org

Loading...