Marten, do you know where that post is?
Type: Posts; User: SpringOrSummer; Keyword(s):
Marten, do you know where that post is?
Is there a low level explanation on how spring goes about mapping the urls that we define using annotations?
I'm guessing it is something like this, but would be interested if someone can explain...
I did find a post where you were involved, but I'm nto sure if it was 3.1 or not.
I'll try and find it again.
In my spring mvc application, I am using annotations on the controllers.
What handlermapping implementation will map my urls to controller methods then? (I use requestmapping("/home")
As a...
Now that worked for the method level, but failed when I added the annotation at the controller level.
My code:
HandlerMethod handlerMethod = (HandlerMethod) handler;
...
Marten,
So when I add the same annotation on a controller method, it doesn't seem to work i.e. authenticationRequiredAnnotation == null (see below)
Any ideas why this may be?
...
Is there an example of spring MVC with an embedded jetty instance?
I would really appreciate if someone has a working example of how to create a main class with an embedded jetty instance using...
I have a UserForm.java file, that has:
public class UserForm {
@NotNull(message = "Email cannot be empty.")
@Size(min=3, max=100, message="Email must be between 3 and 100 characters...
My create controller method looks like this:
@RequestMapping(value = "/create", method = RequestMethod.POST)
public ModelAndView create(@Valid AccountForm accountForm, BindingResult...
Actually I take that back, if any of my form fields are empty, it crashes before the controller that handles the post can get fired.
Seems like the validation runs, and fails, and throws the...
Ok it was crashing because in my html I had name="name" instead of "accountName".
OK so this is what I have now:
@RequestMapping(value = "/create", method = RequestMethod.POST)
public ModelAndView create(@Valid @ModelAttribute("accountForm") AccountForm accountForm,...
So would the @ModelAttribute be included with the @Valid attribute?
I have a controller action that works fine.
I want to create an 'alias' url that will just call my original action.
How can I do this?
@RequestMapping("/original/url")
...
..
I have a custom configuration object that I use in my application, and it is loaded from a yaml file.
I have overriden the toString for this object and want to output to logs during application...
Thanks for some reason it isn't working, I did this:
String configPath = "/Users/me/path/to/config/spring-context.xml";
ApplicationContext springContext = new...
My spring xml file is in a directory that isn't in the class path.
The file exists, but when I try and load it spring says the file doesn't exist:
ApplicationContext context = new...
Forgot to mention, maybe this effects things, but I am manually loading the context (since it is a 'main' type application):
ApplicationContext springContext = new...
For some reason when I moved some of my code over to a 'main' console type application, the autowiring isn't working.
Before the code was in a MVC application and I had:
...
Marten,
Thanks that worked, I actually didn't have any annotations on my annotation! (and it wasn't working)
I just added the Retention and Target and now it works.
I'm guessing TYPE is at...
Ok I am getting access to the handlermethod (thanks for that link!), but having an issue with the annotation, it is always null for some reason.
First time created an annotation so that might be...
Marten,
Yes that is what I am currently doing, but not in a programatic way per say.
Currently I am looking at the url, for example, if my controller is ProductController like:
...
Is it possible to create a controller level annotation that will check if there are specific objects in the request Attributes collection?
If not, I want to redirect to the signin page.
I...
I create an object in an interceptor and add it to the request attributes collection.
I need access to this object in my controller and view, currently in each and every controller action I am...
Yes pretty much.
So looking at the quickstart, you have to create a @Configuration (which is the programatic way of wiring up beans as oppose to the xml way). So I'll look into that to see how...