本文整理汇总了Java中org.springframework.web.servlet.support.RequestContext.getRequestUri方法的典型用法代码示例。如果您正苦于以下问题:Java RequestContext.getRequestUri方法的具体用法?Java RequestContext.getRequestUri怎么用?Java RequestContext.getRequestUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.support.RequestContext
的用法示例。
在下文中一共展示了RequestContext.getRequestUri方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveData
import org.springframework.web.servlet.support.RequestContext; //导入方法依赖的package包/类
@Override
public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) {
final RequestContext requestContext = new RequestContext(request, response, servletContext, (Map<String, Object>) model);
if (requestContext.getContextPath() != null) {
root.put(prefix + "contextPath", requestContext.getContextPath());
}
if (requestContext.getPathToServlet() != null) {
root.put(prefix + "pathToServlet", requestContext.getPathToServlet());
}
if (requestContext.getQueryString() != null) {
root.put(prefix + "queryString", requestContext.getQueryString());
}
if (requestContext.getRequestUri() != null) {
root.put(prefix + "requestUri", requestContext.getRequestUri());
}
if (requestContext.getLocale() != null) {
root.put(prefix + "locale", requestContext.getLocale().toString());
}
}
示例2: menuSelected
import org.springframework.web.servlet.support.RequestContext; //导入方法依赖的package包/类
public String menuSelected(RequestContext request, String menuUrl, String cssName){
String url = request.getRequestUri();
String ct = ContextConfig.get("contextPath");
url = url.replace(ct, "");
if (menuUrl.startsWith("/")){
menuUrl = menuUrl.substring(1);
}
if (url.startsWith("/")){
url = url.substring(1);
}
if (menuUrl.length() >0 && url.startsWith(menuUrl)){
return cssName;
}
if (menuUrl.equalsIgnoreCase(url)){
return cssName;
}
return "";
}