Browse Source

Load webapp from disk.

pull/46/head
Kalle Stenflo 10 years ago
parent
commit
1417c22823
  1. 11
      json-path-web-test/src/main/java/com/jayway/jsonpath/web/boot/Main.java
  2. 10
      json-path/src/main/java/com/jayway/jsonpath/internal/PathFormalizer.java

11
json-path-web-test/src/main/java/com/jayway/jsonpath/web/boot/Main.java

@ -43,12 +43,13 @@ public class Main {
WebAppContext webAppContext = new WebAppContext(); WebAppContext webAppContext = new WebAppContext();
webAppContext.setServer(server); webAppContext.setServer(server);
webAppContext.setContextPath("/"); webAppContext.setContextPath("/");
//if(config.resourceBase().startsWith("classpath")){
webAppContext.setResourceBase(Main.class.getResource("/webapp").toExternalForm());
//} else {
// webAppContext.setResourceBase(config.resourceBase());
//}
String resourceBase = System.getProperty("resourceBase");
if(resourceBase != null){
webAppContext.setResourceBase(resourceBase);
} else {
webAppContext.setResourceBase(Main.class.getResource("/webapp").toExternalForm());
}
HandlerList handlers = new HandlerList(); HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[]{context, webAppContext}); handlers.setHandlers(new Handler[]{context, webAppContext});

10
json-path/src/main/java/com/jayway/jsonpath/internal/PathFormalizer.java

@ -63,7 +63,6 @@ public class PathFormalizer extends Parser {
buffer.flush(); buffer.flush();
} }
for (Fragment f : buffer.getFragments()) { for (Fragment f : buffer.getFragments()) {
System.out.println("Fragment: " + f.frag + " Type: " + f.type);
formalized.append(f.toString()); formalized.append(f.toString());
} }
return formalized.toString(); return formalized.toString();
@ -177,15 +176,6 @@ public class PathFormalizer extends Parser {
INDEX INDEX
} }
public static void main(String[] args) {
String path = "$.store['foo'].arr[10].monkey..book[?(@.isbn)].isbn";
System.out.println(path);
PathFormalizer p = new PathFormalizer(path);
String f = p.formalize();
System.out.println(f);
}
} }

Loading…
Cancel
Save