Skip to content

Commit

Permalink
Added constant to make overriding path easier.
Browse files Browse the repository at this point in the history
  • Loading branch information
kubes committed Apr 11, 2011
1 parent ea9f08c commit 704edda
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/igfoo/core/web/Assets.java
Expand Up @@ -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";
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/igfoo/core/web/AssetsFilter.java
Expand Up @@ -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 {
Expand All @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/igfoo/core/web/AssetsTag.java
Expand Up @@ -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();
}
Expand Down

0 comments on commit 704edda

Please sign in to comment.