package scouterweb.notice;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Enumeration;

/**
 * @author Gun Lee (gunlee01@gmail.com) on 2017. 3. 2.
 */
@Controller
@Slf4j
public class NoticeController {

    @GetMapping("/latest-notice")
    public String getLatestNotice(Model model, HttpServletRequest req, HttpServletResponse res) {
        Enumeration<String> headerNames = req.getHeaderNames();
        while (headerNames.hasMoreElements()) {
            String name = headerNames.nextElement();
            log.info("header : {} -> {}", name, req.getHeader(name));
        }
        model.addAttribute("testAttr", "test-value");
        res.setHeader("X-Scouter-ETag", DigestUtils.md5DigestAsHex("-scouter-20170303-01".getBytes()));
        return "latestNotice";
    }
}

@@ -343,38 +343,8 @@
 nse;
-%0Aimport java.util.Enumeration;
 %0A%0A/*
@@ -584,24 +584,26 @@
 onse res) %7B%0A
+//
         Enum
@@ -650,24 +650,26 @@
 derNames();%0A
+//
         whil
@@ -704,16 +704,18 @@
 ts()) %7B%0A
+//
         
@@ -759,16 +759,18 @@
 ment();%0A
+//
         
@@ -827,24 +827,26 @@
 der(name));%0A
+//
         %7D%0A  

abort header printing in log