package com.getyourlocation.app.gyl_server.web.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

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


@RestController
@RequestMapping("/test")
public class ResourceController {

    private static final Logger LOG = LoggerFactory.getLogger(ResourceController.class);

    @RequestMapping(path = "/sum", method = RequestMethod.POST)
    public LinkedHashMap<String, Object> testCompute(HttpServletRequest request, HttpServletResponse response) {
        Enumeration enu=request.getParameterNames();
        int sum = 0;
        while(enu.hasMoreElements()){
            String paraName=(String)enu.nextElement();
            sum = sum + Integer.parseInt(request.getParameter(paraName));
        }
        LOG.info(request.getMethod() + " " + request.getRequestURI());
        LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>();
        result.put("answer", sum);
        return result;
    }

}

@@ -235,16 +235,77 @@
 Method;%0A
+import org.springframework.web.bind.annotation.RequestParam;%0A
 import o
@@ -351,32 +351,32 @@
 RestController;%0A
-
 %0Aimport javax.se
@@ -832,318 +832,201 @@
 ute(
-HttpServletRequest request, HttpServletResponse response) %7B%0A        Enumeration enu=r
+%0A        @RequestParam(value = %22x%22, defaultValue = %220%22) int x,%0A        @R
 equest
-.get
 Param
-eterNames();%0A        int sum = 0;%0A        while(enu.hasMoreElements())%7B%0A            String paraName=(String)enu.nextElement();%0A            sum = sum + Integer.parseInt(request.getParameter(paraName));%0A        %7D
+(value = %22y%22, defaultValue = %220%22) int y,%0A        HttpServletRequest request, HttpServletResponse response) %7B%0A
 %0A   
@@ -1093,16 +1093,17 @@
 URI());%0A
+%0A
         
@@ -1207,19 +1207,21 @@
 nswer%22, 
-sum
+x + y
 );%0A     
@@ -1238,16 +1238,17 @@
 result;%0A
+%0A
     %7D%0A%0A%7D

Update sum