Removed unwanted changed

This commit is contained in:
Tim Ysewyn
2019-08-02 12:09:00 +02:00
parent 9935b24a25
commit b07e50bd8d
13 changed files with 415 additions and 458 deletions

View File

@@ -36,6 +36,8 @@ public class BodyMatchers {
protected final List<BodyMatcher> matchers = new LinkedList<>();
private final RegexPatterns regexPatterns = new RegexPatterns();
public void jsonPath(String path, MatchingTypeValue matchingType) {
this.matchers.add(new PathBodyMatcher(path, matchingType));
}
@@ -69,15 +71,16 @@ public class BodyMatchers {
}
public MatchingTypeValue byDate() {
return new MatchingTypeValue(MatchingType.DATE, RegexPatterns.isoDate());
return new MatchingTypeValue(MatchingType.DATE, this.regexPatterns.isoDate());
}
public MatchingTypeValue byTime() {
return new MatchingTypeValue(MatchingType.TIME, RegexPatterns.isoTime());
return new MatchingTypeValue(MatchingType.TIME, this.regexPatterns.isoTime());
}
public MatchingTypeValue byTimestamp() {
return new MatchingTypeValue(MatchingType.TIMESTAMP, RegexPatterns.isoDateTime());
return new MatchingTypeValue(MatchingType.TIMESTAMP,
this.regexPatterns.isoDateTime());
}
public RegexMatchingTypeValue byRegex(String regex) {

View File

@@ -32,12 +32,12 @@ import java.util.stream.Collectors;
/**
* Contains useful common methods for the DSL.
*
* @author Marcin Grzejszczak
* @author Tim Ysewyn
* @since 1.0.0
*/
public class Common {
private final RegexPatterns regexPatterns = new RegexPatterns();
public Map<String, DslProperty> convertObjectsToDslProperties(
Map<String, Object> body) {
return body.entrySet().stream().collect(Collectors.toMap(
@@ -324,79 +324,79 @@ public class Common {
}
public RegexProperty onlyAlphaUnicode() {
return RegexPatterns.onlyAlphaUnicode();
return regexPatterns.onlyAlphaUnicode();
}
public RegexProperty alphaNumeric() {
return RegexPatterns.alphaNumeric();
return regexPatterns.alphaNumeric();
}
public RegexProperty number() {
return RegexPatterns.number();
return regexPatterns.number();
}
public RegexProperty positiveInt() {
return RegexPatterns.positiveInt();
return regexPatterns.positiveInt();
}
public RegexProperty anyBoolean() {
return RegexPatterns.anyBoolean();
return regexPatterns.anyBoolean();
}
public RegexProperty anInteger() {
return RegexPatterns.anInteger();
return regexPatterns.anInteger();
}
public RegexProperty aDouble() {
return RegexPatterns.aDouble();
return regexPatterns.aDouble();
}
public RegexProperty ipAddress() {
return RegexPatterns.ipAddress();
return regexPatterns.ipAddress();
}
public RegexProperty hostname() {
return RegexPatterns.hostname();
return regexPatterns.hostname();
}
public RegexProperty email() {
return RegexPatterns.email();
return regexPatterns.email();
}
public RegexProperty url() {
return RegexPatterns.url();
return regexPatterns.url();
}
public RegexProperty httpsUrl() {
return RegexPatterns.httpsUrl();
return regexPatterns.httpsUrl();
}
public RegexProperty uuid() {
return RegexPatterns.uuid();
return regexPatterns.uuid();
}
public RegexProperty isoDate() {
return RegexPatterns.isoDate();
return regexPatterns.isoDate();
}
public RegexProperty isoDateTime() {
return RegexPatterns.isoDateTime();
return regexPatterns.isoDateTime();
}
public RegexProperty isoTime() {
return RegexPatterns.isoTime();
return regexPatterns.isoTime();
}
public RegexProperty iso8601WithOffset() {
return RegexPatterns.iso8601WithOffset();
return regexPatterns.iso8601WithOffset();
}
public RegexProperty nonEmpty() {
return RegexPatterns.nonEmpty();
return regexPatterns.nonEmpty();
}
public RegexProperty nonBlank() {
return RegexPatterns.nonBlank();
return regexPatterns.nonBlank();
}
}

View File

@@ -20,7 +20,6 @@ package org.springframework.cloud.contract.spec.internal;
* Helper functions for HTTP statuses.
*
* @author Marcin Grzejszczak
* @author Tim Ysewyn
* @since 2.0.0
*/
public class HttpStatus {
@@ -30,7 +29,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.2.1" > HTTP/1.1:
* Semantics and Content, section 6.2.1</a>
*/
public static int CONTINUE() {
public int CONTINUE() {
return 100;
}
@@ -39,7 +38,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.2.2" > HTTP/1.1:
* Semantics and Content, section 6.2.2</a>
*/
public static int SWITCHING_PROTOCOLS() {
public int SWITCHING_PROTOCOLS() {
return 101;
}
@@ -47,7 +46,7 @@ public class HttpStatus {
* {@code 102 Processing}.
* @see <ahref="https://tools.ietf.org/html/rfc2518#section-10.1" > WebDAV</a>
*/
public static int PROCESSING() {
public int PROCESSING() {
return 102;
}
@@ -56,7 +55,7 @@ public class HttpStatus {
* @see <ahref="https://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal" >
* A proposal for supporting resumable POST/PUT HTTP requests in HTTP/1.0</a>
*/
public static int CHECKPOINT() {
public int CHECKPOINT() {
return 103;
}
@@ -65,7 +64,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.1" > HTTP/1.1:
* Semantics and Content, section 6.3.1</a>
*/
public static int OK() {
public int OK() {
return 200;
}
@@ -74,7 +73,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.2" > HTTP/1.1:
* Semantics and Content, section 6.3.2</a>
*/
public static int CREATED() {
public int CREATED() {
return 201;
}
@@ -83,7 +82,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.3" > HTTP/1.1:
* Semantics and Content, section 6.3.3</a>
*/
public static int ACCEPTED() {
public int ACCEPTED() {
return 202;
}
@@ -92,7 +91,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.4" > HTTP/1.1:
* Semantics and Content, section 6.3.4</a>
*/
public static int NON_AUTHORITATIVE_INFORMATION() {
public int NON_AUTHORITATIVE_INFORMATION() {
return 203;
}
@@ -101,7 +100,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.5" > HTTP/1.1:
* Semantics and Content, section 6.3.5</a>
*/
public static int NO_CONTENT() {
public int NO_CONTENT() {
return 204;
}
@@ -110,7 +109,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.3.6" > HTTP/1.1:
* Semantics and Content, section 6.3.6</a>
*/
public static int RESET_CONTENT() {
public int RESET_CONTENT() {
return 205;
}
@@ -119,7 +118,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7233#section-4.1" > HTTP/1.1: Range
* Requests, section 4.1</a>
*/
public static int PARTIAL_CONTENT() {
public int PARTIAL_CONTENT() {
return 206;
}
@@ -127,7 +126,7 @@ public class HttpStatus {
* {@code 207 Multi-Status}.
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-13" > WebDAV</a>
*/
public static int MULTI_STATUS() {
public int MULTI_STATUS() {
return 207;
}
@@ -136,7 +135,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc5842#section-7.1" > WebDAV Binding
* Extensions</a>
*/
public static int ALREADY_REPORTED() {
public int ALREADY_REPORTED() {
return 208;
}
@@ -145,7 +144,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc3229#section-10.4.1" > Delta encoding
* in HTTP</a>
*/
public static int IM_USED() {
public int IM_USED() {
return 226;
}
@@ -154,7 +153,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.1" > HTTP/1.1:
* Semantics and Content, section 6.4.1</a>
*/
public static int MULTIPLE_CHOICES() {
public int MULTIPLE_CHOICES() {
return 300;
}
@@ -163,7 +162,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.2" > HTTP/1.1:
* Semantics and Content, section 6.4.2</a>
*/
public static int MOVED_PERMANENTLY() {
public int MOVED_PERMANENTLY() {
return 301;
}
@@ -172,7 +171,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.3" > HTTP/1.1:
* Semantics and Content, section 6.4.3</a>
*/
public static int FOUND() {
public int FOUND() {
return 302;
}
@@ -184,7 +183,7 @@ public class HttpStatus {
* {@code HttpStatus.valueOf(302)}
*/
@Deprecated
public static int MOVED_TEMPORARILY() {
public int MOVED_TEMPORARILY() {
return 302;
}
@@ -193,7 +192,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.4" > HTTP/1.1:
* Semantics and Content, section 6.4.4</a>
*/
public static int SEE_OTHER() {
public int SEE_OTHER() {
return 303;
}
@@ -202,7 +201,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7232#section-4.1" > HTTP/1.1:
* Conditional Requests, section 4.1</a>
*/
public static int NOT_MODIFIED() {
public int NOT_MODIFIED() {
return 304;
}
@@ -213,7 +212,7 @@ public class HttpStatus {
* @deprecated due to security concerns regarding in-band configuration of a proxy
*/
@Deprecated
public static int USE_PROXY() {
public int USE_PROXY() {
return 305;
}
@@ -222,7 +221,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.4.7" > HTTP/1.1:
* Semantics and Content, section 6.4.7</a>
*/
public static int TEMPORARY_REDIRECT() {
public int TEMPORARY_REDIRECT() {
return 307;
}
@@ -230,7 +229,7 @@ public class HttpStatus {
* {@code 308 Permanent Redirect}.
* @see <ahref="https://tools.ietf.org/html/rfc7238" > RFC 7238</a>
*/
public static int PERMANENT_REDIRECT() {
public int PERMANENT_REDIRECT() {
return 308;
}
@@ -239,7 +238,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.1" > HTTP/1.1:
* Semantics and Content, section 6.5.1</a>
*/
public static int BAD_REQUEST() {
public int BAD_REQUEST() {
return 400;
}
@@ -248,7 +247,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7235#section-3.1" > HTTP/1.1:
* Authentication, section 3.1</a>
*/
public static int UNAUTHORIZED() {
public int UNAUTHORIZED() {
return 401;
}
@@ -257,7 +256,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.2" > HTTP/1.1:
* Semantics and Content, section 6.5.2</a>
*/
public static int PAYMENT_REQUIRED() {
public int PAYMENT_REQUIRED() {
return 402;
}
@@ -266,7 +265,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.3" > HTTP/1.1:
* Semantics and Content, section 6.5.3</a>
*/
public static int FORBIDDEN() {
public int FORBIDDEN() {
return 403;
}
@@ -275,7 +274,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.4" > HTTP/1.1:
* Semantics and Content, section 6.5.4</a>
*/
public static int NOT_FOUND() {
public int NOT_FOUND() {
return 404;
}
@@ -284,7 +283,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.5" > HTTP/1.1:
* Semantics and Content, section 6.5.5</a>
*/
public static int METHOD_NOT_ALLOWED() {
public int METHOD_NOT_ALLOWED() {
return 405;
}
@@ -293,7 +292,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.6" > HTTP/1.1:
* Semantics and Content, section 6.5.6</a>
*/
public static int NOT_ACCEPTABLE() {
public int NOT_ACCEPTABLE() {
return 406;
}
@@ -302,7 +301,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7235#section-3.2" > HTTP/1.1:
* Authentication, section 3.2</a>
*/
public static int PROXY_AUTHENTICATION_REQUIRED() {
public int PROXY_AUTHENTICATION_REQUIRED() {
return 407;
}
@@ -311,7 +310,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.7" > HTTP/1.1:
* Semantics and Content, section 6.5.7</a>
*/
public static int REQUEST_TIMEOUT() {
public int REQUEST_TIMEOUT() {
return 408;
}
@@ -320,7 +319,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.8" > HTTP/1.1:
* Semantics and Content, section 6.5.8</a>
*/
public static int CONFLICT() {
public int CONFLICT() {
return 409;
}
@@ -329,7 +328,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.9" > HTTP/1.1:
* Semantics and Content, section 6.5.9</a>
*/
public static int GONE() {
public int GONE() {
return 410;
}
@@ -338,7 +337,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.10" > HTTP/1.1:
* Semantics and Content, section 6.5.10</a>
*/
public static int LENGTH_REQUIRED() {
public int LENGTH_REQUIRED() {
return 411;
}
@@ -347,7 +346,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7232#section-4.2" > HTTP/1.1:
* Conditional Requests, section 4.2</a>
*/
public static int PRECONDITION_FAILED() {
public int PRECONDITION_FAILED() {
return 412;
}
@@ -356,7 +355,7 @@ public class HttpStatus {
* @since 4.1* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.11" >
* HTTP/1.1: Semantics and Content, section 6.5.11</a>
*/
public static int PAYLOAD_TOO_LARGE() {
public int PAYLOAD_TOO_LARGE() {
return 413;
}
@@ -368,7 +367,7 @@ public class HttpStatus {
* {@code HttpStatus.valueOf(413)}
*/
@Deprecated
public static int REQUEST_ENTITY_TOO_LARGE() {
public int REQUEST_ENTITY_TOO_LARGE() {
return 413;
}
@@ -377,7 +376,7 @@ public class HttpStatus {
* @since 4.1* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.12" >
* HTTP/1.1: Semantics and Content, section 6.5.12</a>
*/
public static int URI_TOO_LONG() {
public int URI_TOO_LONG() {
return 414;
}
@@ -389,7 +388,7 @@ public class HttpStatus {
* {@code HttpStatus.valueOf(414)}
*/
@Deprecated
public static int REQUEST_URI_TOO_LONG() {
public int REQUEST_URI_TOO_LONG() {
return 414;
}
@@ -398,7 +397,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.13" > HTTP/1.1:
* Semantics and Content, section 6.5.13</a>
*/
public static int UNSUPPORTED_MEDIA_TYPE() {
public int UNSUPPORTED_MEDIA_TYPE() {
return 415;
}
@@ -407,7 +406,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7233#section-4.4" > HTTP/1.1: Range
* Requests, section 4.4</a>
*/
public static int REQUESTED_RANGE_NOT_SATISFIABLE() {
public int REQUESTED_RANGE_NOT_SATISFIABLE() {
return 416;
}
@@ -416,7 +415,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.5.14" > HTTP/1.1:
* Semantics and Content, section 6.5.14</a>
*/
public static int EXPECTATION_FAILED() {
public int EXPECTATION_FAILED() {
return 417;
}
@@ -424,7 +423,7 @@ public class HttpStatus {
* {@code 418 I'm a teapot}.
* @see <ahref="https://tools.ietf.org/html/rfc2324#section-2.3.2" > HTCPCP/1.0</a>
*/
public static int I_AM_A_TEAPOT() {
public int I_AM_A_TEAPOT() {
return 418;
}
@@ -434,7 +433,7 @@ public class HttpStatus {
* Draft Changes</a>
*/
@Deprecated
public static int INSUFFICIENT_SPACE_ON_RESOURCE() {
public int INSUFFICIENT_SPACE_ON_RESOURCE() {
return 419;
}
@@ -444,7 +443,7 @@ public class HttpStatus {
* Draft Changes</a>
*/
@Deprecated
public static int METHOD_FAILURE() {
public int METHOD_FAILURE() {
return 420;
}
@@ -454,7 +453,7 @@ public class HttpStatus {
* Draft Changes</a>
*/
@Deprecated
public static int DESTINATION_LOCKED() {
public int DESTINATION_LOCKED() {
return 421;
}
@@ -462,7 +461,7 @@ public class HttpStatus {
* {@code 422 Unprocessable Entity}.
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-11.2" > WebDAV</a>
*/
public static int UNPROCESSABLE_ENTITY() {
public int UNPROCESSABLE_ENTITY() {
return 422;
}
@@ -470,7 +469,7 @@ public class HttpStatus {
* {@code 423 Locked}.
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-11.3" > WebDAV</a>
*/
public static int LOCKED() {
public int LOCKED() {
return 423;
}
@@ -478,7 +477,7 @@ public class HttpStatus {
* {@code 424 Failed Dependency}.
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-11.4" > WebDAV</a>
*/
public static int FAILED_DEPENDENCY() {
public int FAILED_DEPENDENCY() {
return 424;
}
@@ -487,7 +486,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc2817#section-6" > Upgrading to TLS
* Within HTTP/1.1</a>
*/
public static int UPGRADE_REQUIRED() {
public int UPGRADE_REQUIRED() {
return 426;
}
@@ -496,7 +495,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc6585#section-3" > Additional HTTP
* Status Codes</a>
*/
public static int PRECONDITION_REQUIRED() {
public int PRECONDITION_REQUIRED() {
return 428;
}
@@ -505,7 +504,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc6585#section-4" > Additional HTTP
* Status Codes</a>
*/
public static int TOO_MANY_REQUESTS() {
public int TOO_MANY_REQUESTS() {
return 429;
}
@@ -514,7 +513,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc6585#section-5" > Additional HTTP
* Status Codes</a>
*/
public static int REQUEST_HEADER_FIELDS_TOO_LARGE() {
public int REQUEST_HEADER_FIELDS_TOO_LARGE() {
return 431;
}
@@ -524,7 +523,7 @@ public class HttpStatus {
* > An HTTP Status Code to Report Legal Obstacles</a>
* @since 4.3
*/
public static int UNAVAILABLE_FOR_LEGAL_REASONS() {
public int UNAVAILABLE_FOR_LEGAL_REASONS() {
return 451;
}
@@ -533,7 +532,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.1" > HTTP/1.1:
* Semantics and Content, section 6.6.1</a>
*/
public static int INTERNAL_SERVER_ERROR() {
public int INTERNAL_SERVER_ERROR() {
return 500;
}
@@ -542,7 +541,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.2" > HTTP/1.1:
* Semantics and Content, section 6.6.2</a>
*/
public static int NOT_IMPLEMENTED() {
public int NOT_IMPLEMENTED() {
return 501;
}
@@ -551,7 +550,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.3" > HTTP/1.1:
* Semantics and Content, section 6.6.3</a>
*/
public static int BAD_GATEWAY() {
public int BAD_GATEWAY() {
return 502;
}
@@ -560,7 +559,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.4" > HTTP/1.1:
* Semantics and Content, section 6.6.4</a>
*/
public static int SERVICE_UNAVAILABLE() {
public int SERVICE_UNAVAILABLE() {
return 503;
}
@@ -569,7 +568,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.5" > HTTP/1.1:
* Semantics and Content, section 6.6.5</a>
*/
public static int GATEWAY_TIMEOUT() {
public int GATEWAY_TIMEOUT() {
return 504;
}
@@ -578,7 +577,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc7231#section-6.6.6" > HTTP/1.1:
* Semantics and Content, section 6.6.6</a>
*/
public static int HTTP_VERSION_NOT_SUPPORTED() {
public int HTTP_VERSION_NOT_SUPPORTED() {
return 505;
}
@@ -587,7 +586,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc2295#section-8.1" > Transparent Content
* Negotiation</a>
*/
public static int VARIANT_ALSO_NEGOTIATES() {
public int VARIANT_ALSO_NEGOTIATES() {
return 506;
}
@@ -595,7 +594,7 @@ public class HttpStatus {
* {@code 507 Insufficient Storage}
* @see <ahref="https://tools.ietf.org/html/rfc4918#section-11.5" > WebDAV</a>
*/
public static int INSUFFICIENT_STORAGE() {
public int INSUFFICIENT_STORAGE() {
return 507;
}
@@ -604,14 +603,14 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc5842#section-7.2" > WebDAV Binding
* Extensions</a>
*/
public static int LOOP_DETECTED() {
public int LOOP_DETECTED() {
return 508;
}
/**
* {@code 509 Bandwidth Limit Exceeded}
*/
public static int BANDWIDTH_LIMIT_EXCEEDED() {
public int BANDWIDTH_LIMIT_EXCEEDED() {
return 509;
}
@@ -620,7 +619,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc2774#section-7" > HTTP Extension
* Framework</a>
*/
public static int NOT_EXTENDED() {
public int NOT_EXTENDED() {
return 510;
}
@@ -629,7 +628,7 @@ public class HttpStatus {
* @see <ahref="https://tools.ietf.org/html/rfc6585#section-6" > Additional HTTP
* Status Codes</a>
*/
public static int NETWORK_AUTHENTICATION_REQUIRED() {
public int NETWORK_AUTHENTICATION_REQUIRED() {
return 511;
}

View File

@@ -27,12 +27,9 @@ import java.util.stream.Collectors;
* @author Tim Ysewyn
* @since 1.0.0
*/
public final class RegexPatterns {
private RegexPatterns() {
// Shouldn't be instantiated
}
public class RegexPatterns {
// tag::regexps[]
protected static final Pattern TRUE_OR_FALSE = Pattern.compile("(true|false)");
protected static final Pattern ALPHA_NUMERIC = Pattern.compile("[a-zA-Z0-9]+");
@@ -111,84 +108,82 @@ public final class RegexPatterns {
return contentType.toString();
}
// tag::regexps[]
public static RegexProperty onlyAlphaUnicode() {
public RegexProperty onlyAlphaUnicode() {
return new RegexProperty(ONLY_ALPHA_UNICODE).asString();
}
public static RegexProperty alphaNumeric() {
public RegexProperty alphaNumeric() {
return new RegexProperty(ALPHA_NUMERIC).asString();
}
public static RegexProperty number() {
public RegexProperty number() {
return new RegexProperty(NUMBER).asDouble();
}
public static RegexProperty positiveInt() {
public RegexProperty positiveInt() {
return new RegexProperty(POSITIVE_INT).asInteger();
}
public static RegexProperty anyBoolean() {
public RegexProperty anyBoolean() {
return new RegexProperty(TRUE_OR_FALSE).asBooleanType();
}
public static RegexProperty anInteger() {
public RegexProperty anInteger() {
return new RegexProperty(INTEGER).asInteger();
}
public static RegexProperty aDouble() {
public RegexProperty aDouble() {
return new RegexProperty(DOUBLE).asDouble();
}
public static RegexProperty ipAddress() {
public RegexProperty ipAddress() {
return new RegexProperty(IP_ADDRESS).asString();
}
public static RegexProperty hostname() {
public RegexProperty hostname() {
return new RegexProperty(HOSTNAME_PATTERN).asString();
}
public static RegexProperty email() {
public RegexProperty email() {
return new RegexProperty(EMAIL).asString();
}
public static RegexProperty url() {
public RegexProperty url() {
return new RegexProperty(URL).asString();
}
public static RegexProperty httpsUrl() {
public RegexProperty httpsUrl() {
return new RegexProperty(HTTPS_URL).asString();
}
public static RegexProperty uuid() {
public RegexProperty uuid() {
return new RegexProperty(UUID).asString();
}
public static RegexProperty isoDate() {
public RegexProperty isoDate() {
return new RegexProperty(ANY_DATE).asString();
}
public static RegexProperty isoDateTime() {
public RegexProperty isoDateTime() {
return new RegexProperty(ANY_DATE_TIME).asString();
}
public static RegexProperty isoTime() {
public RegexProperty isoTime() {
return new RegexProperty(ANY_TIME).asString();
}
public static RegexProperty iso8601WithOffset() {
return new RegexProperty(ISO8601_WITH_OFFSET).asString();
}
public static RegexProperty nonEmpty() {
return new RegexProperty(NON_EMPTY).asString();
}
public static RegexProperty nonBlank() {
return new RegexProperty(NON_BLANK).asString();
}
// end::regexps[]
public RegexProperty iso8601WithOffset() {
return new RegexProperty(ISO8601_WITH_OFFSET).asString();
}
public RegexProperty nonEmpty() {
return new RegexProperty(NON_EMPTY).asString();
}
public RegexProperty nonBlank() {
return new RegexProperty(NON_BLANK).asString();
}
}

View File

@@ -56,6 +56,8 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
private ServerPatternValueDslProperty property = new ServerPatternValueDslProperty();
private HttpStatus httpStatus = new HttpStatus();
public Response() {
}
@@ -249,6 +251,14 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
this.property = property;
}
public HttpStatus getHttpStatus() {
return httpStatus;
}
public void setHttpStatus(HttpStatus httpStatus) {
this.httpStatus = httpStatus;
}
public DslProperty getStatus() {
return status;
}
@@ -415,278 +425,278 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
}
public int CONTINUE() {
return HttpStatus.CONTINUE();
return httpStatus.CONTINUE();
}
public int SWITCHING_PROTOCOLS() {
return HttpStatus.SWITCHING_PROTOCOLS();
return httpStatus.SWITCHING_PROTOCOLS();
}
public int PROCESSING() {
return HttpStatus.PROCESSING();
return httpStatus.PROCESSING();
}
public int CHECKPOINT() {
return HttpStatus.CHECKPOINT();
return httpStatus.CHECKPOINT();
}
public int OK() {
return HttpStatus.OK();
return httpStatus.OK();
}
public int CREATED() {
return HttpStatus.CREATED();
return httpStatus.CREATED();
}
public int ACCEPTED() {
return HttpStatus.ACCEPTED();
return httpStatus.ACCEPTED();
}
public int NON_AUTHORITATIVE_INFORMATION() {
return HttpStatus.NON_AUTHORITATIVE_INFORMATION();
return httpStatus.NON_AUTHORITATIVE_INFORMATION();
}
public int NO_CONTENT() {
return HttpStatus.NO_CONTENT();
return httpStatus.NO_CONTENT();
}
public int RESET_CONTENT() {
return HttpStatus.RESET_CONTENT();
return httpStatus.RESET_CONTENT();
}
public int PARTIAL_CONTENT() {
return HttpStatus.PARTIAL_CONTENT();
return httpStatus.PARTIAL_CONTENT();
}
public int MULTI_STATUS() {
return HttpStatus.MULTI_STATUS();
return httpStatus.MULTI_STATUS();
}
public int ALREADY_REPORTED() {
return HttpStatus.ALREADY_REPORTED();
return httpStatus.ALREADY_REPORTED();
}
public int IM_USED() {
return HttpStatus.IM_USED();
return httpStatus.IM_USED();
}
public int MULTIPLE_CHOICES() {
return HttpStatus.MULTIPLE_CHOICES();
return httpStatus.MULTIPLE_CHOICES();
}
public int MOVED_PERMANENTLY() {
return HttpStatus.MOVED_PERMANENTLY();
return httpStatus.MOVED_PERMANENTLY();
}
public int FOUND() {
return HttpStatus.FOUND();
return httpStatus.FOUND();
}
@Deprecated
public int MOVED_TEMPORARILY() {
return HttpStatus.MOVED_TEMPORARILY();
return httpStatus.MOVED_TEMPORARILY();
}
public int SEE_OTHER() {
return HttpStatus.SEE_OTHER();
return httpStatus.SEE_OTHER();
}
public int NOT_MODIFIED() {
return HttpStatus.NOT_MODIFIED();
return httpStatus.NOT_MODIFIED();
}
@Deprecated
public int USE_PROXY() {
return HttpStatus.USE_PROXY();
return httpStatus.USE_PROXY();
}
public int TEMPORARY_REDIRECT() {
return HttpStatus.TEMPORARY_REDIRECT();
return httpStatus.TEMPORARY_REDIRECT();
}
public int PERMANENT_REDIRECT() {
return HttpStatus.PERMANENT_REDIRECT();
return httpStatus.PERMANENT_REDIRECT();
}
public int BAD_REQUEST() {
return HttpStatus.BAD_REQUEST();
return httpStatus.BAD_REQUEST();
}
public int UNAUTHORIZED() {
return HttpStatus.UNAUTHORIZED();
return httpStatus.UNAUTHORIZED();
}
public int PAYMENT_REQUIRED() {
return HttpStatus.PAYMENT_REQUIRED();
return httpStatus.PAYMENT_REQUIRED();
}
public int FORBIDDEN() {
return HttpStatus.FORBIDDEN();
return httpStatus.FORBIDDEN();
}
public int NOT_FOUND() {
return HttpStatus.NOT_FOUND();
return httpStatus.NOT_FOUND();
}
public int METHOD_NOT_ALLOWED() {
return HttpStatus.METHOD_NOT_ALLOWED();
return httpStatus.METHOD_NOT_ALLOWED();
}
public int NOT_ACCEPTABLE() {
return HttpStatus.NOT_ACCEPTABLE();
return httpStatus.NOT_ACCEPTABLE();
}
public int PROXY_AUTHENTICATION_REQUIRED() {
return HttpStatus.PROXY_AUTHENTICATION_REQUIRED();
return httpStatus.PROXY_AUTHENTICATION_REQUIRED();
}
public int REQUEST_TIMEOUT() {
return HttpStatus.REQUEST_TIMEOUT();
return httpStatus.REQUEST_TIMEOUT();
}
public int CONFLICT() {
return HttpStatus.CONFLICT();
return httpStatus.CONFLICT();
}
public int GONE() {
return HttpStatus.GONE();
return httpStatus.GONE();
}
public int LENGTH_REQUIRED() {
return HttpStatus.LENGTH_REQUIRED();
return httpStatus.LENGTH_REQUIRED();
}
public int PRECONDITION_FAILED() {
return HttpStatus.PRECONDITION_FAILED();
return httpStatus.PRECONDITION_FAILED();
}
public int PAYLOAD_TOO_LARGE() {
return HttpStatus.PAYLOAD_TOO_LARGE();
return httpStatus.PAYLOAD_TOO_LARGE();
}
@Deprecated
public int REQUEST_ENTITY_TOO_LARGE() {
return HttpStatus.REQUEST_ENTITY_TOO_LARGE();
return httpStatus.REQUEST_ENTITY_TOO_LARGE();
}
public int URI_TOO_LONG() {
return HttpStatus.URI_TOO_LONG();
return httpStatus.URI_TOO_LONG();
}
@Deprecated
public int REQUEST_URI_TOO_LONG() {
return HttpStatus.REQUEST_URI_TOO_LONG();
return httpStatus.REQUEST_URI_TOO_LONG();
}
public int UNSUPPORTED_MEDIA_TYPE() {
return HttpStatus.UNSUPPORTED_MEDIA_TYPE();
return httpStatus.UNSUPPORTED_MEDIA_TYPE();
}
public int REQUESTED_RANGE_NOT_SATISFIABLE() {
return HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE();
return httpStatus.REQUESTED_RANGE_NOT_SATISFIABLE();
}
public int EXPECTATION_FAILED() {
return HttpStatus.EXPECTATION_FAILED();
return httpStatus.EXPECTATION_FAILED();
}
public int I_AM_A_TEAPOT() {
return HttpStatus.I_AM_A_TEAPOT();
return httpStatus.I_AM_A_TEAPOT();
}
@Deprecated
public int INSUFFICIENT_SPACE_ON_RESOURCE() {
return HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE();
return httpStatus.INSUFFICIENT_SPACE_ON_RESOURCE();
}
@Deprecated
public int METHOD_FAILURE() {
return HttpStatus.METHOD_FAILURE();
return httpStatus.METHOD_FAILURE();
}
@Deprecated
public int DESTINATION_LOCKED() {
return HttpStatus.DESTINATION_LOCKED();
return httpStatus.DESTINATION_LOCKED();
}
public int UNPROCESSABLE_ENTITY() {
return HttpStatus.UNPROCESSABLE_ENTITY();
return httpStatus.UNPROCESSABLE_ENTITY();
}
public int LOCKED() {
return HttpStatus.LOCKED();
return httpStatus.LOCKED();
}
public int FAILED_DEPENDENCY() {
return HttpStatus.FAILED_DEPENDENCY();
return httpStatus.FAILED_DEPENDENCY();
}
public int UPGRADE_REQUIRED() {
return HttpStatus.UPGRADE_REQUIRED();
return httpStatus.UPGRADE_REQUIRED();
}
public int PRECONDITION_REQUIRED() {
return HttpStatus.PRECONDITION_REQUIRED();
return httpStatus.PRECONDITION_REQUIRED();
}
public int TOO_MANY_REQUESTS() {
return HttpStatus.TOO_MANY_REQUESTS();
return httpStatus.TOO_MANY_REQUESTS();
}
public int REQUEST_HEADER_FIELDS_TOO_LARGE() {
return HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE();
return httpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE();
}
public int UNAVAILABLE_FOR_LEGAL_REASONS() {
return HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS();
return httpStatus.UNAVAILABLE_FOR_LEGAL_REASONS();
}
public int INTERNAL_SERVER_ERROR() {
return HttpStatus.INTERNAL_SERVER_ERROR();
return httpStatus.INTERNAL_SERVER_ERROR();
}
public int NOT_IMPLEMENTED() {
return HttpStatus.NOT_IMPLEMENTED();
return httpStatus.NOT_IMPLEMENTED();
}
public int BAD_GATEWAY() {
return HttpStatus.BAD_GATEWAY();
return httpStatus.BAD_GATEWAY();
}
public int SERVICE_UNAVAILABLE() {
return HttpStatus.SERVICE_UNAVAILABLE();
return httpStatus.SERVICE_UNAVAILABLE();
}
public int GATEWAY_TIMEOUT() {
return HttpStatus.GATEWAY_TIMEOUT();
return httpStatus.GATEWAY_TIMEOUT();
}
public int HTTP_VERSION_NOT_SUPPORTED() {
return HttpStatus.HTTP_VERSION_NOT_SUPPORTED();
return httpStatus.HTTP_VERSION_NOT_SUPPORTED();
}
public int VARIANT_ALSO_NEGOTIATES() {
return HttpStatus.VARIANT_ALSO_NEGOTIATES();
return httpStatus.VARIANT_ALSO_NEGOTIATES();
}
public int INSUFFICIENT_STORAGE() {
return HttpStatus.INSUFFICIENT_STORAGE();
return httpStatus.INSUFFICIENT_STORAGE();
}
public int LOOP_DETECTED() {
return HttpStatus.LOOP_DETECTED();
return httpStatus.LOOP_DETECTED();
}
public int BANDWIDTH_LIMIT_EXCEEDED() {
return HttpStatus.BANDWIDTH_LIMIT_EXCEEDED();
return httpStatus.BANDWIDTH_LIMIT_EXCEEDED();
}
public int NOT_EXTENDED() {
return HttpStatus.NOT_EXTENDED();
return httpStatus.NOT_EXTENDED();
}
public int NETWORK_AUTHENTICATION_REQUIRED() {
return HttpStatus.NETWORK_AUTHENTICATION_REQUIRED();
return httpStatus.NETWORK_AUTHENTICATION_REQUIRED();
}
@Override