Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring MVC Request mapping, can this be dynamic/configurable?
    primarykey
    data
    text
    <p>With Spring MVC, I know how you set the <code>RequestMapping</code> in every controller and method/action.</p> <p>But what if I wanted this to be configurable, so for example I the following controllers:</p> <pre><code>BlogController - with methods for listing blogs entries, single entry, new, update, etc. ArticleController - with methods for listing articles entries, single entry, new, update, etc. </code></pre> <p>Now in my application, the administrator can setup 2 blogs for the webiste, and 1 article section so the urls would be like:</p> <pre><code>www.example.com/article_section1/ - uses ArticleController www.example.com/blog1/ - uses BlogController www.example.com/blog2/ - uses BlogController </code></pre> <p>Maybe after a while the administrator wants another article section, so they just configure that with a new section like:</p> <pre><code>www.example.com/article_section2/ </code></pre> <p><strong>This has to work dynamically/on-the-fly without having to restart the application of course.</strong></p> <p>My question is only concerned with how I will handle url mappings to my controllers.</p> <p>How would this be possible with Spring MVC?</p> <p>I only know how to map urls to controllers using <code>@RequestMapping("/helloWorld")</code> at the controller or method level, but this makes the url mappings fixed and not configurable like how I want it.</p> <p><strong>Update:</strong></p> <p>I will be storing the paths in the database, and with the mapping to the type of controller so like:</p> <pre><code>path controller /article_section1/ article /blog1/ blog /blog2/ blog .. </code></pre> <p>With the above information, how could I dispatch the request to the correct controller?</p> <p>Again, not looking to reload/redeploy, and I realize this will require more work but its in the spec :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload