spring-3

Login/logout in REST with Spring 3

浪尽此生 提交于 2019-11-27 04:09:37
问题 We are developing RESTful webservices with Spring 3 and we need to have the functionality of login/logout, something like /webservices/login/<username>/<password>/ and /webservices/logout . The session should be stored in the context until the session is timed out or logged out to allow consumption of other webservices. Any request to access webservices without session information should be rejected. Looking for state-of-the-art solution for this scenario. I am actually resurrecting the

How to validate dynamically generated fields server side

て烟熏妆下的殇ゞ 提交于 2019-11-27 04:06:58
问题 I have developed a web application using Spring 3.1 In one of the module I need to save one Operation object having many OperationParameter objects. So in the view I have provided add button for user to create OperationParameters for the particular Operation. Both the models have hibernate mapping and there is one to many relation between Operation and OperationParameter. And in Operation model I have List of OperationParameters that will be inserted in database when a new Operation will be

Spring MVC 3.0: How do I bind to a persistent object

你。 提交于 2019-11-27 03:36:27
问题 I'm working with Spring MVC and I'd like it to bind a a persistent object from the database, but I cannot figure out how I can set my code to make a call to the DB before binding. For example, I'm trying to update a "BenefitType" object to the database, however, I want it to get the object fromthe database, not create a new one so I do not have to update all the fields. @RequestMapping("/save") public String save(@ModelAttribute("item") BenefitType benefitType, BindingResult result) { ..

Use custom validation messages in Hibernate + Spring

≡放荡痞女 提交于 2019-11-27 02:52:35
问题 I tried the steps from the answer here: Hibernate Validator, custom ResourceBundleLocator and Spring But still just getting {location.title.notEmpty} as output instead of the message. dispatcher-servlet.xml <bean name="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"> <property name="validationMessageSource"> <ref bean="resourceBundleLocator"/> </property> </bean> <bean name="resourceBundleLocator" class="org.springframework.context.support

Exception in GWT Dev Mode + Spring 3.1 + Hibernate 4.0.1

本小妞迷上赌 提交于 2019-11-27 02:26:43
问题 I have a GWT+Hibernate+JPA+Spring configuration file which is OK with Spring 3.0.x + Hibernate 3.6.x. When I upgraded to Spring 3.1 and Hibernate 4.0, the following exception is thrown: Is there any known incompatibility withe Hibernate 4 and Spring 3.1? org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [META-INF/application-context.xml]: Invocation of init method failed; nested exception is javax

When use ResponseEntity<T> and @RestController for Spring RESTful applications

这一生的挚爱 提交于 2019-11-27 02:25:46
I am working with Spring Framework 4.0.7, together with MVC and Rest I can work in peace with: @Controller ResponseEntity<T> For example: @Controller @RequestMapping("/person") @Profile("responseentity") public class PersonRestResponseEntityController { With the method (just to create) @RequestMapping(value="/", method=RequestMethod.POST) public ResponseEntity<Void> createPerson(@RequestBody Person person, UriComponentsBuilder ucb){ logger.info("PersonRestResponseEntityController - createPerson"); if(person==null) logger.error("person is null!!!"); else logger.info("{}", person.toString());

Need understanding of spring.handlers and spring.schemas

对着背影说爱祢 提交于 2019-11-27 01:21:43
问题 I have some questions derived from a problem that I have already solved through this other question. However, I am still wondering about the root cause. My questions are as follows: What is the purpose of spring.handlers and spring.schemas ? As I understand it's a way of telling the Spring Framework where to locate the xsd so that everything is wired and loaded correctly. But... Under what circumstances should I have those two files under the META-INF folder? In my other question linked above

Spring 3 @ImportResource with multiple files

元气小坏坏 提交于 2019-11-27 01:17:52
问题 I'm trying to find the syntax for importing multiple spring xml context files using Spring 3 @ImportResource annotation. I have tried using comma to separate the filenames as illustrated below but that does not work: @Configuration @ImportResource("spring-context1.xml", "spring-context2.xml") public class ConfigClass { } The doc for @ImportResource says "Indicates one or more resources containing bean definitions to import." so I believe there should be a way to specify multiple context files

Encoded slash (%2F) with Spring RequestMapping path param gives HTTP 400

谁说我不能喝 提交于 2019-11-26 22:47:39
问题 This is not a duplicate referenced question, because it is Spring specific. Whoever added that (3 years after the fact!) didn't bother to read the question or comment thread to see what the real answer was. The accepted answer isn't quite the answer, but the author of the answer never came back and edited it like I asked. Given the restful method below, Spring 3.1 gives a 400 error with "The request sent by the client was syntactically incorrect ()." when the token parameter contains a URL

org.hibernate.HibernateException: No Session found for current thread

只愿长相守 提交于 2019-11-26 22:39:55
问题 I'm getting the above exception with Spring3 and Hibernte4 The following is my bean xml file <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http:/