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 2cef008 REST refactoring. 2cef008 is described below commit 2cef008ee03059d002f13151f4c448fb0819c2be Author: JamesBognar <james.bog...@salesforce.com> AuthorDate: Thu Jan 7 18:18:07 2021 -0500 REST refactoring. --- .../juneau/config/store/ConfigFileStore.java | 4 +- .../org/apache/juneau/FuzzyResourceResolver.java | 2 +- .../apache/juneau/internal/ReaderInputStream.java | 9 +-- .../org/apache/juneau/internal/StringUtils.java | 6 +- .../microservice/resources/DirectoryResource.java | 20 +++-- .../microservice/resources/LogsResource.java | 30 +++---- .../org/apache/juneau/rest/jaxrs/BaseProvider.java | 32 +------- .../apache/juneau/rest/jaxrs/JuneauProvider.java | 20 ----- .../apache/juneau/rest/annotation/Body_Test.java | 17 ++-- .../rest/annotation/RestAnnotation_Test.java | 10 --- .../rest/annotation/RestMethodAnnotation_Test.java | 10 --- .../juneau/rest/BasicRestResourceResolver.java | 2 +- .../java/org/apache/juneau/rest/RestContext.java | 75 ----------------- .../org/apache/juneau/rest/RestContextBuilder.java | 93 +--------------------- .../apache/juneau/rest/RestContextProperties.java | 36 --------- .../java/org/apache/juneau/rest/RestServlet.java | 11 --- .../apache/juneau/rest/annotation/Property.java | 49 ------------ .../org/apache/juneau/rest/annotation/Rest.java | 38 --------- .../juneau/rest/annotation/RestAnnotation.java | 48 +---------- .../apache/juneau/rest/annotation/RestMethod.java | 17 ---- .../rest/annotation/RestMethodAnnotation.java | 50 +----------- pom.xml | 10 +-- 22 files changed, 47 insertions(+), 542 deletions(-) diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigFileStore.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigFileStore.java index 2fb5bfe..3ff3148 100644 --- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigFileStore.java +++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/store/ConfigFileStore.java @@ -319,8 +319,8 @@ public class ConfigFileStore extends ConfigStore { ByteBuffer buf = ByteBuffer.allocate(1024); StringBuilder sb = new StringBuilder(); while (fc.read(buf) != -1) { - sb.append(charset.decode((ByteBuffer)(buf.flip()))); - buf.clear(); + sb.append(charset.decode((ByteBuffer)((Buffer)buf).flip())); + ((Buffer)buf).clear(); } currentContents = sb.toString(); } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/FuzzyResourceResolver.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/FuzzyResourceResolver.java index 8b12e97..cda1770 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/FuzzyResourceResolver.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/FuzzyResourceResolver.java @@ -24,7 +24,7 @@ public class FuzzyResourceResolver implements ResourceResolver { try { return castOrCreateFromOuter(parent, c, c, true, args); } catch (Exception e) { - throw new BeanRuntimeException(e, c, "Could not instantiate resource class ''{0}''"); + throw new BeanRuntimeException(e, c, "Could not instantiate resource class"); } } } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ReaderInputStream.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ReaderInputStream.java index 7009016..8d5c4af 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ReaderInputStream.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ReaderInputStream.java @@ -120,7 +120,6 @@ public class ReaderInputStream extends InputStream { ((Buffer)this.encoderIn).flip(); // Fixes Java 11 issue. this.encoderOut = ByteBuffer.allocate(128); ((Buffer)this.encoderOut).flip(); // Fixes Java 11 issue. - this.encoderOut.flip(); } /** @@ -180,7 +179,7 @@ public class ReaderInputStream extends InputStream { private void fillBuffer() throws IOException { if (!endOfInput && (lastCoderResult == null || lastCoderResult.isUnderflow())) { encoderIn.compact(); - final int position = encoderIn.position(); + final int position = ((Buffer)encoderIn).position(); // We don't use Reader#read(CharBuffer) here because it is more efficient // to write directly to the underlying char array (the default implementation // copies data to a temporary char array). @@ -188,13 +187,13 @@ public class ReaderInputStream extends InputStream { if (c == -1) { endOfInput = true; } else { - encoderIn.position(position+c); + ((Buffer)encoderIn).position(position+c); } - encoderIn.flip(); + ((Buffer)encoderIn).flip(); } encoderOut.compact(); lastCoderResult = encoder.encode(encoderIn, encoderOut, endOfInput); - encoderOut.flip(); + ((Buffer)encoderOut).flip(); } /** diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java index 8b42b3e..ffebd5d 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java @@ -1757,7 +1757,7 @@ public final class StringUtils { ByteBuffer buff = ByteBuffer.allocate(hex.length()/2); for (int i = 0; i < hex.length(); i+=2) buff.put((byte)Integer.parseInt(hex.substring(i, i+2), 16)); - buff.rewind(); + ((Buffer)buff).rewind(); // Fixes Java 11 issue. Charset cs = Charset.forName("UTF-8"); return cs.decode(buff).toString(); } @@ -1772,7 +1772,7 @@ public final class StringUtils { ByteBuffer buff = ByteBuffer.allocate((hex.length()+1)/3); for (int i = 0; i < hex.length(); i+=3) buff.put((byte)Integer.parseInt(hex.substring(i, i+2), 16)); - buff.rewind(); + ((Buffer)buff).rewind(); // Fixes Java 11 issue. Charset cs = Charset.forName("UTF-8"); return cs.decode(buff).toString(); } @@ -1835,7 +1835,7 @@ public final class StringUtils { ByteBuffer buff = ByteBuffer.allocate((hex.length()+1)/3); for (int i = 0; i < hex.length(); i+=3) buff.put((byte)Integer.parseInt(hex.substring(i, i+2), 16)); - buff.rewind(); + ((Buffer)buff).rewind(); // Fixes Java 11 issue. return buff.array(); } diff --git a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java index 1d495f7..d683080 100755 --- a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java +++ b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java @@ -14,12 +14,12 @@ package org.apache.juneau.microservice.resources; import static org.apache.juneau.http.HttpMethod.*; import static org.apache.juneau.internal.StringUtils.*; -import static org.apache.juneau.rest.annotation.HookEvent.*; import java.io.*; import java.util.*; import org.apache.juneau.annotation.*; +import org.apache.juneau.config.*; import org.apache.juneau.dto.*; import org.apache.juneau.html.annotation.*; import org.apache.juneau.http.annotation.Body; @@ -102,18 +102,16 @@ public class DirectoryResource extends BasicRestServlet { // Instance //------------------------------------------------------------------------------------------------------------------- - private File rootDir; // The root directory + private final File rootDir; // The root directory // Settings enabled through servlet init parameters - boolean allowDeletes, allowUploads, allowViews; - - @RestHook(INIT) - public void init(RestContextBuilder b) throws Exception { - RestContextProperties p = b.getProperties(); - rootDir = new File(p.getString(DIRECTORY_RESOURCE_rootDir)); - allowViews = p.getBoolean(DIRECTORY_RESOURCE_allowViews, false); - allowDeletes = p.getBoolean(DIRECTORY_RESOURCE_allowDeletes, false); - allowUploads = p.getBoolean(DIRECTORY_RESOURCE_allowUploads, false); + final boolean allowDeletes, allowUploads, allowViews; + + public DirectoryResource(Config c) throws Exception { + rootDir = new File(c.getString(DIRECTORY_RESOURCE_rootDir, ".")); + allowViews = c.getBoolean(DIRECTORY_RESOURCE_allowViews, false); + allowDeletes = c.getBoolean(DIRECTORY_RESOURCE_allowDeletes, false); + allowUploads = c.getBoolean(DIRECTORY_RESOURCE_allowUploads, false); } @RestMethod( diff --git a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java index b14c749..c9f777f 100755 --- a/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java +++ b/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java @@ -12,7 +12,6 @@ // *************************************************************************************************************************** package org.apache.juneau.microservice.resources; -import static org.apache.juneau.rest.annotation.HookEvent.*; import static org.apache.juneau.http.HttpMethod.*; import static org.apache.juneau.internal.StringUtils.*; @@ -21,6 +20,7 @@ import java.nio.charset.*; import java.util.*; import org.apache.juneau.annotation.*; +import org.apache.juneau.config.*; import org.apache.juneau.dto.*; import org.apache.juneau.html.annotation.*; import org.apache.juneau.http.annotation.Path; @@ -40,13 +40,6 @@ import org.apache.juneau.rest.helper.*; path="/logs", title="Log files", description="Log files from this service", - properties={ - @Property(name=LogsResource.LOGS_RESOURCE_logDir, value="$C{Logging/logDir}"), - @Property(name=LogsResource.LOGS_RESOURCE_allowDeletes, value="$C{Logging/allowDeletes,true}"), - @Property(name=LogsResource.LOGS_RESOURCE_logFormat, value="$C{Logging/format}"), - @Property(name=LogsResource.LOGS_RESOURCE_dateFormat, value="$C{Logging/dateFormat}"), - @Property(name=LogsResource.LOGS_RESOURCE_useStackTraceHashes, value="$C{Logging/useStackTraceHashes}") - }, allowedMethodParams="*" ) @HtmlConfig(uriAnchorText="PROPERTY_NAME") @@ -89,20 +82,17 @@ public class LogsResource extends BasicRestServlet { // Instance //------------------------------------------------------------------------------------------------------------------- - private File logDir; - private LogEntryFormatter leFormatter; - boolean allowDeletes; + private final File logDir; + private final LogEntryFormatter leFormatter; + final boolean allowDeletes; - - @RestHook(INIT) - public void init(RestContextBuilder b) throws Exception { - RestContextProperties p = b.getProperties(); - logDir = new File(p.getString(LOGS_RESOURCE_logDir)); - allowDeletes = p.getBoolean(LOGS_RESOURCE_allowDeletes); + public LogsResource(Config c) { + logDir = new File(c.getString(LOGS_RESOURCE_logDir, "logDir")); + allowDeletes = c.getBoolean(LOGS_RESOURCE_allowDeletes, true); leFormatter = new LogEntryFormatter( - p.getString(LOGS_RESOURCE_logFormat, "[{date} {level}] {msg}%n"), - p.getString(LOGS_RESOURCE_dateFormat, "yyyy.MM.dd hh:mm:ss"), - p.getBoolean(LOGS_RESOURCE_useStackTraceHashes, true) + c.getString(LOGS_RESOURCE_logFormat, "[{date} {level}] {msg}%n"), + c.getString(LOGS_RESOURCE_dateFormat, "yyyy.MM.dd hh:mm:ss"), + c.getBoolean(LOGS_RESOURCE_useStackTraceHashes, true) ); } diff --git a/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java b/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java index 413ae19..bb332c7 100644 --- a/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java +++ b/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java @@ -28,7 +28,6 @@ import javax.ws.rs.ext.*; import org.apache.juneau.collections.*; import org.apache.juneau.http.*; import org.apache.juneau.parser.*; -import org.apache.juneau.rest.annotation.*; import org.apache.juneau.serializer.*; /** @@ -49,14 +48,8 @@ public class BaseProvider implements MessageBodyReader<Object>, MessageBodyWrite */ protected BaseProvider() { try { - properties = new OMap(); JuneauProvider jp = getClass().getAnnotation(JuneauProvider.class); - for (Property p : jp.properties()) - properties.put(p.name(), p.value()); - for (String p : jp.flags()) - properties.put(p, true); - serializers = SerializerGroup.create() .append(jp.serializers()) .swaps((Object[])jp.swaps()) @@ -74,27 +67,6 @@ public class BaseProvider implements MessageBodyReader<Object>, MessageBodyWrite } } - /** - * Returns properties defined on the specified method through the {@link RestMethod#properties() @RestMethod(properties)} - * annotation specified on the method and the {@link JuneauProvider#properties()} annotation specified on the - * provider class. - * - * @param a All annotations defined on the method. - * @return A map of all properties define on the method. - */ - protected OMap getMethodProperties(Annotation[] a) { - OMap m = new OMap().inner(properties); - for (Annotation aa : a) { - if (aa instanceof RestMethod) { - for (Property p : ((RestMethod)aa).properties()) - m.put(p.name(), p.value()); - for (String p : ((RestMethod)aa).flags()) - m.put(p, true); - } - } - return m; - } - @Override /* MessageBodyWriter */ public long getSize(Object o, Class<?> type, Type gType, Annotation[] a, MediaType mediaType) { return -1; @@ -113,7 +85,7 @@ public class BaseProvider implements MessageBodyReader<Object>, MessageBodyWrite if (sm == null) throw new WebApplicationException(SC_NOT_ACCEPTABLE); Serializer s = sm.getSerializer(); - OMap mp = getMethodProperties(a); + OMap mp = OMap.of(); mp.append("mediaType", mediaType.toString()); Locale locale = getLocale(headers); TimeZone timeZone = getTimeZone(headers); @@ -149,7 +121,7 @@ public class BaseProvider implements MessageBodyReader<Object>, MessageBodyWrite if (pm == null) throw new WebApplicationException(SC_UNSUPPORTED_MEDIA_TYPE); Parser p = pm.getParser(); - OMap mp = getMethodProperties(a); + OMap mp = OMap.of(); mp.put("mediaType", mediaType.toString()); Locale locale = getLocale(headers); TimeZone timeZone = getTimeZone(headers); diff --git a/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/JuneauProvider.java b/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/JuneauProvider.java index c8e8cfc..8352f74 100644 --- a/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/JuneauProvider.java +++ b/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/JuneauProvider.java @@ -18,7 +18,6 @@ import static java.lang.annotation.RetentionPolicy.*; import java.lang.annotation.*; import org.apache.juneau.parser.*; -import org.apache.juneau.rest.annotation.*; import org.apache.juneau.serializer.*; import org.apache.juneau.transform.*; @@ -40,17 +39,6 @@ import org.apache.juneau.transform.*; public @interface JuneauProvider { /** - * Provider-level properties. - * - * <p> - * Property values will be converted to the appropriate type. - * - * <p> - * These properties can be augmented/overridden through the {@link RestMethod#properties() @RestMethod(properties)} annotation on the REST method. - */ - Property[] properties() default {}; - - /** * Provider-level POJO swaps. * * <p> @@ -63,14 +51,6 @@ public @interface JuneauProvider { Class<?>[] swaps() default {}; /** - * Shortcut for setting {@link #properties()} of boolean types. - * - * <p> - * Setting a flag is the equivalent to setting the same property to <js>"true"</js>. - */ - String[] flags() default {}; - - /** * Specifies a list of {@link Serializer} classes to add to the list of serializers available for this provider. * * <p> diff --git a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Body_Test.java b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Body_Test.java index 5c85f13..d8cdce2 100644 --- a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Body_Test.java +++ b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Body_Test.java @@ -32,6 +32,7 @@ import org.apache.juneau.rest.mock.*; import org.apache.juneau.testutils.pojos.*; import org.apache.juneau.uon.*; import org.apache.juneau.urlencoding.*; +import org.apache.juneau.urlencoding.annotation.*; import org.apache.juneau.urlencoding.annotation.UrlEncoding; import org.junit.*; @@ -811,12 +812,8 @@ public class Body_Test { @Rest(serializers=UrlEncodingSerializer.class,parsers=UrlEncodingParser.class) public static class H { - @RestMethod(method=POST,path="/", - properties={ - @Property(name=UrlEncodingSerializer.URLENC_expandedParams, value="true"), - @Property(name=UrlEncodingParser.URLENC_expandedParams, value="true") - } - ) + @RestMethod(method=POST,path="/") + @UrlEncodingConfig(expandedParams="true") public XBeans.XB a(@Body XBeans.XB content) throws Exception { return content; } @@ -855,12 +852,8 @@ public class Body_Test { @Bean(on="A,B,C",sort=true) @UrlEncoding(on="C",expandedParams=true) public static class H2 { - @RestMethod(method=POST,path="/", - properties={ - @Property(name=UrlEncodingSerializer.URLENC_expandedParams, value="true"), - @Property(name=UrlEncodingParser.URLENC_expandedParams, value="true") - } - ) + @RestMethod(method=POST,path="/") + @UrlEncodingConfig(expandedParams="true") public XBeans.XE a(@Body XBeans.XE content) throws Exception { return content; } diff --git a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java index 40bd31b..4eeb6cf 100644 --- a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java +++ b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java @@ -56,7 +56,6 @@ public class RestAnnotation_Test { .description("description") .encoders(Encoder.class) .fileFinder(FileFinder.class) - .flags("flags") .guards(RestGuard.class) .infoProvider(BasicRestInfoProvider.class) .maxInput("maxInput") @@ -69,7 +68,6 @@ public class RestAnnotation_Test { .partSerializer(HttpPartSerializer.class) .path("path") .produces("produces") - .properties() .renderResponseStackTraces("renderResponseStackTraces") .reqAttrs("reqAttrs") .reqHeaders("reqHeaders") @@ -109,7 +107,6 @@ public class RestAnnotation_Test { .description("description") .encoders(Encoder.class) .fileFinder(FileFinder.class) - .flags("flags") .guards(RestGuard.class) .infoProvider(BasicRestInfoProvider.class) .maxInput("maxInput") @@ -122,7 +119,6 @@ public class RestAnnotation_Test { .partSerializer(HttpPartSerializer.class) .path("path") .produces("produces") - .properties() .renderResponseStackTraces("renderResponseStackTraces") .reqAttrs("reqAttrs") .reqHeaders("reqHeaders") @@ -165,7 +161,6 @@ public class RestAnnotation_Test { + "disableAllowBodyParam:'disableAllowBodyParam'," + "encoders:['org.apache.juneau.encoders.Encoder']," + "fileFinder:'org.apache.juneau.cp.FileFinder'," - + "flags:['flags']," + "guards:['org.apache.juneau.rest.RestGuard']," + "infoProvider:'org.apache.juneau.rest.BasicRestInfoProvider'," + "maxInput:'maxInput'," @@ -178,7 +173,6 @@ public class RestAnnotation_Test { + "partSerializer:'org.apache.juneau.httppart.HttpPartSerializer'," + "path:'path'," + "produces:['produces']," - + "properties:[]," + "renderResponseStackTraces:'renderResponseStackTraces'," + "reqAttrs:['reqAttrs']," + "reqHeaders:['reqHeaders']," @@ -263,7 +257,6 @@ public class RestAnnotation_Test { description="description", encoders=Encoder.class, fileFinder=FileFinder.class, - flags="flags", guards=RestGuard.class, infoProvider=BasicRestInfoProvider.class, maxInput="maxInput", @@ -276,7 +269,6 @@ public class RestAnnotation_Test { partSerializer=HttpPartSerializer.class, path="path", produces="produces", - properties={}, renderResponseStackTraces="renderResponseStackTraces", reqAttrs="reqAttrs", reqHeaders="reqHeaders", @@ -318,7 +310,6 @@ public class RestAnnotation_Test { description="description", encoders=Encoder.class, fileFinder=FileFinder.class, - flags="flags", guards=RestGuard.class, infoProvider=BasicRestInfoProvider.class, maxInput="maxInput", @@ -331,7 +322,6 @@ public class RestAnnotation_Test { partSerializer=HttpPartSerializer.class, path="path", produces="produces", - properties={}, renderResponseStackTraces="renderResponseStackTraces", reqAttrs="reqAttrs", reqHeaders="reqHeaders", diff --git a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestMethodAnnotation_Test.java b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestMethodAnnotation_Test.java index 9571fb2..2955563 100644 --- a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestMethodAnnotation_Test.java +++ b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestMethodAnnotation_Test.java @@ -45,7 +45,6 @@ public class RestMethodAnnotation_Test { .defaultQuery("defaultQuery") .description("description") .encoders(Encoder.class) - .flags("flags") .guards(RestGuard.class) .matchers(RestMatcher.class) .maxInput("maxInput") @@ -56,7 +55,6 @@ public class RestMethodAnnotation_Test { .paths("paths") .priority(1) .produces("produces") - .properties() .reqAttrs("reqAttrs") .reqHeaders("reqHeaders") .roleGuard("roleGuard") @@ -79,7 +77,6 @@ public class RestMethodAnnotation_Test { .defaultQuery("defaultQuery") .description("description") .encoders(Encoder.class) - .flags("flags") .guards(RestGuard.class) .matchers(RestMatcher.class) .maxInput("maxInput") @@ -90,7 +87,6 @@ public class RestMethodAnnotation_Test { .paths("paths") .priority(1) .produces("produces") - .properties() .reqAttrs("reqAttrs") .reqHeaders("reqHeaders") .roleGuard("roleGuard") @@ -116,7 +112,6 @@ public class RestMethodAnnotation_Test { + "defaultQuery:['defaultQuery']," + "description:['description']," + "encoders:['org.apache.juneau.encoders.Encoder']," - + "flags:['flags']," + "guards:['org.apache.juneau.rest.RestGuard']," + "matchers:['org.apache.juneau.rest.RestMatcher']," + "maxInput:'maxInput'," @@ -127,7 +122,6 @@ public class RestMethodAnnotation_Test { + "paths:['paths']," + "priority:1," + "produces:['produces']," - + "properties:[]," + "reqAttrs:['reqAttrs']," + "reqHeaders:['reqHeaders']," + "roleGuard:'roleGuard'," @@ -193,7 +187,6 @@ public class RestMethodAnnotation_Test { defaultQuery="defaultQuery", description="description", encoders=Encoder.class, - flags="flags", guards=RestGuard.class, matchers=RestMatcher.class, maxInput="maxInput", @@ -204,7 +197,6 @@ public class RestMethodAnnotation_Test { paths="paths", priority=1, produces="produces", - properties={}, reqAttrs="reqAttrs", reqHeaders="reqHeaders", roleGuard="roleGuard", @@ -229,7 +221,6 @@ public class RestMethodAnnotation_Test { defaultQuery="defaultQuery", description="description", encoders=Encoder.class, - flags="flags", guards=RestGuard.class, matchers=RestMatcher.class, maxInput="maxInput", @@ -240,7 +231,6 @@ public class RestMethodAnnotation_Test { paths="paths", priority=1, produces="produces", - properties={}, reqAttrs="reqAttrs", reqHeaders="reqHeaders", roleGuard="roleGuard", diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestResourceResolver.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestResourceResolver.java index 2dd538e..cf0bd99 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestResourceResolver.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestResourceResolver.java @@ -40,6 +40,6 @@ public class BasicRestResourceResolver extends FuzzyResourceResolver implements @Override /* RestResourceResolver */ public <T> T resolve(Object parent, Class<T> c, RestContextBuilder builder, Object...args) { - return resolve(parent, c, ArrayUtils.append(args, builder)); + return resolve(parent, c, ArrayUtils.append(args, builder, builder.getConfig())); } } \ No newline at end of file diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java index 34b7dae..0602e47 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java @@ -2821,55 +2821,6 @@ public class RestContext extends BeanContext { public static final String REST_produces = PREFIX + ".produces.ls"; /** - * Configuration property: Properties. - * - * <h5 class='section'>Property:</h5> - * <ul class='spaced-list'> - * <li><b>ID:</b> {@link org.apache.juneau.rest.RestContext#REST_properties REST_properties} - * <li><b>Name:</b> <js>"RestContext.properties.sms"</js> - * <li><b>Data type:</b> <c>Map<String,String></c> - * <li><b>System property:</b> <c>RestContext.properties</c> - * <li><b>Environment variable:</b> <c>RESTCONTEXT_PROPERTIES</c> - * <li><b>Default:</b> empty map - * <li><b>Session property:</b> <jk>false</jk> - * <li><b>Annotations:</b> - * <ul> - * <li class='ja'>{@link org.apache.juneau.rest.annotation.Rest#properties()} - * <li class='ja'>{@link org.apache.juneau.rest.annotation.Rest#flags()} - * <li class='ja'>{@link org.apache.juneau.rest.annotation.RestMethod#properties()} - * <li class='ja'>{@link org.apache.juneau.rest.annotation.RestMethod#flags()} - * </ul> - * <li><b>Methods:</b> - * <ul> - * <li class='jm'>{@link org.apache.juneau.rest.RestContextBuilder#property(String,Object)} - * <li class='jm'>{@link org.apache.juneau.rest.RestContextBuilder#beanProperties(Map)} - * </ul> - * </ul> - * - * <h5 class='section'>Description:</h5> - * <p> - * Shortcut to add properties to the bean contexts of all serializers and parsers on all methods in the class. - * - * <p> - * Any of the properties defined on {@link RestContext} or any of the serializers and parsers can be specified. - * - * <p> - * Property values will be converted to the appropriate type. - * - * <ul class='notes'> - * <li> - * Supports {@doc RestSvlVariables} - * (e.g. <js>"$L{my.localized.variable}"</js>). - * </ul> - * - * <ul class='seealso'> - * <li class='jm'>{@link RestContextBuilder#set(String,Object)} - * <li class='jm'>{@link RestContextBuilder#set(java.util.Map)} - * </ul> - */ - public static final String REST_properties = PREFIX + ".properties.sms"; - - /** * Configuration property: Supported content media types. * * <h5 class='section'>Property:</h5> @@ -3295,7 +3246,6 @@ public class RestContext extends BeanContext { private final Set<String> allowedMethodParams, allowedHeaderParams, allowedMethodHeaders; - private final RestContextProperties properties; private final Map<Class<?>,RestMethodParam> paramResolvers; private final SerializerGroup serializers; private final ParserGroup parsers; @@ -3490,7 +3440,6 @@ public class RestContext extends BeanContext { callLogger = createCallLogger(); - properties = builder.properties; serializers = SerializerGroup .create() @@ -4132,29 +4081,6 @@ public class RestContext extends BeanContext { } /** - * Returns the class-level properties associated with this servlet. - * - * <p> - * Properties at the class level are defined via the following: - * <ul class='javatree'> - * <li class='ja'>{@link Rest#properties()} - * <li class='jm'>{@link RestContextBuilder#set(String, Object)} - * <li class='jm'>{@link RestContextBuilder#set(Map)} - * </ul> - * - * <ul class='notes'> - * <li> - * The returned {@code Map} is mutable. - * <br>Therefore, subclasses are free to override or set additional initialization parameters in their {@code init()} method. - * </ul> - * - * @return The resource properties as a {@link RestContextProperties}. - */ - public RestContextProperties getProperties() { - return properties; - } - - /** * Returns the servlet init parameter returned by {@link ServletConfig#getInitParameter(String)}. * * @param name The init parameter name. @@ -5243,7 +5169,6 @@ public class RestContext extends BeanContext { .a("partParser", partParser) .a("partSerializer", partSerializer) .a("produces", produces) - .a("properties", properties) .a("renderResponseStackTraces", renderResponseStackTraces) .a("reqHeaders", reqHeaders) .a("resHeaders", resHeaders) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java index 62c9662..836b580 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java @@ -57,7 +57,6 @@ import org.apache.juneau.utils.*; * Provides access to the following initialized resources: * <ul> * <li>{@link #getConfig()} - The external configuration for this resource. - * <li>{@link #getProperties()} - The modifiable configuration properties for this resource. * <li>{@link #getVarResolverBuilder()} - The variable resolver for this resource. * </ul> * @@ -105,7 +104,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon // Read-only snapshots of these will be made in RestServletContext. //----------------------------------------------------------------------------------------------------------------- - RestContextProperties properties; Config config; VarResolverBuilder varResolverBuilder; @@ -113,7 +111,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon this.inner = servletConfig; this.resourceClass = resourceClass; this.parentContext = parentContext; - this.properties = new RestContextProperties(); ClassInfo rci = ClassInfo.of(resourceClass); @@ -178,16 +175,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon applyAnnotations(rci.getAnnotationList(ConfigAnnotationFilter.INSTANCE), vr.createSession()); - // Load stuff from parent-to-child order. - // This allows child settings to overwrite parent settings. - for (AnnotationInfo<Rest> e : restAnnotationsParentFirst) { - Rest r = e.getAnnotation(); - for (Property p : r.properties()) - set(vr.resolve(p.name()), vr.resolve(p.value())); - for (String p : r.flags()) - set(p); - } - } catch (Exception e) { throw new ServletException(e); } @@ -317,7 +304,7 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon * @return A new property store. */ protected PropertyStoreBuilder createPropertyStore() { - return PropertyStore.create().add(properties); + return PropertyStore.create(); } @@ -348,28 +335,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon } /** - * Returns the configuration properties for this resource. - * - * <p> - * The configuration properties are determined via the {@link Rest#properties() @Rest(properties)} annotation on the resource. - * - * <p> - * The configuration properties can be augmented programmatically by adding the following method to your resource: - * <p class='bcode w800'> - * <jk>public</jk> RestContextProperties createProperties(ServletConfig servletConfig) <jk>throws</jk> ServletException; - * </p> - * - * <p> - * These properties can be modified during servlet initialization. - * However, any modifications made after {@link RestServlet#init(ServletConfig)} has been called will have no effect. - * - * @return The configuration properties for this resource. Never <jk>null</jk>. - */ - public RestContextProperties getProperties() { - return properties; - } - - /** * Creates the variable resolver for this resource. * * <p> @@ -1919,55 +1884,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon } /** - * <i><l>RestContext</l> configuration property: </i> Properties. - * - * <p> - * Shortcut to add properties to the bean contexts of all serializers and parsers on all methods in the class. - * - * <p> - * Any of the properties defined on {@link RestContext} or any of the serializers and parsers can be specified. - * - * <p> - * Property values will be converted to the appropriate type. - * - * <ul class='seealso'> - * <li class='jm'>{@link RestContext#REST_properties} - * </ul> - * - * @param values The values to set on this setting. - * @return This object (for method chaining). - */ - @FluentSetter - public RestContextBuilder restProperties(Map<String,Object> values) { - return putAllTo(REST_properties, values); - } - - /** - * <i><l>RestContext</l> configuration property: </i> Properties. - * - * <p> - * Shortcut to add properties to the bean contexts of all serializers and parsers on all methods in the class. - * - * <p> - * Any of the properties defined on {@link RestContext} or any of the serializers and parsers can be specified. - * - * <p> - * Property values will be converted to the appropriate type. - * - * <ul class='seealso'> - * <li class='jm'>{@link RestContext#REST_properties} - * </ul> - * - * @param name The key to add to the properties. - * @param value The value to add to the properties. - * @return This object (for method chaining). - */ - @FluentSetter - public RestContextBuilder property(String name, Object value) { - return putTo(REST_properties, name, value); - } - - /** * Configuration property: Static files finder. * * <p> @@ -2139,25 +2055,18 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon @Override /* ContextBuilder */ public RestContextBuilder set(String name, Object value) { super.set(name, value); - this.properties.put(name, value); - putTo(REST_properties, name, value); return this; } @Override /* ContextBuilder */ public RestContextBuilder set(String name) { super.set(name); - this.properties.put(name, true); - putTo(REST_properties, name, true); return this; } @Override /* ContextBuilder */ public RestContextBuilder set(Map<String,Object> properties) { super.set(properties); - this.properties.clear(); - this.properties.putAll(properties); - putAllTo(REST_properties, properties); return this; } diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextProperties.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextProperties.java deleted file mode 100644 index 5516a91..0000000 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextProperties.java +++ /dev/null @@ -1,36 +0,0 @@ -// *************************************************************************************************************************** -// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * -// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * -// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * -// * with the License. You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.rest; - -import java.util.*; - -import org.apache.juneau.collections.*; -import org.apache.juneau.rest.annotation.*; - -/** - * Encapsulates class-level properties. - * - * <p> - * These are properties specified on a REST resource class through the following: - * <ul class='javatree'> - * <li class='ja'>{@link Rest#properties()} - * <li class='jm'>{@link RestContextBuilder#set(String, Object)} - * <li class='jm'>{@link RestContextBuilder#set(Map)} - * </ul> - * - * <ul class='seealso'> - * <li class='link'>{@doc RestConfigurableProperties} - * </ul> - */ -@SuppressWarnings("serial") -public class RestContextProperties extends OMap {} diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServlet.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServlet.java index 1a721ec..4812bf7 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServlet.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestServlet.java @@ -169,17 +169,6 @@ public abstract class RestServlet extends HttpServlet implements RestInfoProvide return context; } - /** - * Convenience method for calling <c>getContext().getProperties();</c> - * - * @return The resource properties as an {@link RestContextProperties}. - * @see RestContext#getProperties() - */ - public RestContextProperties getProperties() { - return getContext().getProperties(); - } - - //----------------------------------------------------------------------------------------------------------------- // Convenience logger methods //----------------------------------------------------------------------------------------------------------------- diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Property.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Property.java deleted file mode 100644 index 6f56749..0000000 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Property.java +++ /dev/null @@ -1,49 +0,0 @@ -// *************************************************************************************************************************** -// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * -// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * -// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * -// * with the License. You may obtain a copy of the License at * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.rest.annotation; - -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -import java.lang.annotation.*; - -/** - * Property name/value pair used in the {@link Rest#properties() @Rest(properties)} annotation. - * - * <p> - * Any of the properties defined on any of the serializers or parsers can be defined. - * - * <p> - * Property values types that are not <c>Strings</c> will automatically be converted to the correct type - * (e.g. <c>Boolean</c>, etc...). - * - * <ul class='seealso'> - * <li class='link'>{@doc RestConfigurableProperties} - * </ul> - */ -@Documented -@Target(ANNOTATION_TYPE) -@Retention(RUNTIME) -@Inherited -public @interface Property { - - /** - * Property name. - */ - String name(); - - /** - * Property value. - */ - String value(); -} diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Rest.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Rest.java index a65a434..88b93ea 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Rest.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Rest.java @@ -562,19 +562,6 @@ public @interface Rest { Class<? extends FileFinder> fileFinder() default FileFinder.Null.class; /** - * Shortcut for setting {@link #properties()} of simple boolean types. - * - * <ul class='notes'> - * <li> - * Supports {@doc RestSvlVariables} - * (e.g. <js>"$L{my.localized.variable}"</js>). - * <li> - * Setting a flag is equivalent to setting the same property to <js>"true"</js>. - * </ul> - */ - String[] flags() default {}; - - /** * Class-level guards. * * <p> @@ -884,31 +871,6 @@ public @interface Rest { String[] produces() default {}; /** - * Class-level properties. - * - * <p> - * Shortcut to add properties to the bean contexts of all serializers and parsers on all methods in the class. - * - * <p> - * Any of the properties defined on {@link RestContext} or any of the serializers and parsers can be specified. - * - * <p> - * Property values will be converted to the appropriate type. - * - * <ul class='notes'> - * <li> - * Supports {@doc RestSvlVariables} - * (e.g. <js>"$L{my.localized.variable}"</js>). - * </ul> - * - * <ul class='seealso'> - * <li class='jm'>{@link RestContextBuilder#set(String,Object)} - * <li class='jm'>{@link RestContextBuilder#set(java.util.Map)} - * </ul> - */ - Property[] properties() default {}; - - /** * Render response stack traces in responses. * * <p> diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java index 541f433..994a708 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestAnnotation.java @@ -96,10 +96,9 @@ public class RestAnnotation { Class<? extends RestMethodParam>[] paramResolvers = new Class[0]; Class<? extends RestResourceResolver> resourceResolver=RestResourceResolver.Null.class; Class<?>[] children={}, parsers={}, serializers={}; - Property[] properties = {}; ResourceSwagger swagger = ResourceSwaggerAnnotation.DEFAULT; String disableAllowBodyParam="", allowedHeaderParams="", allowedMethodHeaders="", allowedMethodParams="", clientVersionHeader="", config="", debug="", debugOn="", defaultAccept="", defaultCharset="", defaultContentType="", maxInput="", messages="", path="", renderResponseStackTraces="", roleGuard="", rolesDeclared="", siteName="", uriAuthority="", uriContext="", uriRelativity="", uriResolution=""; - String[] consumes={}, description={}, flags={}, produces={}, reqAttrs={}, reqHeaders={}, resHeaders={}, title={}; + String[] consumes={}, description={}, produces={}, reqAttrs={}, reqHeaders={}, resHeaders={}, title={}; /** * Constructor. @@ -327,17 +326,6 @@ public class RestAnnotation { } /** - * Sets the {@link Rest#flags()} property on this annotation. - * - * @param value The new value for this property. - * @return This object (for method chaining). - */ - public Builder flags(String...value) { - this.flags = value; - return this; - } - - /** * Sets the {@link Rest#guards()} property on this annotation. * * @param value The new value for this property. @@ -448,17 +436,6 @@ public class RestAnnotation { } /** - * Sets the {@link Rest#properties()} property on this annotation. - * - * @param value The new value for this property. - * @return This object (for method chaining). - */ - public Builder properties(Property...value) { - this.properties = value; - return this; - } - - /** * Sets the {@link Rest#renderResponseStackTraces()} property on this annotation. * * @param value The new value for this property. @@ -684,10 +661,9 @@ public class RestAnnotation { private final Class<? extends RestMethodParam>[] paramResolvers; private final Class<? extends RestResourceResolver> resourceResolver; private final Class<?>[] children, parsers, serializers; - private final Property[] properties; private final ResourceSwagger swagger; private final String disableAllowBodyParam, allowedHeaderParams, allowedMethodHeaders, allowedMethodParams, clientVersionHeader, config, debug, debugOn, defaultAccept, defaultCharset, defaultContentType, maxInput, messages, path, renderResponseStackTraces, roleGuard, rolesDeclared, siteName, uriAuthority, uriContext, uriRelativity, uriResolution; - private final String[] consumes, description, flags, produces, reqAttrs, reqHeaders, resHeaders, title; + private final String[] consumes, description, produces, reqAttrs, reqHeaders, resHeaders, title; Impl(Builder b) { super(b); @@ -710,7 +686,6 @@ public class RestAnnotation { this.description = copyOf(b.description); this.encoders = copyOf(b.encoders); this.fileFinder = b.fileFinder; - this.flags = copyOf(b.flags); this.guards = copyOf(b.guards); this.infoProvider = b.infoProvider; this.maxInput = b.maxInput; @@ -721,7 +696,6 @@ public class RestAnnotation { this.partSerializer = b.partSerializer; this.path = b.path; this.produces = copyOf(b.produces); - this.properties = copyOf(b.properties); this.renderResponseStackTraces = b.renderResponseStackTraces; this.reqAttrs = copyOf(b.reqAttrs); this.reqHeaders = copyOf(b.reqHeaders); @@ -838,11 +812,6 @@ public class RestAnnotation { } @Override /* Rest */ - public String[] flags() { - return flags; - } - - @Override /* Rest */ public Class<? extends RestGuard>[] guards() { return guards; } @@ -893,11 +862,6 @@ public class RestAnnotation { } @Override /* Rest */ - public Property[] properties() { - return properties; - } - - @Override /* Rest */ public String renderResponseStackTraces() { return renderResponseStackTraces; } @@ -1004,14 +968,6 @@ public class RestAnnotation { String s = null; ClassInfo c = ai.getClassOn(); - for (Property p1 : a.properties()) { - psb.putTo(REST_properties, string(p1.name()), string(p1.value())); - } - - for (String p1 : a.flags()) { - psb.putTo(REST_properties, string(p1), true); - } - if (a.serializers().length > 0) psb.set(REST_serializers, merge(ConverterUtils.toType(psb.peek(REST_serializers), Object[].class), a.serializers())); diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java index c4fb7d8..b341273 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethod.java @@ -307,14 +307,6 @@ public @interface RestMethod { Class<?>[] encoders() default {}; /** - * Shortcut for setting {@link #properties()} of simple boolean types. - * - * <p> - * Setting a flag is equivalent to setting the same property to <js>"true"</js>. - */ - String[] flags() default {}; - - /** * Method-level guards. * * <p> @@ -576,15 +568,6 @@ public @interface RestMethod { String[] produces() default {}; /** - * Same as {@link Rest#properties() @Rest(properties)}, except defines property values by default when this method is called. - * - * <p> - * This is equivalent to simply calling <c>res.addProperties()</c> in the Java method, but is provided for - * convenience. - */ - Property[] properties() default {}; - - /** * Default request attributes. * * <p> diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethodAnnotation.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethodAnnotation.java index 662132e..493464e 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethodAnnotation.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestMethodAnnotation.java @@ -64,9 +64,8 @@ public class RestMethodAnnotation { Class<?>[] encoders=new Class<?>[0], parsers=new Class<?>[0], serializers=new Class<?>[0]; int priority = 0; MethodSwagger swagger = MethodSwaggerAnnotation.DEFAULT; - Property[] properties = new Property[0]; String clientVersion="", debug="", defaultAccept="", defaultCharset="", defaultContentType="", maxInput="", method="", path="", rolesDeclared="", roleGuard="", summary="", value=""; - String[] consumes={}, defaultFormData={}, defaultQuery={}, description={}, flags={}, paths={}, produces={}, reqAttrs={}, reqHeaders={}; + String[] consumes={}, defaultFormData={}, defaultQuery={}, description={}, paths={}, produces={}, reqAttrs={}, reqHeaders={}; /** * Constructor. @@ -206,17 +205,6 @@ public class RestMethodAnnotation { } /** - * Sets the {@link RestMethod#flags()} property on this annotation. - * - * @param value The new value for this property. - * @return This object (for method chaining). - */ - public Builder flags(String...value) { - this.flags = value; - return this; - } - - /** * Sets the {@link RestMethod#guards()} property on this annotation. * * @param value The new value for this property. @@ -316,17 +304,6 @@ public class RestMethodAnnotation { } /** - * Sets the {@link RestMethod#properties()} property on this annotation. - * - * @param value The new value for this property. - * @return This object (for method chaining). - */ - public Builder properties(Property...value) { - this.properties = value; - return this; - } - - /** * Sets the {@link RestMethod#reqAttrs()} property on this annotation. * * @param value The new value for this property. @@ -439,9 +416,8 @@ public class RestMethodAnnotation { private final Class<?>[] encoders, parsers, serializers; private final int priority; private final MethodSwagger swagger; - private final Property[] properties; private final String clientVersion, debug, defaultAccept, defaultCharset, defaultContentType, maxInput, method, path, rolesDeclared, roleGuard, summary, value; - private final String[] consumes, defaultFormData, defaultQuery, description, flags, paths, produces, reqAttrs, reqHeaders; + private final String[] consumes, defaultFormData, defaultQuery, description, paths, produces, reqAttrs, reqHeaders; Impl(Builder b) { super(b); @@ -456,7 +432,6 @@ public class RestMethodAnnotation { this.defaultQuery = copyOf(b.defaultQuery); this.description = copyOf(b.description); this.encoders = copyOf(b.encoders); - this.flags = copyOf(b.flags); this.guards = copyOf(b.guards); this.matchers = copyOf(b.matchers); this.maxInput = b.maxInput; @@ -466,7 +441,6 @@ public class RestMethodAnnotation { this.paths = copyOf(b.paths); this.priority = b.priority; this.produces = copyOf(b.produces); - this.properties = copyOf(b.properties); this.reqAttrs = copyOf(b.reqAttrs); this.reqHeaders = copyOf(b.reqHeaders); this.roleGuard = b.roleGuard; @@ -534,11 +508,6 @@ public class RestMethodAnnotation { } @Override /* RestMethod */ - public String[] flags() { - return flags; - } - - @Override /* RestMethod */ public Class<? extends RestGuard>[] guards() { return guards; } @@ -584,11 +553,6 @@ public class RestMethodAnnotation { } @Override /* RestMethod */ - public Property[] properties() { - return properties; - } - - @Override /* RestMethod */ public String[] reqAttrs() { return reqAttrs; } @@ -651,16 +615,6 @@ public class RestMethodAnnotation { String sig = mi == null ? "Unknown" : mi.getSignature(); String s = null; - for (Property p1 : a.properties()) { - psb.set(p1.name(), string(p1.value())); // >>> DEPRECATED - Remove in 9.0 <<< - psb.putTo(REST_properties, string(p1.name()), string(p1.value())); - } - - for (String p1 : a.flags()) { - psb.set(p1, true); // >>> DEPRECATED - Remove in 9.0 <<< - psb.putTo(REST_properties, string(p1), true); - } - if (a.serializers().length > 0) psb.set(REST_serializers, merge(ConverterUtils.toType(psb.peek(REST_serializers), Object[].class), a.serializers())); diff --git a/pom.xml b/pom.xml index a16219e..3813479 100644 --- a/pom.xml +++ b/pom.xml @@ -247,25 +247,25 @@ <taglets> <taglet> <tagletClass>org.apache.juneau.doc.internal.DocTag</tagletClass> - <tagletpath>${basedir}/juneau-doc/target/juneau-doc-${project.version}.jar</tagletpath> + <tagletpath>${basedir}/juneau-doc/juneau-doc.jar</tagletpath> </taglet> <taglet> <tagletClass>org.apache.juneau.doc.internal.PropertyTag</tagletClass> - <tagletpath>${basedir}/juneau-doc/target/juneau-doc-${project.version}.jar</tagletpath> + <tagletpath>${basedir}/juneau-doc/juneau-doc.jar</tagletpath> </taglet> <taglet> <tagletClass>org.apache.juneau.doc.internal.FragmentTag</tagletClass> - <tagletpath>${basedir}/juneau-doc/target/juneau-doc-${project.version}.jar</tagletpath> + <tagletpath>${basedir}/juneau-doc/juneau-doc.jar</tagletpath> </taglet> <taglet> <tagletClass>org.apache.juneau.doc.internal.SourceTag</tagletClass> - <tagletpath>${basedir}/juneau-doc/target/juneau-doc-${project.version}.jar</tagletpath> + <tagletpath>${basedir}/juneau-doc/juneau-doc.jar</tagletpath> </taglet> <!--org.apache.juneau.doc.internal.DocTag</taglet--> <!-- taglet>org.apache.juneau.doc.internal.PropertyTag</taglet--> </taglets> - <tagletpath>${basedir}/juneau-doc/target/juneau-doc-${project.version}.jar</tagletpath> + <tagletpath>${basedir}/juneau-doc/juneau-doc.jar</tagletpath> </configuration> <executions> <execution>