package com.naba.url.shortner;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class UrlShortnerController {

    @RequestMapping(method = RequestMethod.GET)
    public String defaultPage(Model model) {
        model.addAttribute("urlShortner", new UrlShortner());
        return "index";
    }

    @RequestMapping(value = "/url-shortner", method = RequestMethod.POST)
    public String urlShortner(@ModelAttribute UrlShortner url, Model model) {
        url.setShortnedUrl(url.getOriginalUrl() + "/shortned");
        model.addAttribute("urlShortner", url);
        return "index";
    }
}

@@ -716,16 +716,27 @@
 tnedUrl(
+shortenUrl(
 url.getO
@@ -751,22 +751,9 @@
 rl()
- + %22/shortned%22
+)
 );%0A 
@@ -799,16 +799,16 @@
 , url);%0A
-
         
@@ -828,11 +828,169 @@
 %22;%0A    %7D
+%0A%0A    private String shortenUrl(String originalUrl) %7B%0A        String shortenedUrl = String.valueOf(originalUrl.hashCode());%0A        return shortenedUrl;%0A    %7D
 %0A%7D%0A

Add logic to shorten url