-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
173 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
avaje-jex/src/main/java/io/avaje/jex/http/ContentType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package io.avaje.jex.http; | ||
|
||
public enum ContentType { | ||
|
||
TEXT_PLAIN("text/plain"), | ||
TEXT_CSS("text/css"), | ||
TEXT_CSV("text/csv"), | ||
TEXT_HTML("text/html"), | ||
TEXT_JS("text/javascript"), | ||
TEXT_MARKDOWN("text/markdown"), | ||
TEXT_PROPERTIES("text/x-java-properties"), | ||
TEXT_XML("text/xml"), | ||
|
||
IMAGE_AVIF("image/avif"), | ||
IMAGE_BMP("image/bmp"), | ||
IMAGE_GIF("image/gif"), | ||
IMAGE_ICO("image/vnd.microsoft.icon"), | ||
IMAGE_JPEG("image/jpeg"), | ||
IMAGE_PNG("image/png"), | ||
IMAGE_SVG("image/svg+xml"), | ||
IMAGE_TIFF("image/tiff"), | ||
IMAGE_WEBP("image/webp"), | ||
|
||
AUDIO_AAC("audio/aac"), | ||
AUDIO_MIDI("audio/midi"), | ||
AUDIO_MPEG("audio/mpeg"), | ||
AUDIO_OGA("audio/ogg"), | ||
AUDIO_OPUS("audio/opus"), | ||
AUDIO_WAV("audio/wav"), | ||
AUDIO_WEBA("audio/weba"), | ||
|
||
VIDEO_AVI("video/x-msvideo"), | ||
VIDEO_MP4("video/mp4"), | ||
VIDEO_MPEG("video/mpeg"), | ||
VIDEO_OGG("video/ogg"), | ||
VIDEO_WEBM("video/webm"), | ||
|
||
FONT_OTF("font/otf"), | ||
FONT_TTF("font/ttf"), | ||
FONT_WOFF("font/woff"), | ||
FONT_WOFF2("font/woff2"), | ||
|
||
APPLICATION_OCTET_STREAM("application/octet-stream"), | ||
APPLICATION_BZ("application/x-bzip"), | ||
APPLICATION_BZ2("application/x-bzip2"), | ||
APPLICATION_CDN("application/cdn"), | ||
APPLICATION_DOC("application/msword"), | ||
APPLICATION_DOCX("application/vnd.openxmlformats-officedocument.wordprocessingml.document"), | ||
APPLICATION_EPUB("application/epub+zip"), | ||
APPLICATION_GZ("application/gzip"), | ||
APPLICATION_JSON("application/json"), | ||
APPLICATION_MPKG("application/vnd.apple.installer+xml"), | ||
APPLICATION_JAR("application/java-archive"), | ||
APPLICATION_PDF("application/pdf"), | ||
APPLICATION_POM("application/xml"), | ||
APPLICATION_RAR("application/vnd.rar"), | ||
APPLICATION_SH("application/x-sh"), | ||
APPLICATION_SWF("application/x-shockwave-flash"), | ||
APPLICATION_TAR("application/x-tar"), | ||
APPLICATION_XHTML("application/xhtml+xml"), | ||
APPLICATION_YAML("application/yaml"), | ||
APPLICATION_ZIP("application/zip"), | ||
APPLICATION_7Z("application/x-7z-compressed"), | ||
|
||
MULTIPART_FORM_DATA("multipart/form-data"); | ||
|
||
private final String content; | ||
|
||
ContentType(String contentType) { | ||
this.content = contentType; | ||
} | ||
|
||
public String contentType() { | ||
return content; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package io.avaje.jex.http; | ||
|
||
/** Http Error Status codes */ | ||
public enum HttpStatus { | ||
|
||
// 1xx Informational | ||
CONTINUE_100(100), | ||
SWITCHING_PROTOCOLS_101(101), | ||
|
||
// 2xx Success | ||
OK_200(200), | ||
CREATED_201(201), | ||
ACCEPTED_202(202), | ||
NON_AUTHORITATIVE_INFORMATION_203(203), | ||
NO_CONTENT_204(204), | ||
RESET_CONTENT_205(205), | ||
PARTIAL_CONTENT_206(206), | ||
MULTI_STATUS_207(207), | ||
|
||
// 3xx Redirection | ||
MOVED_PERMANENTLY_301(301), | ||
FOUND_302(302), | ||
SEE_OTHER_303(303), | ||
NOT_MODIFIED_304(304), | ||
USE_PROXY_305(305), | ||
TEMPORARY_REDIRECT_307(307), | ||
PERMANENT_REDIRECT_308(308), | ||
|
||
// 4xx Client Error | ||
BAD_REQUEST_400(400), | ||
UNAUTHORIZED_401(401), | ||
PAYMENT_REQUIRED_402(402), | ||
FORBIDDEN_403(403), | ||
NOT_FOUND_404(404), | ||
METHOD_NOT_ALLOWED_405(405), | ||
NOT_ACCEPTABLE_406(406), | ||
PROXY_AUTHENTICATION_REQUIRED_407(407), | ||
REQUEST_TIMEOUT_408(408), | ||
CONFLICT_409(409), | ||
GONE_410(410), | ||
LENGTH_REQUIRED_411(411), | ||
PRECONDITION_FAILED_412(412), | ||
REQUEST_ENTITY_TOO_LARGE_413(413), | ||
REQUEST_URI_TOO_LONG_414(414), | ||
UNSUPPORTED_MEDIA_TYPE_415(415), | ||
REQUESTED_RANGE_NOT_SATISFIABLE_416(416), | ||
EXPECTATION_FAILED_417(417), | ||
I_AM_A_TEAPOT_418(418), | ||
MISDIRECTED_REQUEST_421(421), | ||
UNPROCESSABLE_CONTENT_422(422), | ||
LOCKED_423(423), | ||
FAILED_DEPENDENCY_424(424), | ||
UPGRADE_REQUIRED_426(426), | ||
PRECONDITION_REQUIRED_428(428), | ||
TOO_MANY_REQUESTS_429(429), | ||
|
||
// 5xx Server Error | ||
INTERNAL_SERVER_ERROR_500(500), | ||
NOT_IMPLEMENTED_501(501), | ||
BAD_GATEWAY_502(502), | ||
SERVICE_UNAVAILABLE_503(503), | ||
GATEWAY_TIMEOUT_504(504), | ||
HTTP_VERSION_NOT_SUPPORTED_505(505), | ||
INSUFFICIENT_STORAGE_507(507), | ||
LOOP_DETECTED_508(508), | ||
NOT_EXTENDED_510(510), | ||
NETWORK_AUTHENTICATION_REQUIRED_511(511); | ||
|
||
private final int status; | ||
|
||
HttpStatus(int status) { | ||
this.status = status; | ||
} | ||
|
||
public int status() { | ||
return status; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters