You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2021/02/12 23:05:51 UTC
[juneau] branch master updated: Remove @RestOp(priority).
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 0d34191 Remove @RestOp(priority).
0d34191 is described below
commit 0d34191b5f6ace55ceaa6a223c392bf834e3973d
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Fri Feb 12 18:05:32 2021 -0500
Remove @RestOp(priority).
---
.../apache/juneau/rest/RestOperationContext.java | 42 ----------------------
.../juneau/rest/RestOperationContextBuilder.java | 18 ----------
.../org/apache/juneau/rest/annotation/RestOp.java | 11 ------
.../juneau/rest/annotation/RestOpAnnotation.java | 20 -----------
.../rest/annotation/RestOpAnnotation_Test.java | 5 ---
5 files changed, 96 deletions(-)
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOperationContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOperationContext.java
index 4dbee76..777a10e 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOperationContext.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOperationContext.java
@@ -634,40 +634,6 @@ public class RestOperationContext extends BeanContext implements Comparable<Rest
*/
public static final String RESTOP_path = PREFIX + ".path.ls";
- /**
- * Configuration property: Priority.
- *
- * <h5 class='section'>Property:</h5>
- * <ul class='spaced-list'>
- * <li><b>ID:</b> {@link org.apache.juneau.rest.RestOperationContext#RESTOP_priority RESTMETHOD_priority}
- * <li><b>Name:</b> <js>"RestOperationContext.priority.i"</js>
- * <li><b>Data type:</b> <jk>int</jk>
- * <li><b>System property:</b> <c>RestOperationContext.priority</c>
- * <li><b>Environment variable:</b> <c>RESTOPERATIONCONTEXT_PRIORITY</c>
- * <li><b>Default:</b> <c>0</c>
- * <li><b>Session property:</b> <jk>false</jk>
- * <li><b>Annotations:</b>
- * <ul>
- * <li class='ja'>{@link org.apache.juneau.rest.annotation.RestOp#priority()}
- * </ul>
- * <li><b>Methods:</b>
- * <ul>
- * <li class='jm'>{@link org.apache.juneau.rest.RestOperationContextBuilder#priority(int)}
- * </ul>
- * </ul>
- *
- * <h5 class='section'>Description:</h5>
- * <p>
- * URL path pattern priority.
- *
- * <p>
- * To force path patterns to be checked before other path patterns, use a higher priority number.
- *
- * <p>
- * By default, it's <c>0</c>, which means it will use an internal heuristic to determine a best match.
- */
- public static final String RESTOP_priority = PREFIX + ".priority.i";
-
//-------------------------------------------------------------------------------------------------------------------
// Instance
//-------------------------------------------------------------------------------------------------------------------
@@ -679,7 +645,6 @@ public class RestOperationContext extends BeanContext implements Comparable<Rest
private final RestMatcher[] optionalMatchers;
private final RestMatcher[] requiredMatchers;
private final RestConverter[] converters;
- private final Integer priority;
private final RestContext context;
private final Method method;
private final MethodInvoker methodInvoker;
@@ -806,8 +771,6 @@ public class RestOperationContext extends BeanContext implements Comparable<Rest
opParams = context.findRestOperationParams(mi.inner(), bf);
- this.priority = cp.getInteger(RESTOP_priority).orElse(0);
-
this.callLogger = context.getCallLogger();
} catch (ServletException e) {
throw e;
@@ -1957,10 +1920,6 @@ public class RestOperationContext extends BeanContext implements Comparable<Rest
public int compareTo(RestOperationContext o) {
int c;
- c = priority.compareTo(o.priority);
- if (c != 0)
- return c;
-
for (int i = 0; i < Math.min(pathMatchers.length, o.pathMatchers.length); i++) {
c = pathMatchers[i].compareTo(o.pathMatchers[i]);
if (c != 0)
@@ -2025,7 +1984,6 @@ public class RestOperationContext extends BeanContext implements Comparable<Rest
.a("defaultRequestHeaders", defaultRequestHeaders)
.a("defaultRequestQuery", defaultRequestQuery)
.a("httpMethod", httpMethod)
- .a("priority", priority)
);
}
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOperationContextBuilder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOperationContextBuilder.java
index 8ba5dad..d9f60ee 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOperationContextBuilder.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestOperationContextBuilder.java
@@ -542,24 +542,6 @@ public class RestOperationContextBuilder extends BeanContextBuilder {
return set(RESTOP_path, values);
}
- /**
- * Configuration property: Priority.
- *
- * <p>
- * URL path pattern priority.
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link RestOperationContext#RESTOP_priority}
- * </ul>
- *
- * @param value The new value for this setting.
- * @return This object (for method chaining).
- */
- @FluentSetter
- public RestOperationContextBuilder priority(int value) {
- return set(RESTOP_priority, value);
- }
-
// <FluentSetters>
@Override /* GENERATED - ContextBuilder */
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOp.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOp.java
index f868dd9..d4a9d3b 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOp.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOp.java
@@ -601,17 +601,6 @@ public @interface RestOp {
String[] path() default {};
/**
- * URL path pattern priority.
- *
- * <p>
- * To force path patterns to be checked before other path patterns, use a higher priority number.
- *
- * <p>
- * By default, it's <c>0</c>, which means it will use an internal heuristic to determine a best match.
- */
- int priority() default 0;
-
- /**
* Supported accept media types.
*
* <p>
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
index 1ba081b..67b8465 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestOpAnnotation.java
@@ -61,7 +61,6 @@ public class RestOpAnnotation {
Class<? extends RestMatcher>[] matchers = new Class[0];
Class<? extends RestOperationContext> contextClass = RestOperationContext.Null.class;
Class<?>[] encoders=new Class<?>[0], parsers=new Class<?>[0], serializers=new Class<?>[0];
- int priority = 0;
OpSwagger swagger = OpSwaggerAnnotation.DEFAULT;
String clientVersion="", debug="", defaultAccept="", defaultCharset="", defaultContentType="", maxInput="", method="", rolesDeclared="", roleGuard="", summary="", value="";
String[] consumes={}, defaultFormData={}, defaultQuery={}, defaultRequestAttributes={}, defaultRequestHeaders={}, defaultResponseHeaders={}, description={}, path={}, produces={};
@@ -314,17 +313,6 @@ public class RestOpAnnotation {
}
/**
- * Sets the {@link RestOp#priority()} property on this annotation.
- *
- * @param value The new value for this property.
- * @return This object (for method chaining).
- */
- public Builder priority(int value) {
- this.priority = value;
- return this;
- }
-
- /**
* Sets the {@link RestOp#produces()} property on this annotation.
*
* @param value The new value for this property.
@@ -425,7 +413,6 @@ public class RestOpAnnotation {
private final Class<? extends RestMatcher>[] matchers;
private final Class<? extends RestOperationContext> contextClass;
private final Class<?>[] encoders, parsers, serializers;
- private final int priority;
private final OpSwagger swagger;
private final String clientVersion, debug, defaultAccept, defaultCharset, defaultContentType, maxInput, method, rolesDeclared, roleGuard, summary, value;
private final String[] consumes, defaultFormData, defaultQuery, defaultRequestAttributes, defaultRequestHeaders, defaultResponseHeaders, description, path, produces;
@@ -453,7 +440,6 @@ public class RestOpAnnotation {
this.method = b.method;
this.parsers = copyOf(b.parsers);
this.path = copyOf(b.path);
- this.priority = b.priority;
this.produces = copyOf(b.produces);
this.roleGuard = b.roleGuard;
this.rolesDeclared = b.rolesDeclared;
@@ -570,11 +556,6 @@ public class RestOpAnnotation {
}
@Override /* RestOp */
- public int priority() {
- return priority;
- }
-
- @Override /* RestOp */
public String[] produces() {
return produces;
}
@@ -652,7 +633,6 @@ public class RestOpAnnotation {
cdStream(a.rolesDeclared()).forEach(x -> cpb.addTo(REST_rolesDeclared, x));
cpb.addToIfNotEmpty(REST_roleGuard, string(a.roleGuard()));
cpb.setIfNotEmpty(RESTOP_httpMethod, string(a.method()));
- cpb.setIf(a.priority() != 0, RESTOP_priority, a.priority());
cpb.setIfNotEmpty(RESTOP_debug, string(a.debug()));
String v = StringUtils.trim(string(a.value()));
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java
index ec21b0f..3b7d918 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java
@@ -56,7 +56,6 @@ public class RestOpAnnotation_Test {
.on("on")
.parsers(Parser.class)
.path("path")
- .priority(1)
.produces("produces")
.roleGuard("roleGuard")
.rolesDeclared("rolesDeclared")
@@ -89,7 +88,6 @@ public class RestOpAnnotation_Test {
.on("on")
.parsers(Parser.class)
.path("path")
- .priority(1)
.produces("produces")
.roleGuard("roleGuard")
.rolesDeclared("rolesDeclared")
@@ -125,7 +123,6 @@ public class RestOpAnnotation_Test {
+ "on:['on'],"
+ "parsers:['org.apache.juneau.parser.Parser'],"
+ "path:['path'],"
- + "priority:1,"
+ "produces:['produces'],"
+ "roleGuard:'roleGuard',"
+ "rolesDeclared:'rolesDeclared',"
@@ -203,7 +200,6 @@ public class RestOpAnnotation_Test {
on="on",
parsers=Parser.class,
path="path",
- priority=1,
produces="produces",
roleGuard="roleGuard",
rolesDeclared="rolesDeclared",
@@ -237,7 +233,6 @@ public class RestOpAnnotation_Test {
on="on",
parsers=Parser.class,
path="path",
- priority=1,
produces="produces",
roleGuard="roleGuard",
rolesDeclared="rolesDeclared",