spring-mvc

Running Spring Webflux Application as a WAR

懵懂的女人 提交于 2021-02-07 15:13:04
问题 I have a Spring reactive sample application that was modified from one of the examples that was provided in the the Spring Webflux documentation. The master branch of this application uses Spring Boot in the traditional manner, with an embedded application server (Netty). It is working fine. In the Liberty branch, I am trying to build the application as a WAR and deploy to Websphere Liberty Profile. Aside from changes to the build process, the most significant code change is having my

Using model attributes in a th:href link

我的未来我决定 提交于 2021-02-07 14:52:04
问题 Is there a way of referencing a model attribute in a th:href link? For example <a th:text="${currentUser}" th:href="@{/user/{currentUser}}"></a> Here, currentUser is a model variable as specified in a controller. This can be accessed easily as seen in the th:text tag. However, the th:href fails the thymeleaf parsing. If there any way of referencing a model attribute in this way, in the th:href ? For reference, this is a Spring MVC (bootstrap) application with Thymeleaf support. 回答1: In order

Using model attributes in a th:href link

烈酒焚心 提交于 2021-02-07 14:50:58
问题 Is there a way of referencing a model attribute in a th:href link? For example <a th:text="${currentUser}" th:href="@{/user/{currentUser}}"></a> Here, currentUser is a model variable as specified in a controller. This can be accessed easily as seen in the th:text tag. However, the th:href fails the thymeleaf parsing. If there any way of referencing a model attribute in this way, in the th:href ? For reference, this is a Spring MVC (bootstrap) application with Thymeleaf support. 回答1: In order

Spring Security Active Directory Ignoring PartialResultException

自古美人都是妖i 提交于 2021-02-07 14:50:37
问题 I have the following configuration in my spring security xml file. When I try to authenticate I get the following message but cannot proceed. INFO: Ignoring PartialResultException I am aware that spring's documentation states that you can set ignorePartialResultException to true but this property seems to be in the LdapTemplate class which may require additional coding. I would like to accomplish all of this through bean configuration as I am not interested in role mapping. <authentication

Spring Security Active Directory Ignoring PartialResultException

99封情书 提交于 2021-02-07 14:47:41
问题 I have the following configuration in my spring security xml file. When I try to authenticate I get the following message but cannot proceed. INFO: Ignoring PartialResultException I am aware that spring's documentation states that you can set ignorePartialResultException to true but this property seems to be in the LdapTemplate class which may require additional coding. I would like to accomplish all of this through bean configuration as I am not interested in role mapping. <authentication

Set Cache Redis Expiration to 1 year

孤街醉人 提交于 2021-02-07 14:38:37
问题 How to set Redis Cache expiration to 1 year? I tried to set the long value on the xml configuration to : 31556952000 (1 year), but then it caught an exception that type Integer doesn't recognize the value as Integer. I tried to search at Google, and it says that Integer maximum value is up to 2147483647 , which means, if I set to that maximum value, I only get my cache expires on 24 days. Here is my applicationContext.xml (I omitted unnecessary code) : ... <cache:annotation-driven /> <bean id

Set Cache Redis Expiration to 1 year

送分小仙女□ 提交于 2021-02-07 14:35:44
问题 How to set Redis Cache expiration to 1 year? I tried to set the long value on the xml configuration to : 31556952000 (1 year), but then it caught an exception that type Integer doesn't recognize the value as Integer. I tried to search at Google, and it says that Integer maximum value is up to 2147483647 , which means, if I set to that maximum value, I only get my cache expires on 24 days. Here is my applicationContext.xml (I omitted unnecessary code) : ... <cache:annotation-driven /> <bean id

Spring MVC: Having multiple @ModelAttribute in form handling action

谁说胖子不能爱 提交于 2021-02-07 12:47:14
问题 The context I have a simple association between two entities - Category and Email (NtoM). I'm trying to create web interface for browsing and managing them. To browse the category and to add e-mails into that category I use controller wrapped with @RequestMapping with category ID (UUID), so all controller actions are always taking place in context of category specified with path. I use @ModelAttribute to pre-load context category for entire controller scope. The problem This approach worked

java.lang.AssertionError: Content type not set - Spring Controller Junit Tests

房东的猫 提交于 2021-02-07 12:14:29
问题 I am trying to do some unit testing on my controllers. No matter what I do all controller tests return java.lang.AssertionError: Content type not set I am testing that the methods return json and xml data. Here is an example of the controller: @Controller @RequestMapping("/mypath") public class MyController { @Autowired MyService myService; @RequestMapping(value="/schema", method = RequestMethod.GET) public ResponseEntity<MyObject> getSchema(HttpServletRequest request) { return new

java.lang.AssertionError: Content type not set - Spring Controller Junit Tests

▼魔方 西西 提交于 2021-02-07 12:14:21
问题 I am trying to do some unit testing on my controllers. No matter what I do all controller tests return java.lang.AssertionError: Content type not set I am testing that the methods return json and xml data. Here is an example of the controller: @Controller @RequestMapping("/mypath") public class MyController { @Autowired MyService myService; @RequestMapping(value="/schema", method = RequestMethod.GET) public ResponseEntity<MyObject> getSchema(HttpServletRequest request) { return new