-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModelController mapping #46
Comments
Hi I see different solution for this. One ist mapping the DispatcherServlet to the root context '/'. The Another solution is loading the model javascripts from a script tag. Below Last solution is creating a simple servlet that calls the ModelGenerator. @WebServlet(urlPatterns = "/app/model/MODEL_NAME.js") @OverRide Ralph On Mon, Nov 5, 2012 at 11:53 AM, NeverwinterMoon
|
What if I use separate root application context and servlet context. Don't all servlet context beans have access to root application context beans? So, for instance, I can create servlet context for just ModelController and it will have access to RouterController which was exposed in root application context? |
I forgot about that. You are right this should work. On Mon, Nov 5, 2012 at 2:11 PM, NeverwinterMoon notifications@github.comwrote:
|
OK, I played around and finally got to a more or less suitable solution. I ended up with two different servlets for ExtDirectSpring stuff and ModelController. Those servlets have url filters "/controller/" and "/app/model/", but they both use the same context file. Something like this:
Everything else is in the root application context file. As for ModelController class, I just put the name of the model in the @RequestParam annotation, like so:
The downside is now there are two ways to access the ModelController: "/controller/MODEL_NAME.js" and "/app/model/MODEL_NAME.js". Not that big of a deal, I think. But yeah, decoupling ModelController from RouterController so it would be possible to have a separate servlet is a very nice idea. I'm definitely for it. Thanks for all the help. |
You could try and move the context:component-scan and The web.xml looks something like this. The /controller/.. context is empty org.springframework.web.servlet.DispatcherServlet On Mon, Nov 5, 2012 at 2:46 PM, NeverwinterMoon notifications@github.comwrote:
|
This is near perfection (I'm saying "near" only because there is still an urge to keep any controller beans definitions out of root context). Got everything nicely working that way. Thank you so much for all the help and for the wonderful tool that is ExtDirectSpring! |
I removed the "RouterController"-dependency in ModelGenerator. Now you can use it like this: @WebServlet(urlPatterns = "/app/model/Song.js")
} You can test this with the latest 1.2.3-SNAPSHOT |
I have a problem getting ModelController working while using Ext Loader.
I have configured a servlet with /controller/* url pattern and it works nicely with ExtDirectSpring.
Then I decided to try out ModelController and ran into a problem. Ext Loader is trying to access /app/model/MODEL_NAME.js and I have the same path mapped with @RequestMapping on the corresponding method. Seeing as my servlet is filtering only /controller/*, the working path would be /controller/app/model/MODEL_NAME.js which Ext Loader doesn't know about.
I tried creating another servlet and filtered url the following way: "/app/model/*" and then changed @RequestMapping to just "MODEL_NAME.js". Everything seems to be in the right places but app just doesn't start up anymore.
I don't have vast expertise of Spring, so I might be confusing something. Any help would be appreciated.
Loving your project so far.
The text was updated successfully, but these errors were encountered: