Browse Source

Chapter 1: refactor for Eclipse, fix hello page HTTP request for web browsers

master
Pekka Helenius 4 years ago
parent
commit
556d298c69
3 changed files with 3 additions and 4 deletions
  1. BIN
      exercises/chapter_1/chapter1_httprequest.zip
  2. +1
    -0
      exercises/chapter_1/chapter1_httprequest/src/main/java/com/fjordtek/chapter1_httprequest/Chapter1HttprequestApplication.java
  3. +2
    -4
      exercises/chapter_1/chapter1_httprequest/src/main/java/com/fjordtek/chapter1_httprequest/web/HttpRequestHandler.java

BIN
exercises/chapter_1/chapter1_httprequest.zip View File


+ 1
- 0
exercises/chapter_1/chapter1_httprequest/src/main/java/com/fjordtek/chapter1_httprequest/Chapter1HttprequestApplication.java View File

@ -3,6 +3,7 @@
package com.fjordtek.chapter1_httprequest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication


+ 2
- 4
exercises/chapter_1/chapter1_httprequest/src/main/java/com/fjordtek/chapter1_httprequest/web/HttpRequestHandler.java View File

@ -97,14 +97,12 @@ public class HttpRequestHandler {
* Multiple parameters given (see that 'method' can have multiple values assigned
* Just a brief example/demonstration
* NOTE: MIME type 'x-www-form-urlencoded' works with curl, at least. Change it if needed.
* curl 'http://localhost:8080/hello' --data 'location=moon&name=John'
* curl 'http://localhost:8080/index' --data 'location=moon&name=John'
*
*/
@RequestMapping(
value = { helloPageURL },
method = { RequestMethod.POST },
produces = { "application/html" },
consumes = "application/x-www-form-urlencoded",
method = { RequestMethod.GET },
params = { "location", "name" }
)
public ResponseEntity<String> getNameAndLocation(


Loading…
Cancel
Save