spring

Spring servlet mapping - no css or jsp!

I read over this post, which is similar to my issue, but had no luck solving the problem: Basically I used to have the following servlet-mapping in my web.xml: <servlet-mapping> <servlet-name>myServlet</servlet-name> <url-pattern>/index.html</url-pattern> <url-pattern>/channel1</url-pattern> <url-pattern>/channel2</url-pattern>...

Are all methods proxied when using Spring AOP?

When using Spring AOP to create a proxy for a class using NameMatchMethodPointcutAdvisor and BeanNameAutoProxyCreator does this essentially proxy every call to the object, but only apply the advice to the matched methods, or somehow create a Proxied object that only has those methods and uses the normal object for the calls that are supp...

Write file data as Bzip2 to output of servlet response

I'm trying to get Tomcat to write out the servlet contents as a bzip2 file (Silly requirement perhaps but it's apparently necessary for some integration work). I'm using the Spring framework so this is in an AbstractController. I'm using the bzip2 library from http://www.kohsuke.org/bzip2/ I can get the contents bzipped fine but when...

Eclipse link jpa problem

With two users simultaneously using my simple app, I'm getting exception: Error Code: 0 Call: SELECT ID, NAME, IMAGE FROM GameObjectTable ORDER BY ID ASC Query: ReadAllQuery(referenceClass=GameObject sql="SELECT ID, NAME, IMAGE FROM GameObjectTable ORDER BY ID ASC") Caused by: org.postgresql.util.PSQLException: There was In/Out error w...

Taking advantage of Hibernate lazy loading?

I have a domain object that has an attribute which is a collection containing another domain object. This is accomplished using a hibernate mapping (which eventually performs a join on another table). Hibernate, by default, seems to lazily instantiate this collection. This turns out to be a great thing because, depending upon what I n...

Can webapplication be notified that the web container (ex. Tomcat) is reloading, unloading or shutting down

I have a Wicket Web Application running in Tomcat. The application uses Spring (via org.springframework.web.context.ContextLoaderListener) to initialise the application. This is all well and good for start up, but what I would also like is to receive some sort of notification that the Context is being destroyed so that I can shutdown spa...

Spring: constructor injection of primitive values (properties) with annotation based configuration

I'm trying to configure a class with Annotation based configuration in Spring 3, which takes primitive values as its constructor arguments: @Component class MyBean { MyBean(String arg1, String arg2) { // ... } } And an application context like this: <beans [...]> <context:component-scan base-package="com.example" /> <cont...

Is there is any way to protect the password in .xml using spring

Is there is any way to protect database password in -servlet.xml file using spring <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property> <property name="url"><value>jdbc:mysql:///BUSINESS</value></property> <proper...

Spring mail support - no subject

I have updated my libraries, and now e-mails are sent without subject. I don't know where this happened... Mail API is 1.4.3., Spring 2.5.6. and Spring Integration Mail 1.0.3.RELEASE. <!-- Definitions for SMTP server --> <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="host" value=...

Repackage several WARs into one EAR

Greetings, I'm working on a project that have several webapps (WARs) built with Maven and deployed in a JEE. These WARs share several common business JARS (like one containing domain objects which are loaded from hibernate) and other framework JARs like Spring and Hibernate. They use Spring MVC, and the Application Context loads Hiber...

Testing Spring @MVC annotations

I ran into a problem the other day where a @Valid annotation was accidentally removed from a controller class. Unfortunately, it didn't break any of our tests. None of our unit tests actually exercise the Spring AnnotationMethodHandlerAdapter pathway. We just test our controller classes directly. How can I write a unit or integration...

How should I secure my webapp written using Wicket, Spring, and JPA?

So, I have an web-based application that is using the Wicket 1.4 framework, and it uses Spring beans, the Java Persistence API (JPA), and the OpenSessionInView pattern. I'm hoping to find a security model that is declarative, but doesn't require gobs of XML configuration -- I'd prefer annotations. Here are the options so far: Spring S...

Single DispatcherServlet with Multiple Controllers

I am trying to create some restful web services using Spring MVC 3.0. I currently have an issue that only 1 of my 2 controllers will work at any given time. As it turns out, whichever class comes first when sorted alphabetically will work properly. The error I get is: handleNoSuchRequestHandlingMethod No matching handler method fou...

Spring beans, Lifecycle in a XmlWebApplicationContext (web context)

I have already found a previous SF question regarding this issue and I believe setting the init-method and the destroy-method properties will be sufficient. But I wanted to hopefully ask the question a different way to further my understanding. If I understand things correctly, a class that implements org.springframework.context.Lifecyc...

Get Spring Security intercept urls from database or properties

Hopefully this is super simple, exists, and I'm overlooking something right under my nose. I know that I can restrict access via annotations: @Secured({"ROLE_ADMIN"}) or via config: <security:intercept-url pattern="/**" access="ROLE_USER, ROLE_ADMIN, ROLE_SUPER_USER" /> I would prefer to obtain authentication rules from a database...

Efficient way to implement a client multiple file upload service

What is an efficient way to implement a multiple file client upload service? Are there any popular libraries for that? Basically I'm looking at a Web view, served a client, that would allow them to upload files: i.e browse their file system and choose say up to 6 files. Is implementing the above service better than a single file upload-...

connection timed out error while deploying spring app

I’m trying to deploy a simple Spring app and getting a “connection timed out ” error. My app tries to take a text input from the user in one jsp, insert that value under username in the db and then display that name in another jsp along with a greeting eg: "hello, " My environment: OS: Windows XP professional Server : Tomcat 6 IDE: ...

How do I configure Spring Security 2 database authentication with Hibernate 3 Annotated Classes?

Hi, I'm building an app using Hibernate 3 (with JPA Annotations), Spring 2.5 and Spring Security 2.0.5. I want to know what I need to put in my <authentication-provider> tag in my spring security config file (applicationContext-security.xml) so that I can get Spring Security to use my existing Service layer class (AuthenticationService...

spring security AuthenticationManager vs AuthenticationProvider?

Can someone tell me different between an AuthenticationManager and an AuthenticationProvider in spring security? How are they used and how are they called. It is my understanding that a SecurityFilter will call the AuthenticationManager to authentication an Authentication object? But then where does the AuthenticationProvider come into ...

ModelAttributes not accessible on jsp

Created a new Spring MVC project using MAven and Im having a problem where the modelAttributes are not getting substituted on the jsp page. For eg., <%@ page session="false"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ page contentType="text/html...