@Test public void testFormWithFileAndUri() throws Exception { HttpDaemon.registerServlet("/", new HttpServlet() { @Override public HttpResponse doGet(HttpRequest request) { return null; } @Override public HttpResponse doPost(HttpRequest request) { request.parseMultipartBody(repository, null); String title = request.form().get("fileUri"); return HttpResponse.newResponse(title); } }); Request request = formWithFileAndUriRequest(); Response response = new OkHttpClient().newCall(request).execute(); String uri = response.body().string(); boolean same = Files.equal(fileCopy, file); assertThat(same, is(true)); assertThat(uri, is(file.getAbsolutePath())); }
public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); }
HttpDaemon { public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); } }
HttpDaemon { public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); } HttpDaemon(int port);  HttpDaemon(); }
HttpDaemon { public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); } HttpDaemon(int port);  HttpDaemon(); static void registerServlet(String urlPattern, HttpServlet servlet); static int getPort(); static HttpDaemon getSingleton(); void start(); void stop(); boolean isAlive(); boolean isStarted(); int aliveRequests(); }
HttpDaemon { public static void registerServlet(String urlPattern, HttpServlet servlet) { sServletMap.put(urlPattern, servlet); } HttpDaemon(int port);  HttpDaemon(); static void registerServlet(String urlPattern, HttpServlet servlet); static int getPort(); static HttpDaemon getSingleton(); void start(); void stop(); boolean isAlive(); boolean isStarted(); int aliveRequests(); static int sPort; }