Skip to content

Commit 59b9c28

Browse files
ebussieresEric Bussieres
authored andcommitted
#459 and #460: Avoid feature version in spring boot starter name and upgrade to latest spring boot version (#461)
Signed-off-by: Eric Bussieres <[email protected]>
1 parent 9b9217a commit 59b9c28

File tree

4 files changed

+26
-48
lines changed

4 files changed

+26
-48
lines changed

pebble-spring/pebble-spring4/src/main/java/com/mitchellbosecke/pebble/spring4/extension/function/HrefFunction.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package com.mitchellbosecke.pebble.spring4.extension.function;
22

33
import com.mitchellbosecke.pebble.extension.Function;
4-
import com.mitchellbosecke.pebble.spring4.util.ViewUtils;
54
import com.mitchellbosecke.pebble.template.EvaluationContext;
65
import com.mitchellbosecke.pebble.template.PebbleTemplate;
6+
7+
import org.springframework.util.StringUtils;
8+
import org.springframework.web.context.request.RequestContextHolder;
9+
import org.springframework.web.context.request.ServletRequestAttributes;
10+
711
import java.util.ArrayList;
812
import java.util.List;
913
import java.util.Map;
10-
import org.springframework.util.StringUtils;
14+
15+
import javax.servlet.http.HttpServletRequest;
1116

1217
/**
1318
* Pebble function which adds the context path to the given url
@@ -57,12 +62,16 @@ private void addUrlParameter(Map<String, Object> args, StringBuffer result) {
5762

5863
private String getContextPath() {
5964
if (this.contextPath == null) {
60-
this.contextPath = ViewUtils.getRequest().getContextPath();
65+
this.contextPath = this.getRequest().getContextPath();
6166
}
62-
6367
return this.contextPath;
6468
}
6569

70+
private HttpServletRequest getRequest() {
71+
ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
72+
return attr.getRequest();
73+
}
74+
6675
/**
6776
* {@inheritDoc}
6877
*

pebble-spring/pebble-spring4/src/main/java/com/mitchellbosecke/pebble/spring4/util/ViewUtils.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

pebble-spring/pebble-spring5/src/main/java/com/mitchellbosecke/pebble/spring/extension/function/HrefFunction.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package com.mitchellbosecke.pebble.spring.extension.function;
22

33
import com.mitchellbosecke.pebble.extension.Function;
4-
import com.mitchellbosecke.pebble.spring.util.ViewUtils;
54
import com.mitchellbosecke.pebble.template.EvaluationContext;
65
import com.mitchellbosecke.pebble.template.PebbleTemplate;
6+
7+
import org.springframework.util.StringUtils;
8+
import org.springframework.web.context.request.RequestContextHolder;
9+
import org.springframework.web.context.request.ServletRequestAttributes;
10+
711
import java.util.ArrayList;
812
import java.util.List;
913
import java.util.Map;
10-
import org.springframework.util.StringUtils;
14+
15+
import javax.servlet.http.HttpServletRequest;
1116

1217
/**
1318
* Pebble function which adds the context path to the given url
@@ -56,12 +61,16 @@ private void addUrlParameter(Map<String, Object> args, StringBuffer result) {
5661

5762
private String getContextPath() {
5863
if (this.contextPath == null) {
59-
this.contextPath = ViewUtils.getRequest().getContextPath();
64+
this.contextPath = this.getRequest().getContextPath();
6065
}
61-
6266
return this.contextPath;
6367
}
6468

69+
private HttpServletRequest getRequest() {
70+
ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
71+
return attr.getRequest();
72+
}
73+
6574
/**
6675
* {@inheritDoc}
6776
*

pebble-spring/pebble-spring5/src/main/java/com/mitchellbosecke/pebble/spring/util/ViewUtils.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)