@ControllerAdvice
public class DefaultModelControllerAdvice {
@ModelAttribute
public void basicSetting(HttpServletRequest request, HttpServletResponse response, Model model) {
model.addAttribute("contextPath", request.getContextPath());
String requestURI = request.getRequestURI();
String pathUrl = "";
String finalUrl = "";
String[] requestUriSplit = requestURI.split("/");
System.out.println(requestURI);
if (requestUriSplit.length > 0) {
finalUrl = requestUriSplit[requestUriSplit.length-1];
try {
pathUrl = requestUriSplit[requestUriSplit.length-2];
} catch (Exception ignore) {}
try {
Integer.parseInt(finalUrl);
finalUrl = requestUriSplit[requestUriSplit.length-2];
pathUrl = requestUriSplit[requestUriSplit.length-3];
} catch (Exception ignore) {}
}
model.addAttribute("pathUrl", pathUrl);
model.addAttribute("finalUrl", finalUrl);
System.out.println("pathUrl : " + pathUrl);
System.out.println("finalUrl : " + finalUrl);
}
}
this is my java spring code to track down paths, while im working on local enviroment it looks fine, but when i uploaded this project on AWS EC2 by .war,
/
pathUrl :
finalUrl :
this block of log keep appear by few seconds of term. is there anyone experienced same problem??
PS.Sorry for bad english im not native..
i have no idea where to start and check..