I know the Commons Validator framework is the de facto standard for Struts projects to validate input values both on the server side and the client side.
Is the same true for Spring MVC projects?
The reason I get the impression that it may not is that most Struts books and forums talk a lot about the Commons Validator framework, but only a few Spring books and forums do.
What's the best practice for validating input in Spring MVC projects?
Cheers!
Commons Validator is more or less obsolete now, following the introduction of the JSR-303 Validation API, which Spring 3 fully supports. It's an annotation-driven declarative framework.
See the relevant parts (here and here) of the Spring docs to see how Spring uses it.
These examples of server-side validation using JSR-330 rich client-side validation with Spring MVC should give you some easy-to-follow examples to get you started.
Related
I want to create a REST web service using Jersey. I also want to use Spring in the project. Now, my questions is the following:
I don't see any reason for integrating these 2 together in my application. So, I should be able to use Spring for bean management and Jersey for creating the web service. Am I correct, or Spring and Jersey somehow have to be integrated.
I see that there is a jersey-spring maven project, and so, I assume that this is for the purpose of integrating jersey and spring together. My question here is do I get any benefit of using this integrated form rather than simply use Jersey and Spring separately each for its own functionality?
Thanks,
Cyrus
You can absolutely combine the two projects. However, I would encourage you to look at Spring-MVC for doing REST as it is very powerful and easy to use. If memory serves, the jersey-spring project was helpful in integration of JAXB and other touch points. Again, this is all built into Spring. And if you use Spring-Boot it is amazingly simple to get running.
The jersey-spring project provides integration between Jersey and Spring. It allows you to wire in any beans in your Spring context into Jersey and vice-versa.
For instance, if you are using spring-security, it will provide your spring-security principal when wiring the Jersey specific SecurityContext into any of your REST resources.
If you want to access Spring beans from your Jersey REST endpoints (or use Spring Beans as implementations for your JAX-RS interfaces) you need to integrate Spring and Jersey, otherwise it won't work. If you don't have any connections between Spring beans and your REST endpoints, then it is not necessary.
I think your first statement is correct. I have used Jersey and Sprint as separate entities.
Jersey is really awesome to create a web server.
Spring is useful for dependency injection (beans) and other cools stuff.
About your second statement, I do not know anything jersey-spring maven project.
My suggestion/opinion is to do as your first comment. Use them in a separate way. You will have the best of both worlds. Using jersey-spring maven project might be a complication and maybe it is not what you want. Libraries usually are intend to be independent.
Are there any Web Application Template Generators...
Something that would generate a Template Web application for me using the following technologies (or whatever i choose):
Spring MVC
Spring Security
JPA
Hibernate
JQuery
Idea is to have all the mundane stuff, already in place.
I found 'appfuse', but i can't find meaningful documentation on it.
Its QuickStart application uses Struts(instead of Spring mvc) - which i do not want to use.
Any other ideas?
I think Spring Roo is what you are looking for.
Spring Roo can easily generate configuration and sample template for most technologies which you mentioned.
I am trying to change Dropwizard to support Shiro.
I have read documentation and am little puzzled. I would like to utilize Shiro in conjunction with form login authentication and Apache Shiro Annotations. I think that I need to use Jersey Filters to support Shiro.
Is this the correct way to support Shiro annotations at Jersey instead of classic Shiro Filter approach?
Since Jersey Filters have decent access to resources with annotations, it seems perfect for me to use annotations.
I rather not use the AOP approach, and It could be really great to have on the fly integration with JAX-RS as a separated module.
Someone has already created a solution for what you are asking.
Shiro with Jersey.
https://github.com/javajack/shiro-jersey
Shiro For Dropwizard
https://github.com/javajack/shiro-jdbi-realm
Dropwizard Shiro Budle Example
https://github.com/javajack/dw-shiro-bundle
I am new to spring annotation and i want to create a sample example which shows the use of #Cacheable annotation in spring 3.1 does any one have guidance to create this ?
Hope following link may be helpful to you... A sample application.
Also have a look on Spring's documentation for cache abstraction and spring source blog post.
There are lots of links to learn from
simple-spring-memcached
Cache Abstraction Spring 3.2
Spring Expression Language (SpEL) Spring 3.2
Cache abstraction in Spring 3/
I did a POC using spring cache, Simple Spring Memcached and Memcache. The svn link of working application code is here
Simple Spring Memcached – Spring Caching Abstraction and Memcached
I would like to change Spring Framework to Google Guice, because it's lighter and has almost everything I need. Is it possible to use Spring Security with Google Guice instead of Spring Framework?
No. Spring Security makes extensive use of the core Spring Framework.
(I guess, in theory you could use Spring + Spring Security for the security filters, and Google Guice for the servlet wiring ... but I expect there would be a few traps and pitfalls on that road.)