### Question:
HttpUtils extends RapidoidThing implements HttpMetadata { public static String resName(Req req) { String resName = resName(req.path()); U.notNull(resName, "resource name"); return resName; }  static Map<String, Serializable> initAndDeserializeToken(Req req); static void saveTokenBeforeRenderingHeaders(Req req, Map<String, Serializable> tokenData); static boolean isGetReq(Req req); static boolean isPostReq(Req req); static String resName(Req req); static String resName(String path); static String viewName(Req req); static boolean hasExtension(String name); static void setContentTypeForFile(Resp resp, File file); static void setContentTypeForResource(Resp resp, Res resource); static void setContentType(Resp resp, MediaType mediaType); static Res staticResource(Req req, String... possibleLocations); static String getErrorMessageAndSetCode(Resp resp, Throwable err); static Map<String, ?> getErrorInfo(Resp resp, Throwable error); static void postProcessResponse(Resp resp); static void reload(Req x); static String constructUrl(Req x, String path); static byte[] responseToBytes(Req req, Object result, MediaType contentType, HttpResponseRenderer responseRenderer); static Object resultOf(Req req, Object result); static void resultToResponse(Req req, Object result); static String getContextPath(Req req); static BasicConfig zone(Customization custom, String zone); static BasicConfig zone(Req req); static void setResponseTokenCookie(Resp resp, String token); static void clearUserData(Req req); static TokenAuthData getAuth(Req req); static String inferRealIpAddress(Req req); static MaybeReq noReq(); static MaybeReq maybe(Req req); static MaybeReq req(Req req); static int findBodyStart(byte[] response); static void proxyResponseHeaders(Map<String, String> respHeaders, SimpleHttpResp resp); static MediaType getDefaultContentType(); static void validateViewName(String view); static Map<String, WebData> webParams(Req req); static boolean isSpecialResult(Object result);  }### Answer:
@Test public void testView() { eq(HttpUtils.resName("/"), "index"); eq(HttpUtils.resName("/abc"), "abc"); eq(HttpUtils.resName("/x/y/z"), "x/y/z"); eq(HttpUtils.resName("/foo.html"), "foo"); eq(HttpUtils.resName("/aa/bb.html"), "aa/bb"); eq(HttpUtils.resName("/aa/bb-c_d11.txt"), "aa/bb-c_d11.txt"); eq(HttpUtils.resName("/a b"), "a b"); eq(HttpUtils.resName("/c d"), "c d"); eq(HttpUtils.resName("/ "), " "); }
@Test public void testUnicodeResourceNames() { eq(HttpUtils.resName("/Николче"), "Николче"); eq(HttpUtils.resName("/咖啡"), "咖啡"); eq(HttpUtils.resName("/咖啡.html"), "咖啡"); eq(HttpUtils.resName("/foo/咖啡/bar.html"), "foo/咖啡/bar"); eq(HttpUtils.resName("/編程/编程.html"), "編程/编程"); }
@Test public void testInvalidResources() { for (String resName : invalidResNames) { try { HttpUtils.resName(resName); } catch (Exception e) { continue; } fail("Expected error!"); } }