/** * @see org.springframework.web.servlet.support.RequestContext#getContextUrl(String) */ public String getContextUrl(String relativeUrl) { return getContextPath() + relativeUrl; }
FileCopyUtils.copy("<#import \"spring.ftl\" as spring />\n" + macro, new FileWriter(resource.getPath())); DummyMacroRequestContext rc = new DummyMacroRequestContext(request); Map<String, String> msgMap = new HashMap<>(); msgMap.put("hello", "Howdy"); msgMap.put("world", "Mundo"); rc.setMessageMap(msgMap); Map<String, String> themeMsgMap = new HashMap<>(); themeMsgMap.put("hello", "Howdy!"); themeMsgMap.put("world", "Mundo!"); rc.setThemeMessageMap(themeMsgMap); rc.setContextPath("/springtest");
/** * @see org.springframework.web.servlet.support.RequestContext#getContextUrl(String, Map) */ public String getContextUrl(String relativeUrl, Map<String,String> params) { UriTemplate template = new UriTemplate(relativeUrl); return getContextPath() + template.expand(params).toASCIIString(); }