Created
June 29, 2017 07:54
-
-
Save circlee/28e9372643a02df508fd20ddd3eb4137 to your computer and use it in GitHub Desktop.
SPA requestMapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.inject.Inject; | |
import javax.servlet.http.Cookie; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.validation.annotation.Validated; | |
import org.springframework.web.bind.annotation.PathVariable; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import com.glowpick.ec.api.product.service.DisplayService; | |
import lombok.extern.slf4j.Slf4j; | |
@Controller | |
@Validated | |
@Slf4j | |
public class TestController { | |
@RequestMapping("/") | |
public String getIndex( HttpServletRequest request, HttpServletResponse response){ | |
response.addCookie(new Cookie("TEST", "it's a test")); | |
return "/index.html"; | |
} | |
@RequestMapping( | |
{ | |
"{path:(?!index\\.html|swagger-ui\\.html).*$}" | |
, "{path:(?!index\\.html|swagger-ui\\.html|webjars|static).*}/**" | |
} | |
) | |
public String getIndex( HttpServletRequest request, HttpServletResponse response, @PathVariable("path") String path){ | |
System.out.println(path); | |
return getIndex(request, response); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment