public static String getResourceBase(HttpServletRequest req) { String path = RequestUtils.getServletPath(req); if (path == null || "".equals(path)) { return ""; } return path.substring(0, path.lastIndexOf('/')); } }
String getUri(HttpServletRequest request) { // handle http dispatcher includes. String uri = (String) request.getAttribute("javax.servlet.include.servlet_path"); if (uri != null) { return uri; } uri = RequestUtils.getServletPath(request); if (uri != null && !"".equals(uri)) { return uri; } uri = request.getRequestURI(); return uri.substring(request.getContextPath().length()); }
path = RequestUtils.getServletPath(request);
protected Template handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Context context) throws Exception { String servletPath = (String) httpServletRequest.getAttribute("javax.servlet.include.servlet_path"); if (servletPath == null) { servletPath = RequestUtils.getServletPath(httpServletRequest); } return getTemplate(servletPath, getEncoding()); }
uri = RequestUtils.getServletPath(hrequest);
public ActionMapping getMapping(HttpServletRequest request) { String uri = RequestUtils.getServletPath(request);
String resourcePath = RequestUtils.getServletPath(request);
public static String buildNamespace(OgnlValueStack stack, HttpServletRequest request) { ActionContext context = new ActionContext(stack.getContext()); ActionInvocation invocation = context.getActionInvocation(); if (invocation == null) { ActionMapper mapper = ActionMapperFactory.getMapper(); ActionMapping mapping = mapper.getMapping(request); if (mapping != null) { return mapping.getNamespace(); } else { // well, if the ActionMapper can't tell us, and there is no existing action invocation, // let's just go with a default guess that the namespace is the last the path minus the // last part (/foo/bar/baz.xyz -> /foo/bar) String path = RequestUtils.getServletPath(request); return path.substring(0, path.lastIndexOf("/")); } } else { return invocation.getProxy().getNamespace(); } } }