Commit 7336c80e authored by Jan Wagemakers's avatar Jan Wagemakers

add /txt url

parent 5bde8462
......@@ -22,6 +22,10 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -105,6 +109,19 @@ public class HTMLController {
return "rules";
}
@GetMapping("/txt")
public void txt(HttpServletResponse response) throws IOException {
String text = "SP=" + data.getSp() +
" PV=" + data.getPv() +
" OP=" + data.getOp() +
" OT=" + outside.getTemperature() +
"\n";
OutputStream outputStream = response.getOutputStream();
outputStream.write(text.getBytes(Charset.forName("UTF-8")));
outputStream.close();
return;
}
@PostMapping("/users")
public String user(@ModelAttribute User newUser, @RequestParam String action, @RequestParam String id, Model model ) {
switch (action) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment