package ip.cl.clipapp.web;

import ip.cl.clipapp.ClipAppException;
import ip.cl.clipapp.service.impl.ExtenderServiceImpl;
import ip.cl.clipapp.service.impl.ShortenerServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ClipController {

    @Autowired
    private ShortenerServiceImpl shortenerService;
    @Autowired
    private ExtenderServiceImpl  extenderService;

    @RequestMapping(params = "u", method = RequestMethod.GET)
    public String clip(@RequestParam(value = "u") String longUrl) {
        return shortenerService.shorten(longUrl);
    }

    @RequestMapping(value = "{tinyUrl}", method = RequestMethod.GET)
    public String unclip(@PathVariable("tinyUrl") String tinyUrl) throws ClipAppException {
        return extenderService.extend(tinyUrl);
    }

}

@@ -92,21 +92,16 @@
 service.
-impl.
 Extender
@@ -107,20 +107,16 @@
 rService
-Impl
 ;%0D%0Aimpor
@@ -143,13 +143,8 @@
 ice.
-impl.
 Shor
@@ -155,20 +155,16 @@
 rService
-Impl
 ;%0D%0A%0D%0Aimp
@@ -635,20 +635,16 @@
 rService
-Impl
  shorten
@@ -702,12 +702,8 @@
 vice
-Impl
   ex

Fix service interfaces