spring

specific user data using Spring 3 REST

I'm trying to find the standard way to handle user authentication in a RESTful webservice using spring. i want to allow a LOGGED IN user to access only specific information that applies to him. i found 2 ways of doing that: using HandlerInterceptorAdapter i can take the HttpServletResponse and from it i can take the session. in the s...

Where to keep large SQL queries when usuing Spring's JdbcTemplate classes

I'm developing a DAO using Spring JdbcDaoSupport and would like to know if anyone can suggest best practice for externalizing the SQL from the Java code. I'm used to using Hibernate and iBatis for this kind of project and like the way that the queries are not held in the Java code. Due to the complexity of the data access (accessing dif...

Set up error handling in Jetty with Spring

Is it possible to convert the following Jetty XML configuration snippet <Configure class="org.mortbay.jetty.webapp.WebAppContext"> <Get name="errorHandler"> <Call name="addErrorPage"> <Arg type="int">500</Arg> <Arg type="int">599</Arg> <Arg type="String">/dump/errorCodeRangeMapping</Arg> </Call> </Get> </Co...

Configuring HttpClient in Spring using Basic Authentication

Hi all, I'm implementing a SOLR server in our application. We use the CommonsHttpSolrServer in the SolrJ package to connect to our solr server which uses the commons-httpclient. We also use Spring. Now our sysadmin secured the solr server (with good reason) and used Basic Auth. How can I instantiate a HttpClient with Basic Auth to be ...

In Spring MVC custom JSP tag: "Cannot find symbol": pageContext

Why would the pageContext variable not be findable in this custom tag installed in the WEB-INF/tags directory of a Spring MVC app? <%@ tag import="com.ocpsoft.pretty.time.PrettyTime, java.util.Date"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ attribute name="dateParam" required="true" type="java.util.Date" %> ...

Mockito mocks with Spring: "Argument passed to verify() is not a mock!"

Hello, I used the code from this blog to inject Mockito mocks in my unit tests. However, before the mock is autowired it gets wrapped by Spring in a JDK proxy. This causes any verify(autowiredMock) to throw "Argument passed to verify() is not a mock!". The exception is thrown when Mockito is checking that the argument passed to verify(....

How to proxy spring milestone repo using nexus.

I want to proxy the spring milestone repository using nexus. Can anybody tell me the correct url to use. ...

Plain Old XML webservice using Spring: which view technolgy?

I have been writing a Plain Old XML webservice using Spring MVC. Currently I am using Freemarker to layout the XML, and that works ok. But I'm wondering what other approaches I could look at? Reason is that now I need to also serve up regular html and am therefore looking at the whole view layer. ...

Unit testing Spring 3 database methods

I have abstract class that defines database methods, such as inserts and updates, and a concrete class that implements it. The database configurations (dataSource, DatabaseTarget etc) are defined as beans in context.xml-file. The database with its methods work in Controller when I'm using Spring 3 anotations by private AbsractClass a;...

Spring-WS: How generate the WSDL without having to start the web service?

We use Spring-WS as the basis for implementing a web service (with the WSDL generated by the framework). As well as a WAR file our build produces a client side JAR (for use by our Java clients and our own end-to-end functional tests) consisting of schema generated DTOs and stubs for the web service methods. These are generated using wsim...

How to monitor Apache Camel status?

Hi. I have already working Camel configuration that is watching a database table (through spring and hibernate), and when something shows up in DB, Camel consumes it and sends message to JMS broker. This works flawlessly. And is built in DSL in MyOwnMessageRouteBuilder.configure() Now I'd like to add monitoring that do something if no...

Declaration of exchanges and queues in Spring AMQP

I'm using RabbitMQ and trying to refactor my current native java implementation to using the Spring AMQP abstraction. Declaration of exchanges, queues and their binding using the Spring library is via the AMQPAdmin interface, but I'm not sure when this sort of configuration should happen. I have a web application that uses Rabbit to ...

howto display validation errors in freemarker template

Hello, all approches i do to display my validation errors in a freemarker template fail. i use spring mvc version 3. My form looks like that <@layout.basic> <@spring.bind "user" /> <#if spring.status.error> <div class="errors"> There were problems with the data you entered: <ul> <#list spring.status.err...

Wicket+Spring+JPA+Hibernate: No Persistence Unit Found

Hi! I'm developing a web application using Wicket+Spring+JPA+Hibernate. This is my first project with this setup and I think I've probably made some mistakes. I get the following error: No persistence unit called "ApplicationEntityManager" found. My persistence.xml file looks like this: <?xml version="1.0" encoding="UTF-8"?> <persiste...

HIbernate InvalidDataAccessApiUsageException - read-only mode

Summary: the Exception is telling me that the transaction is read-only; a debug println seems to indicate that I'm not in read-only mode. Classes edited for internet publishing - sorry if I mistyped something but this is the jist of the code giving me problems. saveOrUpdate works when called on other object types but not on this one. ...

Basic Spring MVC config: PageNotFound using InternalResourceViewResolver

I'm trying to get a first Spring 3 MVC setup running. My app is running on tomcat, with in the server context of "grapevine" For the purposes of testing, I'm trying to get requests from http://localhost:8080/grapevine/test to render the contents of WEB-INF/jsp/noSuchInvitation.jsp When I try this, I'm getting a 404, and the logs sugge...

Ubuntu/Spring 3 - Strange issue with locale

I'm experiencing a strange issue with Ubuntu 10.04.1 LTS x86_64 where everything seems to work fine when the system locale is en_US. However, when the system locale is en_GB Spring tries to look for the default resource bundle as en_us rather than en_US. The exception: 06-Oct-2010 23:35:12 org.springframework.context.support.ResourceBu...

Calling controller from junit test

Hi How can I call a spring annotated controller from a JUnit test, in a way so that spring comes into play with binding and all, but without making a http request (just mocking out the request object)? It has to include the whole shebang from the controller and down, with JPA and database and all. We are also using EJB, so maybe a bean ...

how to start, where to start

hi expert, i'm new for web application, previously I did mobile app, now start doing web app, I'm intermediate for java,jsp,servlet, and plan to learn hibernate, spring, struts, ejb, which one i should learn first and where to start, bit confusing thanks in advance ...

What transaction manager to use? (JPA, Spring)

Hi! I'm developing a web application based on JPA + Hibernate, Spring and Wicket. I was wondering what's the best way of implementing transactions in my code? What transaction manager should I use? Should it be org.springframework.orm.jpa.JpaTransactionManager, or org.springframework.jdbc.datasource.DataSourceTransactionManager or someth...