@Test public void builderHappyPath(){ ClasspathResourcesObject object = DSL .classpathResourcesAt("/org/httpobjects/util/ClasspathResourcesObjectTest_resources") .servedAt("/"); assertEquals("/{resource*}", object.pattern().raw()); Response response = object.get(new MockRequest(object, "/a.txt")); assertEquals("hello", HttpObjectUtil.toAscii(response.representation())); }
public static ClasspathResourcesObject.Builder classpathResourcesAt(String pattern){ return new ClasspathResourcesObject.Builder(DSL.class, pattern); }
DSL { public static ClasspathResourcesObject.Builder classpathResourcesAt(String pattern){ return new ClasspathResourcesObject.Builder(DSL.class, pattern); } }
DSL { public static ClasspathResourcesObject.Builder classpathResourcesAt(String pattern){ return new ClasspathResourcesObject.Builder(DSL.class, pattern); }  }
DSL { public static ClasspathResourcesObject.Builder classpathResourcesAt(String pattern){ return new ClasspathResourcesObject.Builder(DSL.class, pattern); }  static ClasspathResourcesObject.Builder classpathResourcesAt(String pattern); static final Response OK(Representation r, HeaderField ... header); static final Response CREATED(LocationField location); static final Response NO_CONTENT(); static final Response UNAUTHORIZED(WWWAuthenticateField authorization, Representation r); static final Response SEE_OTHER(LocationField location, HeaderField ... header); static final Response SEE_OTHER(LocationField location, Representation representation, HeaderField ... header); static final WWWAuthenticateField BasicAuthentication(String realmName); static final SetCookieField SetCookie(String name, String value); static final LocationField Location(String uri); static final Representation Csv(String text); static final Representation Html(String text); static final Representation Text(String text); static final Representation Json(String text); static final Representation Json(InputStream text); static final Representation HtmlFromClasspath(String name, Object context); static final Representation HtmlFromClasspath(String name, Class<?> clazz); static final Representation FromClasspath(String contentType, String name, final Class<?> clazz); static final Representation FromClasspath(String contentType, String name, Object context); static final Representation Bytes(String contentType, byte[] data); static final Representation Bytes(String contentType, InputStream data); static final Representation File(String contentType, java.io.File path); static final byte[] getBytes(String text, StandardCharset standardCharset); static final Response CONTINUE(); static final Response SWITCHING_PROTOCOLS(); static final Response BAD_REQUEST(); static final Response BAD_REQUEST(Representation representation); static final Response UNAUTHORIZED(); static final Response UNAUTHORIZED(Representation representation); static final Response PAYMENT_REQUIRED(); static final Response PAYMENT_REQUIRED(Representation representation); static final Response FORBIDDEN(); static final Response FORBIDDEN(Representation representation); static final Response NOT_FOUND(); static final Response NOT_FOUND(Representation representation); @Deprecated /** * @deprecated This response code must include an Allow header. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6 * @see DSL#METHOD_NOT_ALLOWED(org.httpobjects.util.Method...) */ static final Response METHOD_NOT_ALLOWED(); @Deprecated /** * @deprecated This response code must include an Allow header. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6 * @see DSL#METHOD_NOT_ALLOWED(Representation, org.httpobjects.util.Method...) */ static final Response METHOD_NOT_ALLOWED(Representation representation); static final Response METHOD_NOT_ALLOWED(Representation representation, Method... allowed); static final Response METHOD_NOT_ALLOWED(Method... allowed); static final Response allowed(Method... allowed); static final Response NOT_ACCEPTABLE(); static final Response NOT_ACCEPTABLE(Representation representation); static final Response PROXY_AUTHENTICATION_REQUIRED(); static final Response PROXY_AUTHENTICATION_REQUIRED(Representation representation); static final Response REQUEST_TIMEOUT(); static final Response REQUEST_TIMEOUT(Representation representation); static final Response CONFLICT(); static final Response CONFLICT(Representation representation); static final Response GONE(); static final Response GONE(Representation representation); static final Response LENGTH_REQUIRED(); static final Response LENGTH_REQUIRED(Representation representation); static final Response PRECONDITION_FAILED(); static final Response PRECONDITION_FAILED(Representation representation); static final Response REQUEST_ENTITY_TOO_LARGE(); static final Response REQUEST_ENTITY_TOO_LARGE(Representation representation); static final Response REQUEST_URI_TOO_LONG(); static final Response REQUEST_URI_TOO_LONG(Representation representation); static final Response UNSUPPORTED_MEDIA_TYPE(); static final Response UNSUPPORTED_MEDIA_TYPE(Representation representation); static final Response REQUESTED_RANGE_NOT_SATISFIABLE(); static final Response REQUESTED_RANGE_NOT_SATISFIABLE(Representation representation); static final Response EXPECTATION_FAILED(); static final Response EXPECTATION_FAILED(Representation representation); static final Response ACCEPTED(Representation representation, HeaderField ... headers); static final Response UNPROCESSABLE_ENTITY(HeaderField... headers); static final Response UNPROCESSABLE_ENTITY(Representation representation, HeaderField... headers); static final Response INTERNAL_SERVER_ERROR(); static final Response INTERNAL_SERVER_ERROR(Representation representation); static final Response INTERNAL_SERVER_ERROR(Throwable t); static final Response NOT_IMPLEMENTED(); static final Response NOT_IMPLEMENTED(Representation representation); static final Response NOT_IMPLEMENTED(Throwable t); static final Response BAD_GATEWAY(); static final Response BAD_GATEWAY(Representation representation); static final Response BAD_GATEWAY(Throwable t); static final Response SERVICE_UNAVAILABLE(); static final Response SERVICE_UNAVAILABLE(Representation representation); static final Response SERVICE_UNAVAILABLE(Throwable t); static final Response GATEWAY_TIMEOUT(); static final Response GATEWAY_TIMEOUT(Representation representation); static final Response GATEWAY_TIMEOUT(Throwable t); static final Response HTTP_VERSION_NOT_SUPPORTED(); static final Response HTTP_VERSION_NOT_SUPPORTED(Representation representation); static final Response HTTP_VERSION_NOT_SUPPORTED(Throwable t); }
DSL { public static ClasspathResourcesObject.Builder classpathResourcesAt(String pattern){ return new ClasspathResourcesObject.Builder(DSL.class, pattern); }  static ClasspathResourcesObject.Builder classpathResourcesAt(String pattern); static final Response OK(Representation r, HeaderField ... header); static final Response CREATED(LocationField location); static final Response NO_CONTENT(); static final Response UNAUTHORIZED(WWWAuthenticateField authorization, Representation r); static final Response SEE_OTHER(LocationField location, HeaderField ... header); static final Response SEE_OTHER(LocationField location, Representation representation, HeaderField ... header); static final WWWAuthenticateField BasicAuthentication(String realmName); static final SetCookieField SetCookie(String name, String value); static final LocationField Location(String uri); static final Representation Csv(String text); static final Representation Html(String text); static final Representation Text(String text); static final Representation Json(String text); static final Representation Json(InputStream text); static final Representation HtmlFromClasspath(String name, Object context); static final Representation HtmlFromClasspath(String name, Class<?> clazz); static final Representation FromClasspath(String contentType, String name, final Class<?> clazz); static final Representation FromClasspath(String contentType, String name, Object context); static final Representation Bytes(String contentType, byte[] data); static final Representation Bytes(String contentType, InputStream data); static final Representation File(String contentType, java.io.File path); static final byte[] getBytes(String text, StandardCharset standardCharset); static final Response CONTINUE(); static final Response SWITCHING_PROTOCOLS(); static final Response BAD_REQUEST(); static final Response BAD_REQUEST(Representation representation); static final Response UNAUTHORIZED(); static final Response UNAUTHORIZED(Representation representation); static final Response PAYMENT_REQUIRED(); static final Response PAYMENT_REQUIRED(Representation representation); static final Response FORBIDDEN(); static final Response FORBIDDEN(Representation representation); static final Response NOT_FOUND(); static final Response NOT_FOUND(Representation representation); @Deprecated /** * @deprecated This response code must include an Allow header. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6 * @see DSL#METHOD_NOT_ALLOWED(org.httpobjects.util.Method...) */ static final Response METHOD_NOT_ALLOWED(); @Deprecated /** * @deprecated This response code must include an Allow header. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6 * @see DSL#METHOD_NOT_ALLOWED(Representation, org.httpobjects.util.Method...) */ static final Response METHOD_NOT_ALLOWED(Representation representation); static final Response METHOD_NOT_ALLOWED(Representation representation, Method... allowed); static final Response METHOD_NOT_ALLOWED(Method... allowed); static final Response allowed(Method... allowed); static final Response NOT_ACCEPTABLE(); static final Response NOT_ACCEPTABLE(Representation representation); static final Response PROXY_AUTHENTICATION_REQUIRED(); static final Response PROXY_AUTHENTICATION_REQUIRED(Representation representation); static final Response REQUEST_TIMEOUT(); static final Response REQUEST_TIMEOUT(Representation representation); static final Response CONFLICT(); static final Response CONFLICT(Representation representation); static final Response GONE(); static final Response GONE(Representation representation); static final Response LENGTH_REQUIRED(); static final Response LENGTH_REQUIRED(Representation representation); static final Response PRECONDITION_FAILED(); static final Response PRECONDITION_FAILED(Representation representation); static final Response REQUEST_ENTITY_TOO_LARGE(); static final Response REQUEST_ENTITY_TOO_LARGE(Representation representation); static final Response REQUEST_URI_TOO_LONG(); static final Response REQUEST_URI_TOO_LONG(Representation representation); static final Response UNSUPPORTED_MEDIA_TYPE(); static final Response UNSUPPORTED_MEDIA_TYPE(Representation representation); static final Response REQUESTED_RANGE_NOT_SATISFIABLE(); static final Response REQUESTED_RANGE_NOT_SATISFIABLE(Representation representation); static final Response EXPECTATION_FAILED(); static final Response EXPECTATION_FAILED(Representation representation); static final Response ACCEPTED(Representation representation, HeaderField ... headers); static final Response UNPROCESSABLE_ENTITY(HeaderField... headers); static final Response UNPROCESSABLE_ENTITY(Representation representation, HeaderField... headers); static final Response INTERNAL_SERVER_ERROR(); static final Response INTERNAL_SERVER_ERROR(Representation representation); static final Response INTERNAL_SERVER_ERROR(Throwable t); static final Response NOT_IMPLEMENTED(); static final Response NOT_IMPLEMENTED(Representation representation); static final Response NOT_IMPLEMENTED(Throwable t); static final Response BAD_GATEWAY(); static final Response BAD_GATEWAY(Representation representation); static final Response BAD_GATEWAY(Throwable t); static final Response SERVICE_UNAVAILABLE(); static final Response SERVICE_UNAVAILABLE(Representation representation); static final Response SERVICE_UNAVAILABLE(Throwable t); static final Response GATEWAY_TIMEOUT(); static final Response GATEWAY_TIMEOUT(Representation representation); static final Response GATEWAY_TIMEOUT(Throwable t); static final Response HTTP_VERSION_NOT_SUPPORTED(); static final Response HTTP_VERSION_NOT_SUPPORTED(Representation representation); static final Response HTTP_VERSION_NOT_SUPPORTED(Throwable t); static final StandardCharset MOST_WIDELY_SUPPORTED_ENCODING; static final StandardCharset DEFAULT_HTTP_ENCODING; static final String CONTENT_TYPE_CSV; static final String CONTENT_TYPE_HTML; static final String CONTENT_TYPE_TEXT_PLAIN; static final String CONTENT_TYPE_JSON; }