From 704edda27cac27c324756a37673c7859d2577d0e Mon Sep 17 00:00:00 2001 From: Dennis Kubes Date: Mon, 11 Apr 2011 01:01:57 -0500 Subject: [PATCH] Added constant to make overriding path easier. --- src/main/java/com/igfoo/core/web/Assets.java | 3 +++ src/main/java/com/igfoo/core/web/AssetsFilter.java | 4 +--- src/main/java/com/igfoo/core/web/AssetsTag.java | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/igfoo/core/web/Assets.java b/src/main/java/com/igfoo/core/web/Assets.java index 625a6a0..f17f880 100644 --- a/src/main/java/com/igfoo/core/web/Assets.java +++ b/src/main/java/com/igfoo/core/web/Assets.java @@ -2,6 +2,9 @@ public interface Assets { + // the asset path + public static final String PATH = "assets.request.path"; + // dynamic asset inclusion from controllers public static final String TITLE = "title"; public static final String METAS = "metas"; diff --git a/src/main/java/com/igfoo/core/web/AssetsFilter.java b/src/main/java/com/igfoo/core/web/AssetsFilter.java index 2259f39..1ee22e8 100644 --- a/src/main/java/com/igfoo/core/web/AssetsFilter.java +++ b/src/main/java/com/igfoo/core/web/AssetsFilter.java @@ -13,8 +13,6 @@ public class AssetsFilter implements Filter { - public static final String REQUEST_PATH = "assets.request.path"; - @Override public void init(FilterConfig config) throws ServletException { @@ -26,7 +24,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest)request; - request.setAttribute(REQUEST_PATH, httpReq.getServletPath()); + request.setAttribute(Assets.PATH, httpReq.getServletPath()); chain.doFilter(request, response); } diff --git a/src/main/java/com/igfoo/core/web/AssetsTag.java b/src/main/java/com/igfoo/core/web/AssetsTag.java index 7e07001..3bec60f 100644 --- a/src/main/java/com/igfoo/core/web/AssetsTag.java +++ b/src/main/java/com/igfoo/core/web/AssetsTag.java @@ -132,8 +132,7 @@ else if (types != null) { } boolean allTypes = types.isEmpty(); - String requestPath = (String)request - .getAttribute("assets.request.path"); + String requestPath = (String)request.getAttribute(Assets.PATH); if (requestPath == null) { requestPath = request.getRequestURI(); }