spring-web

Null @AuthenticationPrincipal with Spring-Boot / Security

落花浮王杯 提交于 2019-12-13 13:09:35
问题 I setup my Spring Security application according to the reference document and after hours of troubleshooting I continue to get a null @AuthenticationPrincipal passed into my controller. The authentication mechanism is working fine against the users in my database but still a null @AuthenticationPrincipal. I consulted several internet posts including this, and this but still I am getting null. I am using Spring-Boot 1.2.2 and Spring Security 3.2.6. Relevant POM: <parent> <groupId>org

How to specify url-pattern for Servlet filters in WebApplicationInitializer?

一个人想着一个人 提交于 2019-12-13 06:49:38
问题 I am converting a web.xml file to Java based configuration using Spring-web's WebApplicationInitializer . Following is the sample filter defined <filter> <filter-name>sampleFilter</filter-name> <filter-class>com.SampleFilter</filter-class> </filter> <filter-mapping> <filter-name>sampleFilter</filter-name> <url-pattern>/sampleUrl</url-pattern> </filter-mapping> and now the WebApplicationInitializer class looks like this class MyWebAppInitializer extends

Backpressure for REST endpoints with Spring Functional Web Framework

家住魔仙堡 提交于 2019-12-12 23:33:22
问题 If I understood correctly, HTTP endpoints implemented with Akka Streams apply backpressure to HTTP clients by not reading from the socket used for communicating with the client. Is this also true for HTTP endpoints implemented with Spring's Functional Web Framework? If not, how would I signal HTTP clients to slow down? 回答1: Yes, Spring 5, with its Web Reactive module, implements the reactive streams spec with Reactor. Supporting backpressure is part of it. Note that both the annotation-based

web service integration - how to access request Object in response class?

雨燕双飞 提交于 2019-12-12 17:35:08
问题 i have a code to access the web-service which in turn return me a response <int:chain input-channel="balanceChannel" output-channel="processedItems"> <int-ws:outbound-gateway destination-provider="myDestinationProvider" /> </int:chain> <int:service-activator input-channel="processedItems" ref="responseHandler" method="handleResponse" output-channel="nativeQlChannel" /> i am able to get response in my responseHandler , but i also want request object which i send to web-service using channel ?

Difference between org/springframework/web/servlet/ModelAndView class and org/springframework/web/portlet/ModelAndView [duplicate]

两盒软妹~` 提交于 2019-12-12 02:40:45
问题 This question already has an answer here : what is the difference in org.springframework.web.servlet.ModelAndView vs org.springframework.web.portlet.ModelAndView (1 answer) Closed 4 years ago . I have just answered the below question which revolves around this posted question. spring mvc InternalResourceViewResolver doesnt get prefix Can someone out there tell the difference between the classes org/springframework/web/servlet/ModelAndView and org/springframework/web/portlet/ModelAndView I see

Spring Boot annotation @GetMapping can not be resolved to a type

拜拜、爱过 提交于 2019-12-11 17:54:25
问题 I tried creating a Spring Project from Spring Initializr for the first time in my local computer. But I am getting these errors @GetMapping cannot be resolved to a type. My pom.xml file- <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter

Spring RestTemplate exchange DELETE with body jdk 1.8

旧巷老猫 提交于 2019-12-11 07:34:07
问题 I'm trying to do a HTTP DELETE request with body with Spring RestTemplate via exchange method but I always get a 400 Bad Request like this question. With JavaScript and other tools it is posible to make this API call with DELETE. I know java <1.8 doesent support DELETE with body, but with 1.8 it should be able: see here. I'm using spring-web-4.2.6.RELEASE with jdk 1.8 so I think there must be a way. My code: public DealResponse closePosition(DealCloseRequest dealCloseRequest) { try {

HTML templates in spring boot similar to play framework

…衆ロ難τιáo~ 提交于 2019-12-11 04:55:51
问题 I have worked with PlayFramework for Scala. Now I am starting with Spring (Spring Boot) for the first time. Is their any way to make HTML templates similar to Play framework. e.g. passing HTML content into a main(main.scala.html) HTML file. 回答1: Spring framework does not force you to use any particular view technology. You can use anything that can be integrated. The topic is covered in the documentation where you can read about the details on popular choices. However, the most popular is

Spring Boot (HATEOAS) ControllerLinkBuilder.linkTo(…) query parameter missing/not created

我们两清 提交于 2019-12-11 00:23:35
问题 I'm working on a REST API with Spring Boot (1.4) and also using the PagedResourcesAssembler to create JSON responses with pagination, which works like a charm. The guys from Spring did a great job! However I'm having issues providing the URL query parameters (if provided). I understand that the PagedResourcesAssembler can't figure out URL query parameter on its own, so I wanted to provide a Link for it, using the ControllerLinkBuilder.linkTo(controller, parameters) method: @RequestMapping

Why my request entity InputStream is always empty in ContainerRequestFilter (Spring+Jersey)

Deadly 提交于 2019-12-10 17:37:38
问题 I'm totally unable to get the Request payload/form in a JaxRS ContainerRequestFilter. My setup : JDK 8 SpringBoot 1.3.0.RELEASE Jersey 2.22.1 (from SpringBoot) here's my pom : (from Spring Initialzr) <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId