Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Sep 7, 2014
1 parent 5243a4c commit 4ccae93
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/spark/Filter.java
Expand Up @@ -14,8 +14,8 @@

package spark;

import static spark.HttpMethod.*;
import static spark.utils.SparkUtils.ALL_PATHS;
import static spark.HttpMethod.after;
import static spark.HttpMethod.before;

import java.util.function.Consumer;

Expand All @@ -27,6 +27,8 @@
* @author Per Wendel
*/
public final class Filter extends Action {
public static final String ALL_PATHS = "+/*paths";

private static final String DEFAUT_CONTENT_TYPE = "text/html";

public static Filter before (Consumer<Context> handler) {
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/spark/route/RouteEntry.java
Expand Up @@ -14,6 +14,8 @@

package spark.route;

import static spark.Filter.ALL_PATHS;

import java.util.List;

import spark.HttpMethod;
Expand All @@ -32,7 +34,7 @@ class RouteEntry {
boolean matches (HttpMethod httpMethod, String path) {
if ((httpMethod == HttpMethod.before || httpMethod == HttpMethod.after)
&& (this.httpMethod == httpMethod)
&& this.path.equals (SparkUtils.ALL_PATHS)) {
&& this.path.equals (ALL_PATHS)) {
// Is filter and matches all
return true;
}
Expand Down
7 changes: 2 additions & 5 deletions core/src/main/java/spark/utils/SparkUtils.java
Expand Up @@ -23,11 +23,6 @@
* @author Per Wendel
*/
public final class SparkUtils {

public static final String ALL_PATHS = "+/*paths";

private SparkUtils () {}

public static List<String> convertRouteToList (String route) {
String[] pathArray = route.split ("/");
List<String> path = new ArrayList<> ();
Expand All @@ -38,4 +33,6 @@ public static List<String> convertRouteToList (String route) {
}
return path;
}

private SparkUtils () {}
}
4 changes: 4 additions & 0 deletions readme.md
Expand Up @@ -106,3 +106,7 @@ TODO
* Manage versions
* Deploy GH pages in Travis: after_success: ./gradlew cobertura coveralls jbake publishGhPages
* Fix documentation site styles and pages
* Clean code:
* Remove SparkUtils
* Replace MimeParse with JDKs javax.activation.MimetypesFileTypeMap
* Replace Action.empty with Guava's isNullOrEmpty

0 comments on commit 4ccae93

Please sign in to comment.