Skip to content

Commit b360955

Browse files
earth001KevinGilmore
authored andcommitted
BAEL-1148 earth001@gmail.com - Mapped get method in controller / Removed resources (eugenp#3395)
* Sample code for BAEL-1148 - earth001@gmail.com * Change tabs for spaces in non java files * Change tabs for spaces in non java files * Removed unnecessary argument * BAEL-1148 earth001@gmail.com - Mapped get method in controller / Removed resources
1 parent d74c882 commit b360955

2 files changed

Lines changed: 11 additions & 21 deletions

File tree

‎spring-mvc-push/src/main/java/com/baeldung/controller/PushController.java‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,22 @@
33
import javax.servlet.http.PushBuilder;
44

55
import org.springframework.stereotype.Controller;
6-
import org.springframework.web.bind.annotation.RequestMapping;
6+
import org.springframework.web.bind.annotation.GetMapping;
77

88
@Controller
99
public class PushController {
1010

11-
@RequestMapping(value = "/demoWithPush")
11+
@GetMapping(path = "/demoWithPush")
1212
public String demoWithPush(PushBuilder pushBuilder) {
1313
if (null != pushBuilder) {
1414
pushBuilder.path("resources/logo.png")
1515
.addHeader("Content-Type", "image/png")
1616
.push();
17-
pushBuilder.path("resources/script.js")
18-
.addHeader("Content-Type", "text/javascript")
19-
.push();
20-
pushBuilder.path("resources/style.css")
21-
.addHeader("Content-Type", "text/css")
22-
.push();
2317
}
2418
return "demo";
2519
}
2620

27-
@RequestMapping(value = "/demoWithoutPush")
21+
@GetMapping(path = "/demoWithoutPush")
2822
public String demoWithoutPush() {
2923
return "demo";
3024
}
Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
<%@ page language="java" contentType="text/html; charset=UTF-8"
2-
pageEncoding="UTF-8"%>
2+
pageEncoding="UTF-8"%>
33
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
44
<html>
55
<head>
66
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
77
<title>PushBuilder demo</title>
8-
<link href="<c:url value="/resources/style.css"/>" rel="stylesheet" />
98
</head>
109
<body>
11-
12-
<span class="single-title">PushBuilder demo</span>
13-
<br>
14-
<img src="<c:url value="/resources/logo.png"/>" alt="Logo" height="126"
15-
width="411">
16-
<br>
17-
<script type="text/javascript"
18-
src="<c:url value="/resources/script.js"/>"></script>
19-
<br> Go to
20-
<a href="/spring-mvc-push/">index</a>
10+
<span>PushBuilder demo</span>
11+
<br>
12+
<img src="<c:url value="/resources/logo.png"/>" alt="Logo"
13+
height="126" width="411">
14+
<br>
15+
<br> Go to
16+
<a href="/spring-mvc-push/">index</a>
2117
</body>
2218
</html>

0 commit comments

Comments
 (0)