Permalink
Browse files

update spring-boot to 1.5.4.RELEASE

  • Loading branch information...
af-not-found committed Jul 29, 2017
1 parent 3148c6d commit 8bb22870367de39c4f660891f9ed9d64e765508d
Showing with 25 additions and 21 deletions.
  1. +10 −15 pom.xml
  2. +15 −6 src/main/java/net/afnf/blog/common/CachingResourceUrlEncodingFilter.java
25 pom.xml
@@ -5,7 +5,7 @@

<groupId>net.afnf</groupId>
<artifactId>blog-java2</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
<name>blog-java2</name>
<url>http://blog.afnf.net</url>

@@ -18,7 +18,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<version>1.5.6.RELEASE</version>
</parent>

<dependencies>
@@ -54,12 +54,12 @@
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.1.1</version>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
<version>3.6</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
@@ -73,7 +73,7 @@
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-gmail</artifactId>
<version>v1-rev46-1.22.0</version>
<version>v1-rev68-1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
@@ -106,26 +106,21 @@
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.53.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.53.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-ie-driver</artifactId>
<version>2.53.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.3.0</version>
<scope>test</scope>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
</dependency>
</dependencies>

@@ -147,7 +142,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<version>0.7.9</version>
<executions>
<execution>
<id>prepare-agent</id>
@@ -215,7 +210,7 @@
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<version>1.3.5</version>
<configuration>
<configurationFile>src/config/mybatisGeneratorConfig.xml</configurationFile>
<overwrite>true</overwrite>
@@ -224,7 +219,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1208</version>
<version>9.4.1212.jre7</version>
</dependency>
</dependencies>
</plugin>
@@ -6,6 +6,8 @@

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -15,6 +17,7 @@
import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
import org.springframework.web.servlet.resource.ResourceUrlProvider;
import org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor;
import org.springframework.web.util.UrlPathHelper;

public class CachingResourceUrlEncodingFilter extends ResourceUrlEncodingFilter {

@@ -30,9 +33,14 @@ public CachingResourceUrlEncodingFilter(String encTargetPrefix) {
}

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
filterChain.doFilter(request, new CachingResourceUrlEncodingResponseWrapper(request, response, encTargetPrefix));
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse)) {
throw new ServletException("ResourceUrlEncodingFilter just supports HTTP requests");
}
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
filterChain.doFilter(request, new CachingResourceUrlEncodingResponseWrapper(httpRequest, httpResponse, encTargetPrefix));
}

private static class CachingResourceUrlEncodingResponseWrapper extends HttpServletResponseWrapper {
@@ -99,13 +107,14 @@ private ResourceUrlProvider getResourceUrlProvider() {

private void initLookupPath(ResourceUrlProvider urlProvider) {
if (this.indexLookupPath == null) {
String requestUri = urlProvider.getPathHelper().getRequestUri(this.request);
String lookupPath = urlProvider.getPathHelper().getLookupPathForRequest(this.request);
UrlPathHelper pathHelper = urlProvider.getUrlPathHelper();
String requestUri = pathHelper.getRequestUri(this.request);
String lookupPath = pathHelper.getLookupPathForRequest(this.request);
this.indexLookupPath = requestUri.lastIndexOf(lookupPath);
this.prefixLookupPath = requestUri.substring(0, this.indexLookupPath);

if ("/".equals(lookupPath) && !"/".equals(requestUri)) {
String contextPath = urlProvider.getPathHelper().getContextPath(this.request);
String contextPath = pathHelper.getContextPath(this.request);
if (requestUri.equals(contextPath)) {
this.indexLookupPath = requestUri.length();
this.prefixLookupPath = requestUri;

0 comments on commit 8bb2287

Please sign in to comment.