[juneau] branch master updated: PropertyStore refactoring.
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 a68d304 PropertyStore refactoring. a68d304 is described below commit a68d30421289bd88df217525d729486f8c9d66e8 Author: JamesBognar AuthorDate: Sun Feb 7 18:57:05 2021 -0500 PropertyStore refactoring. --- .../main/java/org/apache/juneau/BeanContext.java | 4 ++-- .../main/java/org/apache/juneau/PropertyStore.java | 27 ++ .../org/apache/juneau/rest/client/RestClient.java | 7 +++--- .../apache/juneau/rest/mock/MockRestClient.java| 3 ++- .../java/org/apache/juneau/rest/RestContext.java | 6 ++--- .../apache/juneau/rest/RestOperationContext.java | 4 ++-- 6 files changed, 20 insertions(+), 31 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java index 4d0d754..ba63e90 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java @@ -2084,7 +2084,7 @@ public class BeanContext extends Context implements MetaProvider { ps = ps.subset(new String[]{"Context","BeanContext"}); ReflectionMapBuilder rmb = ReflectionMap.create(Annotation.class); - for (Annotation a : ps.getList(BEAN_annotations, Annotation.class)) { + for (Annotation a : ps.getList(BEAN_annotations, Annotation.class).orElse(emptyList())) { try { ClassInfo ci = ClassInfo.of(a.getClass()); @@ -2149,7 +2149,7 @@ public class BeanContext extends Context implements MetaProvider { notBeanPackagePrefixes = l2.toArray(new String[l2.size()]); LinkedList> lpf = new LinkedList<>(); - for (Object o : ps.getList(BEAN_swaps, Object.class)) { + for (Object o : ps.getList(BEAN_swaps, Object.class).orElse(emptyList())) { if (o instanceof Class) { ClassInfo ci = ClassInfo.of((Class)o); if (ci.isChildOf(PojoSwap.class)) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index 5fa0d69..a694ea4 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -440,7 +440,7 @@ public final class PropertyStore { * * @param key The property name. * @param eType The class type of the elements in the property. -* @return The property value as an unmodifiable LinkedHashSet, or never null. +* @return The property value as an unmodifiable LinkedHashSet, never null. */ public Optional> getSet(String key, Class eType) { Property p = findProperty(key); @@ -452,24 +452,11 @@ public final class PropertyStore { * * @param key The property name. * @param eType The class type of the elements in the property. -* @return The property value as an unmodifiable ArrayList, or an empty list if it doesn't exist. +* @return The property value as an unmodifiable ArrayList, never null. */ - public List getList(String key, Class eType) { + public Optional> getList(String key, Class eType) { Property p = findProperty(key); - return p == null ? Collections.EMPTY_LIST : p.asList(eType); - } - - /** -* Returns the list property with the specified name. -* -* @param key The property name. -* @param eType The class type of the elements in the property. -* @param def The default value if the property doesn't exist or is empty. -* @return The property value as an unmodifiable ArrayList, or the default value if it doesn't exist or is empty. -*/ - public List getList(String key, Class eType, List def) { - List l = getList(key, eType); - return (l.isEmpty() ? def : l); + return Optional.ofNullable(p == null ? null : p.asList(eType)); } /** @@ -477,11 +464,11 @@ public final class PropertyStore { * * @param key The property name. * @param eType The class type of the elements in the property. -* @return The property value as an unmodifiable LinkedHashMap, or an empty map if it doesn't exist. +* @return The property value as an unmodifiable LinkedHashMap, never null. */ -
[juneau] branch master updated: PropertyStore refactoring.
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 9bfeda0 PropertyStore refactoring. 9bfeda0 is described below commit 9bfeda0a4088a79c94497e3580391137652b5b9a Author: JamesBognar AuthorDate: Sun Feb 7 18:44:37 2021 -0500 PropertyStore refactoring. --- .../main/java/org/apache/juneau/PropertyStore.java | 94 +- .../apache/juneau/rest/RestOperationContext.java | 4 +- 2 files changed, 5 insertions(+), 93 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index 999da7c..5fa0d69 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -440,49 +440,11 @@ public final class PropertyStore { * * @param key The property name. * @param eType The class type of the elements in the property. -* @return The property value as an unmodifiable LinkedHashSet, or an empty set if it doesn't exist. +* @return The property value as an unmodifiable LinkedHashSet, or never null. */ - public Set getSet(String key, Class eType) { + public Optional> getSet(String key, Class eType) { Property p = findProperty(key); - return p == null ? Collections.EMPTY_SET : p.asSet(eType); - } - - /** -* Returns the set property with the specified name. -* -* @param key The property name. -* @param eType The class type of the elements in the property. -* @param def The default value if the property doesn't exist or is empty. -* @return The property value as an unmodifiable LinkedHashSet, or the default value if it doesn't exist or is empty. -*/ - public Set getSet(String key, Class eType, Set def) { - Set l = getSet(key, eType); - return (l.isEmpty() ? def : l); - } - - /** -* Returns the class set property with the specified name. -* -* @param key The property name. -* @return The property value as an unmodifiable LinkedHashSet, or an empty set if it doesn't exist. -*/ - @SuppressWarnings("rawtypes") - public Set> getClassSet(String key) { - Property p = findProperty(key); - return p == null ? Collections.EMPTY_SET : (Set)p.asSet(Class.class); - } - - /** -* Returns the class set property with the specified name. -* -* @param key The property name. -* @param eType The class type of the elements in the property. -* @return The property value as an unmodifiable LinkedHashSet, or an empty set if it doesn't exist. -*/ - @SuppressWarnings("rawtypes") - public Set> getClassSet(String key, Class eType) { - Property p = findProperty(key); - return p == null ? Collections.EMPTY_SET : (Set)p.asSet(Class.class); + return Optional.ofNullable(p == null ? null : p.asSet(eType)); } /** @@ -511,31 +473,6 @@ public final class PropertyStore { } /** -* Returns the class list property with the specified name. -* -* @param key The property name. -* @return The property value as an unmodifiable ArrayList, or an empty list if it doesn't exist. -*/ - @SuppressWarnings("rawtypes") - public List> getClassList(String key) { - Property p = findProperty(key); - return p == null ? Collections.EMPTY_LIST : (List)p.asList(Class.class); - } - - /** -* Returns the class list property with the specified name. -* -* @param key The property name. -* @param eType The class type of the elements in the property. -* @return The property value as an unmodifiable ArrayList, or an empty list if it doesn't exist. -*/ - @SuppressWarnings("rawtypes") - public List> getClassList(String key, Class eType) { - Property p = findProperty(key); - return p == null ? Collections.EMPTY_LIST : (List)p.asList(Class.class); - } - - /** * Returns the map property with the specified name. * * @param key The property name. @@ -548,31 +485,6 @@ public final class PropertyStore { } /** -* Returns the class map property with the specified name. -* -* @param key The property name. -* @return The property value as an unmodifia
[juneau] branch master updated: PropertyStore refactoring.
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 1aea819 PropertyStore refactoring. 1aea819 is described below commit 1aea819a48cc7d553f103550a3821fd06e972ebe Author: JamesBognar AuthorDate: Sun Feb 7 17:39:01 2021 -0500 PropertyStore refactoring. --- .../main/java/org/apache/juneau/BeanContext.java | 4 +-- .../main/java/org/apache/juneau/PropertyStore.java | 30 +++--- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java index dbac558..4d0d754 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java @@ -2133,7 +2133,7 @@ public class BeanContext extends Context implements MetaProvider { beanMethodVisibility = ps.get(BEAN_beanMethodVisibility, Visibility.class).orElse(PUBLIC); beanFieldVisibility = ps.get(BEAN_beanFieldVisibility, Visibility.class).orElse(PUBLIC); - notBeanClasses = ps.getClassArray(BEAN_notBeanClasses, DEFAULT_NOTBEAN_CLASSES); + notBeanClasses = ps.getClassArray(BEAN_notBeanClasses).orElse(DEFAULT_NOTBEAN_CLASSES); propertyNamer = ps.getInstance(BEAN_propertyNamer, PropertyNamer.class, BasicPropertyNamer.class); @@ -2175,7 +2175,7 @@ public class BeanContext extends Context implements MetaProvider { cmObject = cmCache.get(Object.class); cmClass = cmCache.get(Class.class); - beanDictionaryClasses = AList.unmodifiable(ps.getClassArray(BEAN_beanDictionary, new Class[0])); + beanDictionaryClasses = AList.unmodifiable(ps.getClassArray(BEAN_beanDictionary).orElse(new Class[0])); beanRegistry = new BeanRegistry(this, null); } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index ac324cd..999da7c 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -428,35 +428,11 @@ public final class PropertyStore { * Returns the class array property with the specified name. * * @param key The property name. -* @return The property value, or an empty array if it doesn't exist. -*/ - public Class[] getClass(String key) { - Property p = findProperty(key); - return p == null ? new Class[0] : p.as(Class[].class); - } - - /** -* Returns the class array property with the specified name. -* -* @param key The property name. -* @param def The default value. -* @return The property value, or an empty array if it doesn't exist. -*/ - public Class[] getClassArray(String key, Class[] def) { - Property p = findProperty(key); - return p == null ? def : p.as(Class[].class); - } - - /** -* Returns the class array property with the specified name. -* -* @param key The property name. -* @param eType The class type of the elements in the property. -* @return The property value, or an empty array if it doesn't exist. +* @return The property value, never null. */ - public Class[] getClassArray(String key, Class eType) { + public Optional[]> getClassArray(String key) { Property p = findProperty(key); - return p == null ? new Class[0] : p.as(Class[].class); + return Optional.ofNullable(p == null ? null : p.as(Class[].class)); } /**
[juneau] branch master updated: PropertyStore refactoring.
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 ec00fd7 PropertyStore refactoring. ec00fd7 is described below commit ec00fd7b43087c38b5703a5789207915bfb85828 Author: JamesBognar AuthorDate: Sun Feb 7 17:05:30 2021 -0500 PropertyStore refactoring. --- .../juneau/config/store/ConfigFileStore.java | 2 +- .../main/java/org/apache/juneau/PropertyStore.java | 28 +- .../java/org/apache/juneau/rest/RestContext.java | 6 ++--- 3 files changed, 10 insertions(+), 26 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 b8c0673..85b852c 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 @@ -242,7 +242,7 @@ public class ConfigFileStore extends ConfigStore { dir.mkdirs(); charset = ps.get(FILESTORE_charset, Charset.class).orElse(Charset.defaultCharset()); updateOnWrite = ps.getBoolean(FILESTORE_enableUpdateOnWrite).orElse(false); - extensions = ps.getCdl(FILESTORE_extensions, "cfg"); + extensions = ps.getCdl(FILESTORE_extensions).orElse(new String[]{"cfg"}); WatcherSensitivity ws = ps.get(FILESTORE_watcherSensitivity, WatcherSensitivity.class).orElse(WatcherSensitivity.MEDIUM); watcher = ps.getBoolean(FILESTORE_enableWatcher).orElse(false) ? new WatcherThread(dir, ws) : null; if (watcher != null) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index 16fb8ff..d0e78fa 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -315,12 +315,6 @@ public final class PropertyStore { return Optional.empty(); } - @Deprecated - private T get(String key, Class c, T def) { - Property p = findProperty(key); - return p == null ? def : p.as(c); - } - private T find(String key, Class c) { Property p = findProperty(key); return p == null ? null : p.as(c); @@ -397,23 +391,13 @@ public final class PropertyStore { * Returns a property as a parsed comma-delimited list of strings. * * @param key The property name. -* @param def The default value. -* @return The property value, or the default value if it doesn't exist. -*/ - public final String[] getCdl(String key, String def) { - return StringUtils.split(StringUtils.emptyIfNull(get(key, String.class, def))); - } - - /** -* Same as {@link #getString(String)} but returns a blank instead of the default value if it resolves to "NONE". -* -* @param key The property name. -* @param def The default value. -* @return The property value, or the default value if it doesn't exist. +* @return The property value, never null. */ - public final String getNoneableString(String key, String def) { - String s = get(key, String.class, def); - return "NONE".equalsIgnoreCase(s) ? "" : s; + public final Optional getCdl(String key) { + String s = find(key, String.class); + if (s != null) + return Optional.of(StringUtils.split(s)); + return Optional.empty(); } /** 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 d0cfade..90d8d62 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 @@ -3534,9 +3534,9 @@ public class RestContext extends BeanContext { uriRelativity = ps.get(REST_uriRelativity, UriRelativity.class).orElse(UriRelativity.RESOURCE); allowBodyParam = ! ps.getBoolean(REST_disableAllowBodyParam).orElse(false); - allowedHeaderParams = newCaseInsensitiveSet(ps.getNoneableString(REST_allowedHeaderParams, "Accept,Conte
[juneau] branch master updated: PropertyStore refactoring.
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 86c8661 PropertyStore refactoring. 86c8661 is described below commit 86c866154da2969aef1f4640b44a772c66aa9063 Author: JamesBognar AuthorDate: Sun Feb 7 16:49:18 2021 -0500 PropertyStore refactoring. --- .../main/java/org/apache/juneau/config/Config.java | 2 +- .../apache/juneau/config/store/ConfigFileStore.java | 2 +- .../main/java/org/apache/juneau/jena/RdfParser.java | 2 +- .../java/org/apache/juneau/jena/RdfSerializer.java | 2 +- .../main/java/org/apache/juneau/BeanContext.java| 2 +- .../main/java/org/apache/juneau/PropertyStore.java | 21 + .../org/apache/juneau/html/HtmlDocSerializer.java | 2 +- .../java/org/apache/juneau/html/HtmlSerializer.java | 2 +- .../juneau/jsonschema/JsonSchemaGenerator.java | 4 ++-- .../apache/juneau/serializer/WriterSerializer.java | 2 +- .../org/apache/juneau/soap/SoapXmlSerializer.java | 2 +- .../java/org/apache/juneau/uon/UonSerializer.java | 2 +- .../org/apache/juneau/rest/client/RestClient.java | 2 +- .../org/apache/juneau/rest/mock/MockRestClient.java | 4 ++-- .../java/org/apache/juneau/rest/RestContext.java| 8 .../java/org/apache/juneau/ContextCacheTest.java| 2 +- 16 files changed, 25 insertions(+), 36 deletions(-) diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java index 52559a8..9ac813d 100644 --- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java +++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java @@ -446,7 +446,7 @@ public final class Config extends Context implements ConfigEventListener, Writab public Config(PropertyStore ps) throws IOException { super(ps, true); - name = ps.getString(CONFIG_name, "Configuration.cfg"); + name = ps.getString(CONFIG_name).orElse("Configuration.cfg"); store = ps.getInstance(CONFIG_store, ConfigStore.class, ConfigFileStore.DEFAULT); configMap = store.getMap(name); configMap.register(this); 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 3c090cc..b8c0673 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 @@ -238,7 +238,7 @@ public class ConfigFileStore extends ConfigStore { protected ConfigFileStore(PropertyStore ps) { super(ps); try { - dir = new File(ps.getString(FILESTORE_directory, ".")).getCanonicalFile(); + dir = new File(ps.getString(FILESTORE_directory).orElse(".")).getCanonicalFile(); dir.mkdirs(); charset = ps.get(FILESTORE_charset, Charset.class).orElse(Charset.defaultCharset()); updateOnWrite = ps.getBoolean(FILESTORE_enableUpdateOnWrite).orElse(false); diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java index d82023b..c745d22 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java @@ -130,7 +130,7 @@ public class RdfParser extends ReaderParser implements RdfCommon, RdfMetaProvide super(ps, consumes); trimWhitespace = ps.getBoolean(RDF_trimWhitespace).orElse(false); looseCollections = ps.getBoolean(RDF_looseCollections).orElse(false); - rdfLanguage = ps.getString(RDF_language, "RDF/XML-ABBREV"); + rdfLanguage = ps.getString(RDF_language).orElse("RDF/XML-ABBREV"); juneauNs = ps.getInstance(RDF_juneauNs, Namespace.class, DEFAULT_JUNEAU_NS); juneauBpNs = ps.getInstance(RDF_juneauBpNs, Namespace.class, DEFAULT_JUNEAUBP_NS); collectionFormat = ps.get(RDF_collectionFormat, RdfCollectionFormat.class).orElse(RdfCollectionFormat.DEFAULT); diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java index f6adbcf..7c9e561 100644 --- a/juneau-c
[juneau] branch master updated: PropertyStore refactoring.
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 65731f4 PropertyStore refactoring. 65731f4 is described below commit 65731f49524874cee0deed9686c5a6dfe25533b9 Author: JamesBognar AuthorDate: Sun Feb 7 16:39:53 2021 -0500 PropertyStore refactoring. --- .../main/java/org/apache/juneau/config/Config.java | 2 +- .../org/apache/juneau/BeanTraverseContext.java | 4 +-- .../main/java/org/apache/juneau/PropertyStore.java | 40 +- .../main/java/org/apache/juneau/parser/Parser.java | 2 +- .../apache/juneau/serializer/WriterSerializer.java | 2 +- .../apache/juneau/rest/RestOperationContext.java | 2 +- .../java/org/apache/juneau/ContextCacheTest.java | 2 +- 7 files changed, 16 insertions(+), 38 deletions(-) diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java index ce7480d..52559a8 100644 --- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java +++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java @@ -460,7 +460,7 @@ public final class Config extends Context implements ConfigEventListener, Writab .bean(Config.class, this) .build() .createSession(); - binaryLineLength = ps.getInteger(CONFIG_binaryLineLength); + binaryLineLength = ps.getInteger(CONFIG_binaryLineLength).orElse(-1); binaryFormat = ps.get(CONFIG_binaryFormat, BinaryFormat.class).orElse(BinaryFormat.BASE64); multiLineValuesOnSeparateLines = getBoolean(CONFIG_multiLineValuesOnSeparateLines, false); readOnly = getBoolean(CONFIG_readOnly, false); diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanTraverseContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanTraverseContext.java index f77131b..47343e8 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanTraverseContext.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanTraverseContext.java @@ -271,8 +271,8 @@ public abstract class BeanTraverseContext extends BeanContext { protected BeanTraverseContext(PropertyStore ps) { super(ps); - maxDepth = ps.getInteger(BEANTRAVERSE_maxDepth, 100); - initialDepth = ps.getInteger(BEANTRAVERSE_initialDepth, 0); + maxDepth = ps.getInteger(BEANTRAVERSE_maxDepth).orElse(100); + initialDepth = ps.getInteger(BEANTRAVERSE_initialDepth).orElse(0); ignoreRecursions = ps.getBoolean(BEANTRAVERSE_ignoreRecursions).orElse(false); detectRecursions = ps.getBoolean(BEANTRAVERSE_detectRecursions).orElse(ignoreRecursions); } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index 8c55492..161be63 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -339,7 +339,7 @@ public final class PropertyStore { } /** -* Shortcut for calling getProperty(key, Boolean.class, def). +* Shortcut for calling get(key, Boolean.class). * * @param key The property name. * @return The property value, never null. @@ -364,45 +364,23 @@ public final class PropertyStore { } /** -* Shortcut for calling getProperty(key, Integer.class, def). +* Shortcut for calling get(key, Integer.class). * * @param key The property name. -* @param def The default value. -* @return The property value, or the default value if it doesn't exist. -*/ - public final Integer getInteger(String key, Integer def) { - return get(key, Integer.class, def); - } - - /** -* Shortcut for calling getProperty(key, Integer.class, -1). -* -* @param key The property name. -* @return The property value, or -1 if it doesn't exist. -*/ - public final int getInteger(String key) { - return getInteger(key, -1); - } - - /** -* Shortcut for calling getProperty(key, Long.class, def). -* -* @param key The property name. -* @param def The default value. -* @return The property value, or the default value if it doesn't exist. +* @return The property value, never null. */ - public final Long getLong(String key, Long def
[juneau] branch master updated: PropertyStore refactoring.
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 7afba22 PropertyStore refactoring. 7afba22 is described below commit 7afba22ec7640b4e1051963a0b122df7586df9a1 Author: JamesBognar AuthorDate: Sun Feb 7 16:31:13 2021 -0500 PropertyStore refactoring. --- .../juneau/config/store/ConfigFileStore.java | 4 +-- .../java/org/apache/juneau/jena/RdfParser.java | 4 +-- .../java/org/apache/juneau/jena/RdfSerializer.java | 12 .../main/java/org/apache/juneau/BeanContext.java | 32 ++-- .../org/apache/juneau/BeanTraverseContext.java | 4 +-- .../src/main/java/org/apache/juneau/Context.java | 2 +- .../main/java/org/apache/juneau/PropertyStore.java | 35 +++--- .../org/apache/juneau/html/HtmlDocSerializer.java | 2 +- .../org/apache/juneau/html/HtmlSerializer.java | 8 ++--- .../java/org/apache/juneau/json/JsonParser.java| 2 +- .../org/apache/juneau/json/JsonSerializer.java | 6 ++-- .../juneau/jsonschema/JsonSchemaGenerator.java | 6 ++-- .../apache/juneau/msgpack/MsgPackSerializer.java | 2 +- .../main/java/org/apache/juneau/parser/Parser.java | 8 ++--- .../org/apache/juneau/serializer/Serializer.java | 16 +- .../apache/juneau/serializer/WriterSerializer.java | 2 +- .../main/java/org/apache/juneau/uon/UonParser.java | 4 +-- .../java/org/apache/juneau/uon/UonSerializer.java | 4 +-- .../juneau/urlencoding/UrlEncodingParser.java | 2 +- .../juneau/urlencoding/UrlEncodingSerializer.java | 2 +- .../main/java/org/apache/juneau/xml/XmlParser.java | 4 +-- .../java/org/apache/juneau/xml/XmlSerializer.java | 8 ++--- .../org/apache/juneau/rest/client/RestClient.java | 10 +++ .../java/org/apache/juneau/rest/RestContext.java | 4 +-- .../apache/juneau/rest/RestOperationContext.java | 2 +- .../java/org/apache/juneau/ContextCacheTest.java | 2 +- 26 files changed, 94 insertions(+), 93 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 b523655..3c090cc 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 @@ -241,10 +241,10 @@ public class ConfigFileStore extends ConfigStore { dir = new File(ps.getString(FILESTORE_directory, ".")).getCanonicalFile(); dir.mkdirs(); charset = ps.get(FILESTORE_charset, Charset.class).orElse(Charset.defaultCharset()); - updateOnWrite = ps.getBoolean(FILESTORE_enableUpdateOnWrite); + updateOnWrite = ps.getBoolean(FILESTORE_enableUpdateOnWrite).orElse(false); extensions = ps.getCdl(FILESTORE_extensions, "cfg"); WatcherSensitivity ws = ps.get(FILESTORE_watcherSensitivity, WatcherSensitivity.class).orElse(WatcherSensitivity.MEDIUM); - watcher = ps.getBoolean(FILESTORE_enableWatcher) ? new WatcherThread(dir, ws) : null; + watcher = ps.getBoolean(FILESTORE_enableWatcher).orElse(false) ? new WatcherThread(dir, ws) : null; if (watcher != null) watcher.start(); diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java index c2cebbd..d82023b 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java @@ -128,8 +128,8 @@ public class RdfParser extends ReaderParser implements RdfCommon, RdfMetaProvide */ public RdfParser(PropertyStore ps, String...consumes) { super(ps, consumes); - trimWhitespace = ps.getBoolean(RDF_trimWhitespace); - looseCollections = ps.getBoolean(RDF_looseCollections); + trimWhitespace = ps.getBoolean(RDF_trimWhitespace).orElse(false); + looseCollections = ps.getBoolean(RDF_looseCollections).orElse(false); rdfLanguage = ps.getString(RDF_language, "RDF/XML-ABBREV"); juneauNs = ps.getInstance(RDF_juneauNs, Namespace.class, DEFAULT_JUNEAU_NS); juneauBpNs = ps.getInstance(RDF_juneauBpNs, Namespace.class, DEFAULT_JUNEAUBP_NS); diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java b/juneau-cor
[juneau] branch master updated: PropertyStore refactoring.
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 b9130cf PropertyStore refactoring. b9130cf is described below commit b9130cf4f5523e3fd7bab579174a81b235b74d47 Author: JamesBognar AuthorDate: Sun Feb 7 16:12:22 2021 -0500 PropertyStore refactoring. --- .../src/main/java/org/apache/juneau/config/Config.java| 2 +- .../org/apache/juneau/config/store/ConfigFileStore.java | 4 ++-- .../src/main/java/org/apache/juneau/jena/RdfParser.java | 4 ++-- .../main/java/org/apache/juneau/jena/RdfSerializer.java | 10 +- .../src/main/java/org/apache/juneau/BeanContext.java | 8 .../src/main/java/org/apache/juneau/PropertyStore.java| 15 ++- .../java/org/apache/juneau/html/HtmlDocSerializer.java| 2 +- .../main/java/org/apache/juneau/html/HtmlSerializer.java | 2 +- .../org/apache/juneau/jsonschema/JsonSchemaGenerator.java | 2 +- .../main/java/org/apache/juneau/oapi/OpenApiParser.java | 4 ++-- .../java/org/apache/juneau/oapi/OpenApiSerializer.java| 4 ++-- .../java/org/apache/juneau/parser/InputStreamParser.java | 2 +- .../main/java/org/apache/juneau/parser/ReaderParser.java | 4 ++-- .../apache/juneau/serializer/OutputStreamSerializer.java | 2 +- .../java/org/apache/juneau/serializer/Serializer.java | 6 +++--- .../org/apache/juneau/serializer/WriterSerializer.java| 4 ++-- .../main/java/org/apache/juneau/uon/UonSerializer.java| 2 +- .../java/org/apache/juneau/rest/mock/MockRestClient.java | 6 +++--- .../src/main/java/org/apache/juneau/rest/RestContext.java | 4 ++-- .../java/org/apache/juneau/rest/RestOperationContext.java | 8 20 files changed, 54 insertions(+), 41 deletions(-) diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java index 1b8c6fb..ce7480d 100644 --- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java +++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java @@ -461,7 +461,7 @@ public final class Config extends Context implements ConfigEventListener, Writab .build() .createSession(); binaryLineLength = ps.getInteger(CONFIG_binaryLineLength); - binaryFormat = ps.get(CONFIG_binaryFormat, BinaryFormat.class, BinaryFormat.BASE64); + binaryFormat = ps.get(CONFIG_binaryFormat, BinaryFormat.class).orElse(BinaryFormat.BASE64); multiLineValuesOnSeparateLines = getBoolean(CONFIG_multiLineValuesOnSeparateLines, false); readOnly = getBoolean(CONFIG_readOnly, false); } 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 88e34a8..b523655 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 @@ -240,10 +240,10 @@ public class ConfigFileStore extends ConfigStore { try { dir = new File(ps.getString(FILESTORE_directory, ".")).getCanonicalFile(); dir.mkdirs(); - charset = ps.get(FILESTORE_charset, Charset.class, Charset.defaultCharset()); + charset = ps.get(FILESTORE_charset, Charset.class).orElse(Charset.defaultCharset()); updateOnWrite = ps.getBoolean(FILESTORE_enableUpdateOnWrite); extensions = ps.getCdl(FILESTORE_extensions, "cfg"); - WatcherSensitivity ws = ps.get(FILESTORE_watcherSensitivity, WatcherSensitivity.class, WatcherSensitivity.MEDIUM); + WatcherSensitivity ws = ps.get(FILESTORE_watcherSensitivity, WatcherSensitivity.class).orElse(WatcherSensitivity.MEDIUM); watcher = ps.getBoolean(FILESTORE_enableWatcher) ? new WatcherThread(dir, ws) : null; if (watcher != null) watcher.start(); diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java index a5298d8..c2cebbd 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java @@ -133,7 +133,7 @@ public class RdfParser extends ReaderParser implements RdfCommon, RdfMetaProvide
[juneau] branch master updated: PropertyStore refactoring.
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 75193b8 PropertyStore refactoring. 75193b8 is described below commit 75193b8449a4564a06ccb969fc851aafa1a937aa Author: JamesBognar AuthorDate: Sun Feb 7 16:00:32 2021 -0500 PropertyStore refactoring. --- .../java/org/apache/juneau/jena/RdfParser.java | 2 +- .../java/org/apache/juneau/jena/RdfSerializer.java | 2 +- .../main/java/org/apache/juneau/PropertyStore.java | 14 +- .../org/apache/juneau/rest/RestContextBuilder.java | 8 +- .../java/org/apache/juneau/PropertyStoreTest.java | 196 ++--- 5 files changed, 105 insertions(+), 117 deletions(-) diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java index bfdf64f..a5298d8 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java @@ -138,7 +138,7 @@ public class RdfParser extends ReaderParser implements RdfCommon, RdfMetaProvide ASortedMap m = ASortedMap.create(); for (String k : getPropertyKeys("RdfCommon")) if (k.startsWith("jena.")) - m.put(k.substring(5), ps.get2("RdfCommon." + k).orElse(null)); + m.put(k.substring(5), ps.get("RdfCommon." + k).orElse(null)); jenaProperties = m.unmodifiable(); } diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java index b8a0a27..3e29cb7 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java @@ -305,7 +305,7 @@ public class RdfSerializer extends WriterSerializer implements RdfCommon, RdfMet ASortedMap m = ASortedMap.create(); for (String k : getPropertyKeys("RdfCommon")) if (k.startsWith("jena.")) - m.put(k.substring(5), ps.get2("RdfCommon." + k).orElse(null)); + m.put(k.substring(5), ps.get("RdfCommon." + k).orElse(null)); jenaProperties = m.unmodifiable(); } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index e26213c..2d16724 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -276,19 +276,7 @@ public final class PropertyStore { * @param key The property name. * @return The property value, or null if it doesn't exist. */ - @Deprecated - public Object get(String key) { - Property p = findProperty(key); - return p == null ? null : p.value; - } - - /** -* Returns the raw property value with the specified name. -* -* @param key The property name. -* @return The property value, or null if it doesn't exist. -*/ - public Optional get2(String key) { + public Optional get(String key) { Property p = findProperty(key); return Optional.ofNullable(p == null ? null : p.value); } 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 2ed97b6..8a2f061 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 @@ -135,10 +135,10 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon if (parentContext.isPresent()) { RestContext pc = parentContext.get(); PropertyStore pcps = pc.getPropertyStore(); - set(REST_callLoggerDefault, pcps.get2(REST_callLoggerDefault).orElse(null)); - set(REST_debugDefault, pcps.get2(REST_debugDefault).orElse(null)); - set(REST_staticFilesDefault, pcps.get2(REST_staticFilesDefault).orEls
[juneau] branch master updated: PropertyStore refactoring.
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 b25d599 PropertyStore refactoring. b25d599 is described below commit b25d599782ab838cb2ab6a683becab74fe9e7ba8 Author: JamesBognar AuthorDate: Sun Feb 7 15:56:06 2021 -0500 PropertyStore refactoring. --- .../java/org/apache/juneau/jena/RdfParser.java | 2 +- .../java/org/apache/juneau/jena/RdfSerializer.java | 2 +- .../main/java/org/apache/juneau/PropertyStore.java | 12 ++ .../org/apache/juneau/rest/RestContextBuilder.java | 8 +- .../java/org/apache/juneau/PropertyStoreTest.java | 200 ++--- 5 files changed, 116 insertions(+), 108 deletions(-) diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java index a19a7f3..bfdf64f 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java @@ -138,7 +138,7 @@ public class RdfParser extends ReaderParser implements RdfCommon, RdfMetaProvide ASortedMap m = ASortedMap.create(); for (String k : getPropertyKeys("RdfCommon")) if (k.startsWith("jena.")) - m.put(k.substring(5), ps.get("RdfCommon." + k)); + m.put(k.substring(5), ps.get2("RdfCommon." + k).orElse(null)); jenaProperties = m.unmodifiable(); } diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java index dd2affa..b8a0a27 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java @@ -305,7 +305,7 @@ public class RdfSerializer extends WriterSerializer implements RdfCommon, RdfMet ASortedMap m = ASortedMap.create(); for (String k : getPropertyKeys("RdfCommon")) if (k.startsWith("jena.")) - m.put(k.substring(5), ps.get("RdfCommon." + k)); + m.put(k.substring(5), ps.get2("RdfCommon." + k).orElse(null)); jenaProperties = m.unmodifiable(); } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index 7987a28..e26213c 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -276,12 +276,24 @@ public final class PropertyStore { * @param key The property name. * @return The property value, or null if it doesn't exist. */ + @Deprecated public Object get(String key) { Property p = findProperty(key); return p == null ? null : p.value; } /** +* Returns the raw property value with the specified name. +* +* @param key The property name. +* @return The property value, or null if it doesn't exist. +*/ + public Optional get2(String key) { + Property p = findProperty(key); + return Optional.ofNullable(p == null ? null : p.value); + } + + /** * Returns the raw property value with the specified name if the property value type is the one specified. * * @param key The property name. 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 800d53a..2ed97b6 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 @@ -135,10 +135,10 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon if (parentContext.isPresent()) { RestContext pc = parentContext.get(); PropertyStore pcps = pc.getPropertyStore(); - set(REST_callLoggerDefault, pcps.get(REST_callLoggerDefault)); - set(REST_debugDefault, pcps.get(REST_debugDefault)); -
[juneau] branch master updated: PropertyStore refactoring.
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 af8618e PropertyStore refactoring. af8618e is described below commit af8618e5598f1fce9f2d068f68525690aa2c125f Author: JamesBognar AuthorDate: Sun Feb 7 15:41:24 2021 -0500 PropertyStore refactoring. --- .../main/java/org/apache/juneau/PropertyStore.java | 34 ++ .../java/org/apache/juneau/rest/RestContext.java | 115 + 2 files changed, 62 insertions(+), 87 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index b996166..7987a28 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -282,6 +282,40 @@ public final class PropertyStore { } /** +* Returns the raw property value with the specified name if the property value type is the one specified. +* +* @param key The property name. +* @param c The expected property type. +* @return The property value, never nullj. +*/ + public Optional getIfType(String key, Class c) { + Property p = findProperty(key); + if (p != null) { + Object o = p.value; + if (c.isInstance(o)) + Optional.of((T)o); + } + return Optional.empty(); + } + + /** +* Returns the raw property value with the specified name if the property value is a class. +* +* @param key The property name. +* @param c The expected property type. +* @return The property value, never nullj. +*/ + public Optional> getIfClass(String key, Class c) { + Property p = findProperty(key); + if (p != null) { + Object o = p.value; + if (Class.class.isInstance(o)) + return Optional.of((Class)o); + } + return Optional.empty(); + } + + /** * Returns the property value with the specified name. * * @param key The property name. 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 53e5d22..92a8e86 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 @@ -3662,9 +3662,8 @@ public class RestContext extends BeanContext { if (resource instanceof BeanFactory) x = (BeanFactory)resource; - Object o = properties.get(REST_beanFactory); - if (o instanceof BeanFactory) - x = (BeanFactory)o; + if (x == null) + x = properties.getIfType(REST_beanFactory, BeanFactory.class).orElse(null); if (x == null) x = createBeanFactoryBuilder(resource, properties, parent).build(); @@ -3694,14 +3693,9 @@ public class RestContext extends BeanContext { * @return The bean factory builder for this REST resource. * @throws Exception If bean factory could not be instantiated. */ - @SuppressWarnings("unchecked") protected BeanFactoryBuilder createBeanFactoryBuilder(Object resource, PropertyStore properties, RestContext parent) throws Exception { - Class c = null; - - Object o = properties.get(REST_beanFactory); - if (o instanceof Class) - c = (Class)o; + Class c = properties.getIfClass(REST_beanFactory, BeanFactory.class).orElse(null); BeanFactory root = parent == null ? null : parent.rootBeanFactory; @@ -3792,18 +3786,14 @@ public class RestContext extends BeanContext { if (resource instanceof FileFinder) x = (FileFinder)resource; - Object o = properties.get(REST_fileFinder); - if (o instanceof FileFinder) - x = (FileFinder)o; + if (x == null) + x = properties.getIfType(REST_fileFinder, FileFinder.class).orElse(null); if (x == null) x = beanFactory.getBean(FileFinder.class).orElse(null); - if (x == null) { - o = properties.get(REST_fileFinderDefault); - if
[juneau] branch master updated: PropertyStore refactoring.
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 e81af7e PropertyStore refactoring. e81af7e is described below commit e81af7e1119bf71971f7daca17c6376f5fb8c239 Author: JamesBognar AuthorDate: Sun Feb 7 14:01:48 2021 -0500 PropertyStore refactoring. --- .../main/java/org/apache/juneau/config/Config.java | 16 +- .../juneau/config/store/ConfigFileStore.java | 12 +- .../java/org/apache/juneau/jena/RdfParser.java | 14 +- .../java/org/apache/juneau/jena/RdfSerializer.java | 24 +- .../main/java/org/apache/juneau/BeanContext.java | 60 +-- .../org/apache/juneau/BeanTraverseContext.java | 10 +- .../src/main/java/org/apache/juneau/Context.java | 424 + .../main/java/org/apache/juneau/PropertyStore.java | 15 + .../org/apache/juneau/html/HtmlDocSerializer.java | 30 +- .../org/apache/juneau/html/HtmlSerializer.java | 12 +- .../java/org/apache/juneau/json/JsonParser.java| 2 +- .../org/apache/juneau/json/JsonSerializer.java | 6 +- .../juneau/jsonschema/JsonSchemaGenerator.java | 12 +- .../apache/juneau/msgpack/MsgPackSerializer.java | 2 +- .../java/org/apache/juneau/oapi/OpenApiParser.java | 4 +- .../org/apache/juneau/oapi/OpenApiSerializer.java | 4 +- .../apache/juneau/parser/InputStreamParser.java| 2 +- .../main/java/org/apache/juneau/parser/Parser.java | 12 +- .../org/apache/juneau/parser/ReaderParser.java | 4 +- .../juneau/serializer/OutputStreamSerializer.java | 2 +- .../org/apache/juneau/serializer/Serializer.java | 24 +- .../apache/juneau/serializer/WriterSerializer.java | 10 +- .../org/apache/juneau/soap/SoapXmlSerializer.java | 2 +- .../main/java/org/apache/juneau/uon/UonParser.java | 4 +- .../java/org/apache/juneau/uon/UonSerializer.java | 8 +- .../juneau/urlencoding/UrlEncodingParser.java | 2 +- .../juneau/urlencoding/UrlEncodingSerializer.java | 2 +- .../main/java/org/apache/juneau/xml/XmlParser.java | 10 +- .../java/org/apache/juneau/xml/XmlSerializer.java | 12 +- .../org/apache/juneau/rest/client/RestClient.java | 48 +-- .../apache/juneau/rest/mock/MockRestClient.java| 9 +- .../java/org/apache/juneau/rest/RestContext.java | 2 +- .../org/apache/juneau/rest/RestContextBuilder.java | 9 +- .../apache/juneau/rest/RestOperationContext.java | 135 --- .../java/org/apache/juneau/ContextCacheTest.java | 6 +- 35 files changed, 282 insertions(+), 668 deletions(-) diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java index 6139656..1b8c6fb 100644 --- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java +++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java @@ -446,22 +446,22 @@ public final class Config extends Context implements ConfigEventListener, Writab public Config(PropertyStore ps) throws IOException { super(ps, true); - name = getStringProperty(CONFIG_name, "Configuration.cfg"); - store = getInstanceProperty(CONFIG_store, ConfigStore.class, ConfigFileStore.DEFAULT); + name = ps.getString(CONFIG_name, "Configuration.cfg"); + store = ps.getInstance(CONFIG_store, ConfigStore.class, ConfigFileStore.DEFAULT); configMap = store.getMap(name); configMap.register(this); - serializer = getInstanceProperty(CONFIG_serializer, WriterSerializer.class, SimpleJsonSerializer.DEFAULT); - parser = getInstanceProperty(CONFIG_parser, ReaderParser.class, JsonParser.DEFAULT); + serializer = ps.getInstance(CONFIG_serializer, WriterSerializer.class, SimpleJsonSerializer.DEFAULT); + parser = ps.getInstance(CONFIG_parser, ReaderParser.class, JsonParser.DEFAULT); beanSession = parser.createBeanSession(); - encoder = getInstanceProperty(CONFIG_encoder, ConfigEncoder.class, ConfigXorEncoder.INSTANCE); - varSession = getInstanceProperty(CONFIG_varResolver, VarResolver.class, VarResolver.DEFAULT) + encoder = ps.getInstance(CONFIG_encoder, ConfigEncoder.class, ConfigXorEncoder.INSTANCE); + varSession = ps.getInstance(CONFIG_varResolver, VarResolver.class, VarResolver.DEFAULT) .builder() .vars(ConfigVar.class) .bean(Config.class, this) .build() .createSession(); - binaryLineLength = getIntegerProperty(CONFIG_binaryLineLength); - binaryFormat = getProperty(CONFIG_binaryFormat,
[juneau] branch master updated: PropertyStore refactoring.
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 21cd3b7 PropertyStore refactoring. 21cd3b7 is described below commit 21cd3b70eccbd13ff2c3c4a0935b7ec0e3909db2 Author: JamesBognar AuthorDate: Sun Feb 7 13:01:46 2021 -0500 PropertyStore refactoring. --- .../java/org/apache/juneau/jena/RdfParser.java | 2 +- .../java/org/apache/juneau/jena/RdfSerializer.java | 2 +- .../main/java/org/apache/juneau/BeanContext.java | 2 +- .../src/main/java/org/apache/juneau/Context.java | 72 +++ .../main/java/org/apache/juneau/PropertyStore.java | 106 +-- .../juneau/jsonschema/JsonSchemaGenerator.java | 2 +- .../apache/juneau/rest/mock/MockRestClient.java| 8 +- .../java/org/apache/juneau/rest/RestContext.java | 92 - .../org/apache/juneau/rest/RestContextBuilder.java | 2 +- .../juneau/rest/RestOperationContextBuilder.java | 2 +- .../java/org/apache/juneau/PropertyStoreTest.java | 210 ++--- 11 files changed, 250 insertions(+), 250 deletions(-) diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java index 02a6c05..6e02d64 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfParser.java @@ -152,7 +152,7 @@ public class RdfParser extends ReaderParser implements RdfCommon, RdfMetaProvide } private static String getConsumes(PropertyStore ps) { - String rdfLanguage = ps.getProperty(RDF_language, String.class, "RDF/XML-ABBREV"); + String rdfLanguage = ps.get(RDF_language, String.class, "RDF/XML-ABBREV"); switch(rdfLanguage) { case "RDF/XML": case "RDF/XML-ABBREV": return "text/xml+rdf"; diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java index 2c795e8..4b6265d 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java @@ -320,7 +320,7 @@ public class RdfSerializer extends WriterSerializer implements RdfCommon, RdfMet } private static String getProduces(PropertyStore ps) { - String rdfLanguage = ps.getProperty(RDF_language, String.class, "RDF/XML-ABBREV"); + String rdfLanguage = ps.get(RDF_language, String.class, "RDF/XML-ABBREV"); switch(rdfLanguage) { case "RDF/XML": return "text/xml+rdf+abbrev"; case "RDF/XML-ABBREV": return "text/xml+rdf"; diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java index 1888ef7..7bfcc3d 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java @@ -2084,7 +2084,7 @@ public class BeanContext extends Context implements MetaProvider { ps = ps.subset(new String[]{"Context","BeanContext"}); ReflectionMapBuilder rmb = ReflectionMap.create(Annotation.class); - for (Annotation a : ps.getListProperty(BEAN_annotations, Annotation.class)) { + for (Annotation a : ps.getList(BEAN_annotations, Annotation.class)) { try { ClassInfo ci = ClassInfo.of(a.getClass()); diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java index f1208bb..2cfec6c 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java @@ -355,7 +355,7 @@ public abstract class Context { * @return The property value, or null if it doesn't exist. */ public Object getProperty(String key) { - return propertyStore.getProperty(key); + return propertyStore.get(key); } /** @@ -367,7 +367,7 @@ public abstract class Context { * @return The property value, or the default value if it doesn't exist. */ public final T getProperty(String key, Cla
[juneau] branch master updated: REST refactoring.
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 99a595c REST refactoring. 99a595c is described below commit 99a595cb9ee1024527ee8376a94cf875994ccbd8 Author: JamesBognar AuthorDate: Sun Feb 7 12:48:58 2021 -0500 REST refactoring. --- .../org/apache/juneau/rest/RestOperationContextBuilder.java | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 933f1e2..407d27b 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 @@ -49,7 +49,7 @@ public class RestOperationContextBuilder extends BeanContextBuilder { Class ic = implClass; if (ic == null) - ic = ps.getClassProperty(RESTOP_contextClass, RestOperationContext.class, RestOperationContext.class); + ic = ps.getClassProperty(RESTOP_contextClass, RestOperationContext.class, getDefaultImplClass()); return BeanFactory.of(beanFactory).addBean(RestOperationContextBuilder.class, this).createBean(ic); } catch (Exception e) { @@ -57,6 +57,15 @@ public class RestOperationContextBuilder extends BeanContextBuilder { } } + /** +* Specifies the default implementation class if not specified via {@link #implClass(Class)}. +* +* @return The default implementation class if not specified via {@link #implClass(Class)}. +*/ + protected Class getDefaultImplClass() { + return RestOperationContext.class; + } + RestOperationContextBuilder(java.lang.reflect.Method method, RestContext context) { this.restContext = context;
[juneau] branch master updated: REST refactoring.
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 f9d1786 REST refactoring. f9d1786 is described below commit f9d1786a21e5fe9e5c8a8aa97cd370ff82238b62 Author: JamesBognar AuthorDate: Sun Feb 7 12:48:10 2021 -0500 REST refactoring. --- .../src/main/java/org/apache/juneau/Context.java | 25 +- .../main/java/org/apache/juneau/PropertyStore.java | 129 +++ .../apache/juneau/rest/RestChildrenBuilder.java|1 - .../java/org/apache/juneau/rest/RestContext.java | 1147 ++-- 4 files changed, 953 insertions(+), 349 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java index 500a25f..f1208bb 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java @@ -378,7 +378,7 @@ public abstract class Context { * @return The property value, or the default value if it doesn't exist. */ public final Boolean getBooleanProperty(String key, Boolean def) { - return getProperty(key, Boolean.class, def); + return propertyStore.getBooleanProperty(key, def); } /** @@ -388,7 +388,7 @@ public abstract class Context { * @return The property value, or false if it doesn't exist. */ public final boolean getBooleanProperty(String key) { - return getBooleanProperty(key, false); + return propertyStore.getBooleanProperty(key); } /** @@ -399,7 +399,7 @@ public abstract class Context { * @return The property value, or the default value if it doesn't exist. */ public final Integer getIntegerProperty(String key, Integer def) { - return getProperty(key, Integer.class, def); + return propertyStore.getIntegerProperty(key, def); } /** @@ -409,7 +409,7 @@ public abstract class Context { * @return The property value, or -1 if it doesn't exist. */ public final int getIntegerProperty(String key) { - return getIntegerProperty(key, -1); + return propertyStore.getIntegerProperty(key); } /** @@ -420,7 +420,7 @@ public abstract class Context { * @return The property value, or the default value if it doesn't exist. */ public final Long getLongProperty(String key, Long def) { - return getProperty(key, Long.class, def); + return propertyStore.getLongProperty(key, def); } /** @@ -430,7 +430,7 @@ public abstract class Context { * @return The property value, or -1 if it doesn't exist. */ public final long getLongProperty(String key) { - return getLongProperty(key, -1l); + return propertyStore.getLongProperty(key); } /** @@ -441,7 +441,7 @@ public abstract class Context { * @return The property value, or the default value if it doesn't exist. */ public final String getStringProperty(String key, String def) { - return getProperty(key, String.class, def); + return propertyStore.getStringProperty(key, def); } /** @@ -451,7 +451,7 @@ public abstract class Context { * @return The property value, or the null if it doesn't exist. */ public final String getStringProperty(String key) { - return getStringProperty(key, null); + return propertyStore.getStringProperty(key); } /** @@ -462,7 +462,7 @@ public abstract class Context { * @return The property value, or the default value if it doesn't exist. */ public final String[] getCdlProperty(String key, String def) { - return StringUtils.split(StringUtils.emptyIfNull(getProperty(key, String.class, def))); + return propertyStore.getCdlProperty(key, def); } /** @@ -473,8 +473,7 @@ public abstract class Context { * @return The property value, or the default value if it doesn't exist. */ public final String getStringPropertyWithNone(String key, String def) { - String s = getProperty(key, String.class, def); - return "NONE".equalsIgnoreCase(s) ? "" : s; + return propertyStore.getStringPropertyWithNone(key, def); } /** @@ -497,7 +496,7 @@ public abstract class Context { * @return The property value, or null if it doesn't exist. */ public final Class getClassProperty(String key, Class type) { -
[juneau] branch master updated: REST refactoring.
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 c130ce0 REST refactoring. c130ce0 is described below commit c130ce0e0d855b911c3600df7ab3930643fbb584 Author: JamesBognar AuthorDate: Sun Feb 7 10:39:19 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/cp/BeanFactory.java | 38 --- .../org/apache/juneau/cp/BeanFactoryBuilder.java | 79 +- .../org/apache/juneau/svl/VarResolverSession.java | 2 +- .../juneau/rest/springboot/SpringBeanFactory.java | 2 +- .../java/org/apache/juneau/rest/MethodList.java| 36 +- .../org/apache/juneau/cp/BeanFactory_Test.java | 2 +- .../apache/juneau/mstat/MethodExecStore_Test.java | 6 +- .../org/apache/juneau/mstat/ThrownStore_Test.java | 4 +- 8 files changed, 133 insertions(+), 36 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java index dfd3dfe..5499d7b 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java @@ -43,59 +43,49 @@ public class BeanFactory { /** * Static creator. * -* @return A new {@link BeanFactory} object. +* @return A new {@link BeanFactoryBuilder} object. */ - public static BeanFactory create() { - return new BeanFactory(); + public static BeanFactoryBuilder create() { + return new BeanFactoryBuilder(); } /** * Static creator. * * @param parent Parent bean factory. Can be null if this is the root resource. -* @param outer Outer bean context to use when instantiating local classes. Can be null. * @return A new {@link BeanFactory} object. */ - public static BeanFactory of(BeanFactory parent, Object outer) { - return new BeanFactory(parent, outer); + public static BeanFactory of(BeanFactory parent) { + return create().parent(parent).build(); } /** * Static creator. * * @param parent Parent bean factory. Can be null if this is the root resource. +* @param outer The outer bean used when instantiating inner classes. Can be null. * @return A new {@link BeanFactory} object. */ - public static BeanFactory of(BeanFactory parent) { - return new BeanFactory(parent, null); + public static BeanFactory of(BeanFactory parent, Object outer) { + return create().parent(parent).outer(outer).build(); } /** * Default constructor. */ public BeanFactory() { - this(Optional.empty(), Optional.empty()); - } - - /** -* Constructor. -* -* @param parent Parent bean factory. Can be null if this is the root resource. -* @param outer Outer bean context to use when instantiating local classes. Can be null. -*/ - public BeanFactory(BeanFactory parent, Object outer) { - this(Optional.ofNullable(parent), Optional.ofNullable(outer)); + this.parent = Optional.empty(); + this.outer = Optional.empty(); } /** * Constructor. * -* @param parent - Optional parent bean factory. -* @param outer Outer bean context to use when instantiating local classes. +* @param builder The builder containing the settings for this bean. */ - public BeanFactory(Optional parent, Optional outer) { - this.parent = parent; - this.outer = outer; + public BeanFactory(BeanFactoryBuilder builder) { + this.parent = Optional.ofNullable(builder.parent); + this.outer = Optional.ofNullable(builder.outer); } /** diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactoryBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactoryBuilder.java index 170d926..e5525a6 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactoryBuilder.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactoryBuilder.java @@ -12,7 +12,84 @@ // *** package org.apache.juneau.cp; +import static org.apache.juneau.internal.ClassUtils.*; + +import org.apache.juneau.*; +import org.apache.juneau.internal.*; + +/** + * Builder for {@link BeanFactory} objects
[juneau] branch master updated: CollectionUtils refactoring.
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 3ddd7f7 CollectionUtils refactoring. 3ddd7f7 is described below commit 3ddd7f7afe256278592d199536c3ea740e890110 Author: JamesBognar AuthorDate: Sat Feb 6 11:00:11 2021 -0500 CollectionUtils refactoring. --- .../org/apache/juneau/dto/swagger/HeaderInfo.java | 4 +- .../java/org/apache/juneau/dto/swagger/Items.java | 4 +- .../org/apache/juneau/dto/swagger/Operation.java | 48 +-- .../apache/juneau/dto/swagger/ParameterInfo.java | 12 +- .../apache/juneau/dto/swagger/ResponseInfo.java| 14 +- .../org/apache/juneau/dto/swagger/SchemaInfo.java | 20 +- .../apache/juneau/dto/swagger/SecurityScheme.java | 6 +- .../org/apache/juneau/dto/swagger/Swagger.java | 75 ++-- .../apache/juneau/internal/CollectionUtils.java| 465 ++--- .../org/apache/juneau/internal/ListBuilder.java| 234 +++ .../org/apache/juneau/internal/MapBuilder.java | 222 ++ .../org/apache/juneau/internal/SetBuilder.java | 237 +++ .../java/org/apache/juneau/mstat/ThrownStats.java | 4 +- .../java/org/apache/juneau/reflect/ClassInfo.java | 7 +- .../java/org/apache/juneau/rest/RestContext.java | 21 +- .../apache/juneau/dto/swagger/HeaderInfo_Test.java | 4 +- .../apache/juneau/dto/swagger/Swagger_Test.java| 2 +- .../apache/juneau/utils/CollectionUtilsTest.java | 64 --- 18 files changed, 857 insertions(+), 586 deletions(-) diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/HeaderInfo.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/HeaderInfo.java index 7076856..a80407c 100644 --- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/HeaderInfo.java +++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/HeaderInfo.java @@ -382,7 +382,7 @@ public class HeaderInfo extends SwaggerElement { * @return This object (for method chaining). */ public HeaderInfo addEnum(Collection value) { - _enum = addToSet(_enum, value); + _enum = setBuilder(_enum).sparse().addAll(value).build(); return this; } @@ -421,7 +421,7 @@ public class HeaderInfo extends SwaggerElement { * @return This object (for method chaining). */ public HeaderInfo _enum(Object...value) { - setEnum(toSet(value, Object.class)); + setEnum(setBuilder(Object.class).sparse().addAny(value).build()); return this; } diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Items.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Items.java index f71d92d..a1e29c5 100644 --- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Items.java +++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Items.java @@ -326,7 +326,7 @@ public class Items extends SwaggerElement { * Can be null to unset the property. */ public void addEnum(Collection value) { - _enum = addToSet(_enum, value); + _enum = setBuilder(_enum).sparse().addAll(value).build(); } /** @@ -359,7 +359,7 @@ public class Items extends SwaggerElement { * @return This object (for method chaining). */ public Items _enum(Object...value) { - setEnum(toSet(value, Object.class)); + setEnum(setBuilder(Object.class).sparse().addAny(value).build()); return this; } diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Operation.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Operation.java index 7b9f85b..b7addf5 100644 --- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Operation.java +++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/Operation.java @@ -251,7 +251,7 @@ public class Operation extends SwaggerElement { * Can be null to unset the property. */ public void addConsumes(Collection value) { - consumes = addToSet(consumes, value); + consumes = setBuilder(consumes).sparse().addAll(value).build(); } /** @@ -277,7 +277,7 @@ public class Operation extends SwaggerElement { * @return This object (for method chaining). */ public Operation consumes(MediaType...value) { - setConsumes(toSet(value, MediaType.class)); + setConsumes(setBuilder(MediaType.class).sparse().add(value).build()); return this; } @@ -308,7 +308,7 @@ public class Operation extends
[juneau] branch master updated: Project restructuring.
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 9f456ff Project restructuring. 9f456ff is described below commit 9f456ffb628f26859fd26992fe8b786c09d9e380 Author: JamesBognar AuthorDate: Fri Feb 5 14:03:13 2021 -0500 Project restructuring. --- .../juneau-microservice-test.launch| 18 --- juneau-rest/juneau-rest-client-utest/.gitignore| 6 - juneau-rest/juneau-rest-client-utest/pom.xml | 121 - .../src/main/java/empty.txt| 0 juneau-rest/juneau-rest-mock-utest/.gitignore | 7 - juneau-rest/juneau-rest-mock-utest/pom.xml | 129 -- .../juneau-rest-mock-utest/src/main/java/empty.txt | 0 juneau-rest/juneau-rest-server-utest/.gitignore| 6 - juneau-rest/juneau-rest-server-utest/pom.xml | 147 - .../src/main/java/empty.txt| 0 .../juneau-rest-server-utest/xdocs/test2.txt | 13 -- .../xdocs/xsubdocs/test2.txt | 13 -- juneau-rest/pom.xml| 3 - 13 files changed, 463 deletions(-) diff --git a/juneau-microservice/juneau-microservice-test/juneau-microservice-test.launch b/juneau-microservice/juneau-microservice-test/juneau-microservice-test.launch deleted file mode 100644 index 9ce36ac..000 --- a/juneau-microservice/juneau-microservice-test/juneau-microservice-test.launch +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/juneau-rest/juneau-rest-client-utest/.gitignore b/juneau-rest/juneau-rest-client-utest/.gitignore deleted file mode 100644 index 34acf88..000 --- a/juneau-rest/juneau-rest-client-utest/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/target/ -**/.DS_Store -.classpath -.project -/.settings/ -/bin/ diff --git a/juneau-rest/juneau-rest-client-utest/pom.xml b/juneau-rest/juneau-rest-client-utest/pom.xml deleted file mode 100644 index 68bd6ef..000 --- a/juneau-rest/juneau-rest-client-utest/pom.xml +++ /dev/null @@ -1,121 +0,0 @@ - - -http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> - - 4.0.0 - - - org.apache.juneau - juneau-rest - 9.0.0-SNAPSHOT - - - juneau-rest-client-utest - juneau/rest/rest-client-utest - Apache Juneau REST Client Unit Tests - - - - org.apache.juneau - juneau-marshall - ${project.version} - - - org.apache.httpcomponents - httpclient - - - javax.activation - javax.activation-api - - - com.sun.activation - javax.activation - - - junit - junit - - - org.apache.juneau - juneau-rest-mock - ${project.version} - - - org.apache.juneau - juneau-rest-server-rdf - ${project.version} - - - org.apache.juneau - juneau-core-utest - ${project.version} - test-jar - - - org.apache.juneau - juneau-rest-mock-utest - ${project.version} - test-jar - - - javax.servlet - javax.servlet-api - - - - - - true - - 1.8 - 1.8 - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*Test.class - - - - - org.jacoco - jacoco-maven-plugin - 0.8.2 - - - default-
[juneau] branch master updated: Aggregate unit tests into a single project.
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 ae288bb Aggregate unit tests into a single project. ae288bb is described below commit ae288bbe611f6b022c2f9dd5e6b15d4a73a70966 Author: JamesBognar AuthorDate: Fri Feb 5 13:54:24 2021 -0500 Aggregate unit tests into a single project. --- .../src/test/java/org/apache/juneau/rest/Header_AcceptCharset_Test.java | 0 .../src/test/java/org/apache/juneau/rest/Header_AcceptEncoding_Test.java | 0 .../src/test/java/org/apache/juneau/rest/Header_Accept_Test.java | 0 .../src/test/java/org/apache/juneau/rest/Header_ContentType_Test.java | 0 .../juneau-core-utest}/src/test/java/org/apache/juneau/rest/Nls_Test.java | 0 .../src/test/java/org/apache/juneau/rest/Paths_Test.java | 0 .../test/java/org/apache/juneau/rest/RestContext_ThreadLocals_Test.java | 0 .../src/test/java/org/apache/juneau/rest/RestOp_Params_Test.java | 0 .../src/test/java/org/apache/juneau/rest/RestOp_Returns_Test.java | 0 .../src/test/java/org/apache/juneau/rest/RestOp_Throws_Test.java | 0 .../test/java/org/apache/juneau/rest/Rest_PredefinedStatusCodes_Test.java | 0 .../src/test/java/org/apache/juneau/rest/Swagger_Test.java| 0 .../java/org/apache/juneau/rest/annotation/BeanConfig_Swaps_Test.java | 0 .../src/test/java/org/apache/juneau/rest/annotation/Body_Test.java| 0 .../src/test/java/org/apache/juneau/rest/annotation/FormData_Test.java| 0 .../src/test/java/org/apache/juneau/rest/annotation/HasFormData_Test.java | 0 .../src/test/java/org/apache/juneau/rest/annotation/HasQuery_Test.java| 0 .../src/test/java/org/apache/juneau/rest/annotation/Header_Test.java | 0 .../java/org/apache/juneau/rest/annotation/OpSwaggerAnnotation_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/PathRemainder_Test.java | 0 .../src/test/java/org/apache/juneau/rest/annotation/Path_Test.java| 0 .../src/test/java/org/apache/juneau/rest/annotation/Query_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/ResponseBody_Test.java| 0 .../test/java/org/apache/juneau/rest/annotation/ResponseHeader_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/ResponseStatus_Test.java | 0 .../src/test/java/org/apache/juneau/rest/annotation/Response_Test.java| 0 .../test/java/org/apache/juneau/rest/annotation/RestAnnotation_Test.java | 0 .../java/org/apache/juneau/rest/annotation/RestHookAnnotation_Test.java | 0 .../src/test/java/org/apache/juneau/rest/annotation/RestHook_Test.java| 0 .../java/org/apache/juneau/rest/annotation/RestOpAnnotation_Test.java | 0 .../java/org/apache/juneau/rest/annotation/RestOp_BeanConfig_Test.java| 0 .../java/org/apache/juneau/rest/annotation/RestOp_ClientVersion_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/RestOp_Guards_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/RestOp_Matchers_Test.java | 0 .../java/org/apache/juneau/rest/annotation/RestOp_ReqHeaders_Test.java| 0 .../java/org/apache/juneau/rest/annotation/Rest_AllowBodyParam_Test.java | 0 .../org/apache/juneau/rest/annotation/Rest_AllowedHeaderParams_Test.java | 0 .../org/apache/juneau/rest/annotation/Rest_AllowedMethodHeaders_Test.java | 0 .../org/apache/juneau/rest/annotation/Rest_AllowedMethodParams_Test.java | 0 .../apache/juneau/rest/annotation/Rest_AnnotationInheritance_Test.java| 0 .../test/java/org/apache/juneau/rest/annotation/Rest_Context_Test.java| 0 .../src/test/java/org/apache/juneau/rest/annotation/Rest_Debug_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/Rest_Encoders_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/Rest_Messages_Test.java | 0 .../src/test/java/org/apache/juneau/rest/annotation/Rest_RVars_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/Restx_Parsers_Test.java | 0 .../src/test/java/org/apache/juneau/rest/annotation/Restx_Path_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/Restx_ReqAttrs_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/Restx_RoleGuard_Test.java | 0 .../java/org/apache/juneau/rest/annotation/Restx_Serializers_Test.java| 0 .../java/org/apache/juneau/rest/annotation/SwaggerAnnotation_Test.java| 0 .../test/java/org/apache/juneau/rest/annotation/Swagger_Body_Test.java| 0 .../java/org/apache/juneau/rest/annotation/Swagger_FormData_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/Swagger_Header_Test.java | 0 .../test/java/org/apache/juneau/rest/annotation/Swagger_Path_Test.java| 0 .../test/java/org/apache/juneau/rest/annotation/Swagger_Query_Test.java | 0 .../java/org/apache/juneau/rest/annotation/Swagger_Response_Test.java
[juneau] branch master updated: REST refactoring.
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 210725e REST refactoring. 210725e is described below commit 210725ebc14a727351673a5656bc8e41bf4870f1 Author: JamesBognar AuthorDate: Mon Feb 1 15:50:21 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/RestContext.java | 36 ++- .../apache/juneau/rest/SwaggerProviderBuilder.java | 22 +- .../rest/logging/BasicDisabledRestLogger.java | 11 +- .../juneau/rest/logging/BasicRestLogger.java | 352 +--- .../rest/logging/BasicTestCaptureRestLogger.java | 33 +- .../juneau/rest/logging/BasicTestRestLogger.java | 10 +- .../org/apache/juneau/rest/logging/RestLogger.java | 357 + .../juneau/rest/logging/RestLoggerBuilder.java | 66 ++-- .../juneau/rest/logging/RestLoggerRuleBuilder.java | 2 +- 9 files changed, 446 insertions(+), 443 deletions(-) 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 699b333..49e9b9a 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 @@ -3925,14 +3925,18 @@ public class RestContext extends BeanContext { if (resource instanceof RestLogger) x = (RestLogger)resource; - if (x == null) - x = getInstanceProperty(REST_callLogger, RestLogger.class, null, beanFactory); + Object o = getProperty(REST_callLogger); + if (o instanceof RestLogger) + x = (RestLogger)o; if (x == null) x = beanFactory.getBean(RestLogger.class).orElse(null); - if (x == null) - x = getInstanceProperty(REST_callLoggerDefault, RestLogger.class, null, beanFactory); + if (x == null) { + o = getProperty(REST_callLoggerDefault); + if (o instanceof RestLogger) + x = (RestLogger)o; + } if (x == null) x = createCallLoggerBuilder(resource, beanFactory).build(); @@ -3959,18 +3963,36 @@ public class RestContext extends BeanContext { * @return The call logger builder for this REST resource. * @throws Exception If call logger builder could not be instantiated. */ + @SuppressWarnings("unchecked") protected RestLoggerBuilder createCallLoggerBuilder(Object resource, BeanFactory beanFactory) throws Exception { + Class c = null; + + Object o = getProperty(REST_callLogger); + if (o instanceof Class) + c = (Class)o; + + if (c == null) { + o = getProperty(REST_callLoggerDefault); + if (o instanceof Class) + c = (Class)o; + } + + if (c == null) + c = BasicRestLogger.class; + RestLoggerBuilder x = RestLogger .create() + .beanFactory(beanFactory) + .implClass(c) .normalRules( // Rules when debugging is not enabled. - RestLogger.createRule() // Log 500+ errors with status-line and header information. + RestLoggerRule.create() // Log 500+ errors with status-line and header information. .statusFilter(a -> a >= 500) .level(SEVERE) .requestDetail(HEADER) .responseDetail(HEADER) .build(), - RestLogger.createRule() // Log 400-500 errors with just status-line information. + RestLoggerRule.create() // Log 400-500 errors with just status-line information. .statusFilter(a -> a >= 400) .level(WARNING) .requestDetail(STATUS_LINE) @@ -3978,7 +4000,7 @@ public class RestContext extends BeanContext { .build() ) .debugRules( // Rules when debugging is enabled. - RestLogger.createRule() // Log everything with full details. + RestLogge
[juneau] branch master updated: REST refactoring.
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 54ea42f REST refactoring. 54ea42f is described below commit 54ea42fc9b069652f09232bc0edf107e322f1898 Author: JamesBognar AuthorDate: Mon Feb 1 12:39:33 2021 -0500 REST refactoring. --- .../org/apache/juneau/cp/FileFinderBuilder.java| 11 +- .../org/apache/juneau/rest/BasicStaticFiles.java | 124 - .../java/org/apache/juneau/rest/RestContext.java | 62 +-- .../java/org/apache/juneau/rest/StaticFiles.java | 85 +- .../org/apache/juneau/rest/StaticFilesBuilder.java | 23 ++-- .../apache/juneau/rest/SwaggerProviderBuilder.java | 11 +- 6 files changed, 184 insertions(+), 132 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinderBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinderBuilder.java index e539519..b95c290 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinderBuilder.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinderBuilder.java @@ -42,7 +42,7 @@ public class FileFinderBuilder { */ public FileFinder build() { try { - Class ic = isConcrete(implClass) ? implClass : BasicFileFinder.class; + Class ic = isConcrete(implClass) ? implClass : getDefaultImplClass(); return BeanFactory.of(beanFactory).addBeans(FileFinderBuilder.class, this).createBean(ic); } catch (ExecutableException e) { throw new RuntimeException(e.getCause().getMessage(), e.getCause()); @@ -50,6 +50,15 @@ public class FileFinderBuilder { } /** +* Specifies the default implementation class if not specified via {@link #implClass(Class)}. +* +* @return The default implementation class if not specified via {@link #implClass(Class)}. +*/ + protected Class getDefaultImplClass() { + return BasicFileFinder.class; + } + + /** * Adds a class subpackage to the lookup paths. * * @param c The class whose package will be added to the lookup paths. Must not be null. diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java index b3e091c..2bf53b9 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java @@ -12,46 +12,110 @@ // *** package org.apache.juneau.rest; +import static org.apache.juneau.internal.FileUtils.*; +import static org.apache.juneau.internal.ObjectUtils.*; + +import java.io.*; +import java.util.*; + +import javax.activation.*; + +import org.apache.http.*; +import org.apache.juneau.collections.*; +import org.apache.juneau.cp.*; +import org.apache.juneau.http.*; +import org.apache.juneau.http.exception.*; import org.apache.juneau.http.header.*; +import org.apache.juneau.internal.*; /** - * Basic implementation of resource finder used for finding static files served up for REST resources. + * API for retrieving localized static files from either the classpath or file system. * * - * This implementation has the following attributes: - * - * Looks for files in the following locations: - * "static" working subdirectory. - * "htdocs" working subdirectory. - * "htdocs" subpackage from this class and all parent classes. - * "htdocs" root package from this class and all parent classes. - * - * Caches any files smaller than 1MB into memory. - * Ignores any ".class" or ".properties" files found. - * Adds header "Cache-Control: max-age=86400, public" to all resources. - * - * - * - * {@link RestContext#REST_staticFiles} - * + * Provides the same functionality as {@link BasicFileFinder} but adds support for returning files as {@link BasicHttpResource} + * objects with arbitrary headers. */ -public class BasicStaticFiles extends StaticFiles { +public class BasicStaticFiles extends BasicFileFinder implements StaticFiles { + + private final Header[] headers; + private final MimetypesFileTypeMap mimeTypes; + private final int hashCode; + + /** +* Creates a new builder for this object. +* +* @return A new builder for th
[juneau] branch master updated: REST refactoring.
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 cc1c154 REST refactoring. cc1c154 is described below commit cc1c1547770190a0fda82502ac4f7a4fe9f22049 Author: JamesBognar AuthorDate: Mon Feb 1 11:13:02 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/cp/FileFinder_Test.java | 7 +- .../cp/{FileFinder.java => BasicFileFinder.java} | 165 +++ .../java/org/apache/juneau/cp/BeanFactory.java | 23 ++ .../main/java/org/apache/juneau/cp/FileFinder.java | 305 ++--- .../org/apache/juneau/cp/FileFinderBuilder.java| 54 ++-- .../org/apache/juneau/internal/ClassUtils.java | 14 + .../java/org/apache/juneau/rest/Swagger_Test.java | 2 +- .../org/apache/juneau/rest/BasicFileFinder.java| 53 .../apache/juneau/rest/BasicSwaggerProvider.java | 2 +- .../java/org/apache/juneau/rest/RestContext.java | 10 +- .../java/org/apache/juneau/rest/StaticFiles.java | 4 +- .../apache/juneau/rest/SwaggerProviderBuilder.java | 7 +- 12 files changed, 143 insertions(+), 503 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/FileFinder_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/FileFinder_Test.java index 10bbef2..ffe720f 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/FileFinder_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/FileFinder_Test.java @@ -654,16 +654,17 @@ public class FileFinder_Test { @Test public void e03_subclassing() throws Exception { - E03b x = E03b + FileFinder x = E03b .create() .dir(".") .caching(100_000_000) - .build(E03b.class); + .implClass(E03b.class) + .build(); assertObject(x).isType(E03b.class); } public static class E03a extends FileFinderBuilder {} - public static class E03b extends FileFinder { + public static class E03b extends BasicFileFinder { public static E03a create() { return new E03a(); } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicFileFinder.java similarity index 68% copy from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinder.java copy to juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicFileFinder.java index 75f941f..e065401 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/FileFinder.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BasicFileFinder.java @@ -28,60 +28,14 @@ import org.apache.juneau.collections.*; import org.apache.juneau.internal.*; /** - * Utility class for finding regular or localized files on the classpath and file system. - * - * Example: - * - * // Constructor a file source that looks for files in the "files" working directory, then in the - * // package "foo.bar", then in the package "foo.bar.files", then in the package "files". - * FileFinder finder = FileFinder - * .create() - * .dir("files") - * .cp(foo.bar.MyClass.class,null,true) - * .cp(foo.bar.MyClass.class,"files",true) - * .cp(foo.bar.MyClass.class,"/files",true) - * .cache(1_000_000l) // Cache files less than 1MB in size. - * .ignore(Pattern.compile("(?i)(.*\\.(class|properties))|(package.html)")) // Ignore certain files. - * .build(); - * - * // Find a normal file. - * InputStream is1 = finder.getStream("text.txt"); - * - * // Find a localized file called "text_ja_JP.txt". - * InputStream is2 = finder.getStream("text.txt", Locale.JAPAN); - * - * - * - * If the locale is specified, then we look for resources whose name matches that locale. - * For example, if looking for the resource "MyResource.txt" for the Japanese locale, we will look for - * files in the following order: - * - * "MyResource_ja_JP.txt" - * "MyResource_ja.txt" - * "MyResource.txt" - * - * - * - * This class can be subclassed to provide specific preconfigured instances using no-arg constructors. - * - * Example: - * - * public class MyFileFinder extends FileFinder { - * public MyFileFinder() { - * super( - * new FileFinderBuilder()
[juneau] branch master updated: REST refactoring.
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 a76b82e REST refactoring. a76b82e is described below commit a76b82ef4f8c20c7e2cfb6e40b1f28343b6b2728 Author: JamesBognar AuthorDate: Mon Feb 1 10:07:46 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/Swagger_Test.java | 4 -- .../rest/annotation/RestAnnotation_Test.java | 10 ++--- .../juneau/rest/annotation/Swagger_Body_Test.java | 1 - ...ggerProvider.java => BasicSwaggerProvider.java} | 36 ...ssion.java => BasicSwaggerProviderSession.java} | 4 +- .../java/org/apache/juneau/rest/RestContext.java | 13 -- .../org/apache/juneau/rest/RestContextBuilder.java | 4 +- .../org/apache/juneau/rest/SwaggerProvider.java| 48 +++--- .../apache/juneau/rest/SwaggerProviderBuilder.java | 6 ++- .../org/apache/juneau/rest/annotation/Rest.java| 21 +- .../juneau/rest/annotation/RestAnnotation.java | 2 +- 11 files changed, 39 insertions(+), 110 deletions(-) diff --git a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java index 7e10cad..21f9bef 100644 --- a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java +++ b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/Swagger_Test.java @@ -23,7 +23,6 @@ import java.util.*; import org.apache.juneau.json.*; import org.apache.juneau.jsonschema.annotation.*; import org.apache.juneau.jsonschema.annotation.Tag; -import org.apache.juneau.marshall.*; import org.apache.juneau.xml.*; import org.apache.juneau.*; import org.apache.juneau.annotation.*; @@ -1614,7 +1613,6 @@ public class Swagger_Test { @Test public void l02_query_example_swaggerOnClass() throws Exception { - System.err.println(getSwagger(new L2())); assertEquals("{id:2}", getSwagger(new L2()).getPaths().get("/path/{foo}/query").get("get").getParameter("query", "foo").getExample()); assertEquals("{id:2}", getSwaggerWithFile(new L2()).getPaths().get("/path/{foo}/query").get("get").getParameter("query", "foo").getExample()); } @@ -2348,8 +2346,6 @@ public class Swagger_Test { Operation o = s.getOperation("/", "get"); ParameterInfo pi = o.getParameter("body", null); - SimpleJson.DEFAULT_READABLE.println(s); - assertEquals("{\n\tf1: 1,\n\tf2: 2\n}", pi.getExamples().get("application/json+simple")); ResponseInfo ri = o.getResponse("200"); assertEquals("{\n\tf1: 1,\n\tf2: 2\n}", ri.getExamples().get("application/json+simple")); 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 4aff0f9..3574d9d 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 @@ -82,7 +82,7 @@ public class RestAnnotation_Test { .siteName("siteName") .staticFiles(StaticFiles.class) .swagger(SwaggerAnnotation.DEFAULT) - .swaggerProvider(SwaggerProvider.class) + .swaggerProvider(BasicSwaggerProvider.class) .title("title") .uriAuthority("uriAuthority") .uriContext("uriContext") @@ -136,7 +136,7 @@ public class RestAnnotation_Test { .siteName("siteName") .staticFiles(StaticFiles.class) .swagger(SwaggerAnnotation.DEFAULT) - .swaggerProvider(SwaggerProvider.class) + .swaggerProvider(BasicSwaggerProvider.class) .title("title") .uriAuthority("uriAuthority") .uriContext("uriContext") @@ -193,7 +193,7 @@ public class RestAnnotation_Test { + "siteName:'siteName'," + "staticFiles:'org.apache.juneau.rest.StaticFiles'," + "swagger:{contact:{email:'',name:'',url:'',value:[]},description:[],externalDocs:{description:[],url:'',va
[juneau] branch master updated: VarResolvers should use BeanFactories.
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 7926fc5 VarResolvers should use BeanFactories. 7926fc5 is described below commit 7926fc54a33c3d736345ae019b7439de058e967b Author: JamesBognar AuthorDate: Sat Jan 30 13:58:19 2021 -0500 VarResolvers should use BeanFactories. --- .../main/java/org/apache/juneau/config/Config.java | 2 +- .../org/apache/juneau/config/vars/ConfigVar.java | 26 +++ .../org/apache/juneau/html/HtmlDocSerializer.java | 12 ++-- .../juneau/html/HtmlDocSerializerSession.java | 2 +- .../java/org/apache/juneau/html/HtmlWidgetMap.java | 57 --- .../java/org/apache/juneau/html/HtmlWidgetVar.java | 14 +--- .../juneau/serializer/SerializerSession.java | 8 +-- .../java/org/apache/juneau/svl/VarResolver.java| 20 +++--- .../org/apache/juneau/svl/VarResolverBuilder.java | 32 - .../org/apache/juneau/svl/VarResolverContext.java | 31 .../org/apache/juneau/svl/VarResolverSession.java | 83 +++--- .../apache/juneau/microservice/Microservice.java | 5 +- .../juneau/microservice/MicroserviceBuilder.java | 13 ++-- .../jetty/JettyMicroserviceBuilder.java| 4 +- .../java/org/apache/juneau/rest/RestContext.java | 18 + .../org/apache/juneau/rest/RestContextBuilder.java | 20 +++--- .../java/org/apache/juneau/rest/RestRequest.java | 7 +- .../org/apache/juneau/rest/SwaggerProvider.java| 2 +- .../java/org/apache/juneau/rest/vars/FileVar.java | 32 - .../apache/juneau/rest/vars/LocalizationVar.java | 15 ++-- .../juneau/rest/vars/RequestAttributeVar.java | 15 ++-- .../juneau/rest/vars/RequestFormDataVar.java | 16 ++--- .../apache/juneau/rest/vars/RequestHeaderVar.java | 15 ++-- .../apache/juneau/rest/vars/RequestPathVar.java| 14 ++-- .../apache/juneau/rest/vars/RequestQueryVar.java | 15 ++-- .../apache/juneau/rest/vars/RequestSwaggerVar.java | 13 ++-- .../org/apache/juneau/rest/vars/RequestVar.java| 15 ++-- .../juneau/rest/vars/SerializedRequestAttrVar.java | 24 +++ .../juneau/rest/vars/ServletInitParamVar.java | 10 ++- .../org/apache/juneau/rest/vars/SwaggerVar.java| 10 ++- .../java/org/apache/juneau/rest/vars/UrlVar.java | 11 +-- .../java/org/apache/juneau/rest/widget/Widget.java | 8 +-- 32 files changed, 219 insertions(+), 350 deletions(-) diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java index ca94200..90476bd 100644 --- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java +++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/Config.java @@ -457,7 +457,7 @@ public final class Config extends Context implements ConfigEventListener, Writab varSession = getInstanceProperty(CONFIG_varResolver, VarResolver.class, VarResolver.DEFAULT) .builder() .vars(ConfigVar.class) - .contextObject(ConfigVar.SESSION_config, this) + .bean(Config.class, this) .build() .createSession(); binaryLineLength = getIntegerProperty(CONFIG_binaryLineLength); diff --git a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/vars/ConfigVar.java b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/vars/ConfigVar.java index 0e14b01..f52c2d2 100644 --- a/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/vars/ConfigVar.java +++ b/juneau-core/juneau-config/src/main/java/org/apache/juneau/config/vars/ConfigVar.java @@ -23,20 +23,22 @@ import org.apache.juneau.svl.*; * See {@link Config#getString(String)} for the format of the key. * * - * This variable resolver requires that a {@link Config} object be set as a context object on the resolver or a - * session object on the resolver session. + * This variable resolver requires that a {@link Config} bean be available in the resolver session bean factory. * * Example: * * // Create a config object. - * Config config = Config.create().name("MyConfig.cfg").build(); + * Config config = Config.create().name("MyConfig.cfg").build(); * * // Create a variable resolver that resolves config file entries (e.g. "$C{MySection/myKey}") - * VarResolver r = new VarResolver().addVars(ConfigVar.class) - * .addContextObject(SESSION_config, configFile); + * VarResolver resolver = VarResolver + * .create() + * .vars(ConfigVar.class) + * .bean(Config.class, config) + * .build(); * * // Use it! - * Syste
[juneau] branch master updated: Remove old Cognos DTOs.
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 3bf3433 Remove old Cognos DTOs. 3bf3433 is described below commit 3bf3433ba107775d2f83389691d04d5dee4651fc Author: JamesBognar AuthorDate: Sat Jan 30 12:11:48 2021 -0500 Remove old Cognos DTOs. --- .../apache/juneau/dto/cognos/CognosXmlTest.java| 113 --- .../dto/{cognos/package-info.java => Temp.java}| 99 -- .../java/org/apache/juneau/dto/cognos/Column.java | 161 .../java/org/apache/juneau/dto/cognos/DataSet.java | 207 - .../java/org/apache/juneau/dto/cognos/package.html | 58 -- 5 files changed, 79 insertions(+), 559 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/dto/cognos/CognosXmlTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/dto/cognos/CognosXmlTest.java deleted file mode 100644 index 878b614..000 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/dto/cognos/CognosXmlTest.java +++ /dev/null @@ -1,113 +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.dto.cognos; - -import static org.apache.juneau.assertions.Assertions.*; -import static org.junit.Assert.*; -import static org.junit.runners.MethodSorters.*; - -import java.util.*; - -import org.apache.juneau.*; -import org.apache.juneau.collections.*; -import org.apache.juneau.xml.*; -import org.junit.*; - -@FixMethodOrder(NAME_ASCENDING) -public class CognosXmlTest { - - // - // test - // - @Test - public void test() throws Exception { - String expected = "" - + "\n" - + " \n" - + " \n" - + " \n" - + " \n" - + " \n" - + " \n" - + " \n" - + " \n" - + " \n" - + " \n" - + " Apr 26, 2002\n" - + " 0.21006642\n" - + " JA1\n" - + " F\n" - + " B\n" - + " 1\n" - + " \n" - + " \n" - + " Apr 27, 2002\n" - + " 0.111\n" - + " BBB\n" - + " G\n" - + " B\n" -
[juneau] branch master updated: DTO refactoring.
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 77e5a46 DTO refactoring. 77e5a46 is described below commit 77e5a46e2399f4d20684c88cda4876087dba7c06 Author: JamesBognar AuthorDate: Sat Jan 30 12:08:37 2021 -0500 DTO refactoring. --- .../java/org/apache/juneau/dto/LinkString.java | 118 ++--- .../apache/juneau/dto/swagger/ui/SwaggerUI.java| 3 +- 2 files changed, 106 insertions(+), 15 deletions(-) diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/LinkString.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/LinkString.java index 9456c57..eb40522 100644 --- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/LinkString.java +++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/LinkString.java @@ -16,6 +16,7 @@ import static org.apache.juneau.internal.StringUtils.*; import static org.apache.juneau.internal.ObjectUtils.*; import java.text.*; +import java.util.*; import org.apache.juneau.annotation.*; import org.apache.juneau.html.*; @@ -64,13 +65,17 @@ public class LinkString implements Comparable { // Bean properties //- + //- + // name + //- + /** * Bean property getter: name. * * * Corresponds to the text inside of the A element. * -* @return The value of the name property on this bean, or null if it is not set. +* @return The property value, or null if it is not set. */ public String getName() { return name; @@ -79,21 +84,56 @@ public class LinkString implements Comparable { /** * Bean property setter: name. * -* @param name The new value for the name property on this bean. +* +* Corresponds to the text inside of the A element. +* +* @param value +* The new value for this property. +* Can be null to unset the property. +*/ + public void setName(String value) { + this.name = value; + } + + /** +* Bean property fluent getter: name. +* +* +* Corresponds to the text inside of the A element. +* +* @return The property value as an {@link Optional}. Never null. +*/ + public Optional name() { + return Optional.ofNullable(name); + } + + /** +* Bean property fluent setter: name. +* +* +* Corresponds to the text inside of the A element. +* +* @param value +* The new value for this property. +* Can be null to unset the property. * @return This object (for method chaining). */ - public LinkString name(String name) { - this.name = name; + public LinkString name(String value) { + setName(value); return this; } + //- + // uri + //- + /** * Bean property getter: uri. * * * Corresponds to the value of the href attribute of the A element. * -* @return The value of the href property on this bean, or null if it is not set. +* @return The property value, or null if it is not set. */ public java.net.URI getUri() { return uri; @@ -102,35 +142,85 @@ public class LinkString implements Comparable { /** * Bean property setter: uri. * -* @param uri The new value for the href property on this bean. +* +* Corresponds to the value of the href attribute of the A element. +* +* @param value +* The new value for this property. +* Can be null to unset the property. +*/ + public void setUri(java.net.URI value) { + this.uri = value; + } + + /** +* Bean property fluent getter: uri. +* +* +* Corresponds to the value of the href attribute of the A element. +* +* @return The property value as an {@link Optional}. Never null. +*/ + public Optional
[juneau] branch master updated: Atom feed DTO refactoring.
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 c661849 Atom feed DTO refactoring. c661849 is described below commit c6618499d849c80914ec38baa1210752bc6614b8 Author: JamesBognar AuthorDate: Sat Jan 30 11:55:51 2021 -0500 Atom feed DTO refactoring. --- TODO.txt | 15 +- .../java/org/apache/juneau/dto/atom/Category.java | 143 +-- .../java/org/apache/juneau/dto/atom/Common.java| 96 - .../org/apache/juneau/dto/atom/CommonEntry.java| 431 + .../java/org/apache/juneau/dto/atom/Content.java | 49 ++- .../java/org/apache/juneau/dto/atom/Entry.java | 216 +-- .../main/java/org/apache/juneau/dto/atom/Feed.java | 251 ++-- .../java/org/apache/juneau/dto/atom/Generator.java | 142 +-- .../main/java/org/apache/juneau/dto/atom/Icon.java | 47 ++- .../main/java/org/apache/juneau/dto/atom/Id.java | 49 ++- .../main/java/org/apache/juneau/dto/atom/Link.java | 284 -- .../main/java/org/apache/juneau/dto/atom/Logo.java | 48 ++- .../java/org/apache/juneau/dto/atom/Person.java| 144 +-- .../java/org/apache/juneau/dto/atom/Source.java| 204 -- .../main/java/org/apache/juneau/dto/atom/Text.java | 100 - 15 files changed, 1852 insertions(+), 367 deletions(-) diff --git a/TODO.txt b/TODO.txt index 48941cd..54136aa 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,8 +1,15 @@ RestCall.exception(...) should accumulate exceptions, not just one. Replace RestInfoProvider with Swagger. -Rework RestCallLogger. -x @Rest(path) should allow you to match against file name (e.g. "favicon.ico") +xxx Rework RestCallLogger. +xxx @Rest(path) should allow you to match against file name (e.g. "favicon.ico") Replace @Rest(paths) with just @Rest(path) -Auto-injection into REST interfaces. +Auto-injection into REST interfaces (via providers?) ClassInfo improvements to getMethod (e.g. getMethodExact vs getMethod). -Re-add @PathRemainder annotation. \ No newline at end of file +Re-add @PathRemainder annotation. +xxx Replace RestResourceResolver with ObjectFactory (or something already predefined?). +xxx Remove @Rest(properties) and all that stuff. +Add a createConfig() method on RestContext. +Thrown NotFound causes - javax.servlet.ServletException: Invalid method response: 200 + +Instead of PropertyStores, builders should produce settings which are passed to contexts. + diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/atom/Category.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/atom/Category.java index 880620f..2141a66 100644 --- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/atom/Category.java +++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/atom/Category.java @@ -17,8 +17,8 @@ import static org.apache.juneau.xml.annotation.XmlFormat.*; import java.net.*; import java.net.URI; +import java.util.*; -import org.apache.juneau.*; import org.apache.juneau.annotation.*; import org.apache.juneau.xml.annotation.*; @@ -67,7 +67,12 @@ public class Category extends Common { //- /** -* @return The category term. +* Bean property getter: term. +* +* +* The category term. +* +* @return The property value, or null if it is not set. */ @Xml(format=ATTR) public String getTerm() { @@ -75,21 +80,55 @@ public class Category extends Common { } /** -* Sets the category term. +* Bean property setter: term. * -* @param term The category term. +* +* The category term. +* +* @param value +* The new value for this property. +* Can be null to unset the property. +*/ + @Xml(format=ATTR) + public void setTerm(String value) { + this.term = value; + } + + /** +* Bean property fluent getter: term. +* +* +* The category term. +* +* @return The property value as an {@link Optional}. Never null. +*/ + public Optional term() { + return Optional.ofNullable(term); + } + + /** +* Bean property fluent setter: term. +* +* +* The category term. +* +* @param value +* The new value for this property. +* Can be null to unset the property. * @return This object (for method chaining). */ - @Beanp("term") - public Category term(String term) { - th
[juneau] branch master updated: REST API refactoring.
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 58db5a9 REST API refactoring. 58db5a9 is described below commit 58db5a98ac7103643f6587337722870500db6368 Author: JamesBognar AuthorDate: Tue Jan 26 09:59:38 2021 -0500 REST API refactoring. --- .../java/org/apache/juneau/rest/RestContext.java | 663 +++--- .../org/apache/juneau/rest/SwaggerProvider.java| 1320 .../apache/juneau/rest/SwaggerProviderBuilder.java | 115 ++ 3 files changed, 1958 insertions(+), 140 deletions(-) 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 d70c08e..f3a5e06 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 @@ -18,8 +18,10 @@ import static org.apache.juneau.internal.ObjectUtils.*; import static org.apache.juneau.internal.IOUtils.*; import static org.apache.juneau.internal.StringUtils.*; import static org.apache.juneau.rest.HttpRuntimeException.*; +import static org.apache.juneau.rest.logging.RestLoggingDetail.*; import static org.apache.juneau.Enablement.*; import static java.util.Collections.*; +import static java.util.logging.Level.*; import static java.util.Arrays.*; import java.io.*; @@ -63,6 +65,7 @@ import org.apache.juneau.rest.converters.*; import org.apache.juneau.rest.logging.*; import org.apache.juneau.rest.params.*; import org.apache.juneau.http.exception.*; +import org.apache.juneau.http.header.*; import org.apache.juneau.rest.reshandlers.*; import org.apache.juneau.rest.util.*; import org.apache.juneau.rest.vars.*; @@ -2893,6 +2896,34 @@ public class RestContext extends BeanContext { public static final String REST_staticFilesDefault = PREFIX + ".staticFilesDefault.o"; /** +* Configuration property: Swagger provider class. +* +* Property: +* +* ID: {@link org.apache.juneau.rest.RestContext#REST_swaggerProviderClass REST_swaggerProviderClass} +* Name: "RestContext.swaggerProviderClass.c" +* Data type: {@link org.apache.juneau.rest.SwaggerProvider} +* Default: {@link org.apache.juneau.rest.SwaggerProvider} +* Session property: false +* Annotations: +* +* {@link org.apache.juneau.rest.annotation.Rest#infoProvider()} +* +* Methods: +* +* {@link org.apache.juneau.rest.RestContextBuilder#infoProvider(Class)} +* {@link org.apache.juneau.rest.RestContextBuilder#infoProvider(RestInfoProvider)} +* +* +* Description: +* +* The default static file finder. +* +* This setting is inherited from the parent context. +*/ + public static final String REST_swaggerProviderClass = PREFIX + ".swaggerProviderClass.c"; + + /** * Configuration property: Supported accept media types. * * Property: @@ -3421,6 +3452,7 @@ public class RestContext extends BeanContext { private final StackTraceStore stackTraceStore; private final Logger logger; private final RestInfoProvider infoProvider; + private final SwaggerProvider swaggerProvider; private final HttpException initException; private final RestContext parentContext; final BeanFactory rootBeanFactory; @@ -3503,9 +3535,9 @@ public class RestContext extends BeanContext { parentContext = builder.parentContext; ClassInfo rci = ClassInfo.ofProxy(r); - rootBeanFactory = createRootBeanFactory(r); + rootBeanFactory = createBeanFactory(r); - beanFactory = createBeanFactory(r); + beanFactory = BeanFactory.of(rootBeanFactory, r); beanFactory.addBean(BeanFactory.class, beanFactory); beanFactory.addBean(RestContext.class, this); beanFactory.addBean(Object.class, r); @@ -3597,10 +3629,11 @@ public class RestContext extends BeanContext { preCallMethods = createPreCallMethods(r).stream().map(this::toRestMethodInvoker).toArray(RestMethodInvoker[]:: new); postCallMethods = createPostCallMethods(r).stream().map(this::toRestMethodInvoker).toArray(RestMethodInvoker[]:: new); - restMethod
[juneau] branch master updated: REST refactoring.
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 41f9e86 REST refactoring. 41f9e86 is described below commit 41f9e866a90f1d2dd878c8f0e03078febb75501c Author: JamesBognar AuthorDate: Sun Jan 24 14:09:55 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/mock/MockRestClient.java | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java index 775ef25..1d93a96 100644 --- a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java +++ b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java @@ -229,9 +229,7 @@ public class MockRestClient extends RestClient implements HttpClientConnection { MOCKRESTCLIENT_pathVars = PREFIX + "pathVars.oms"; - private static Map,RestContext> - CONTEXTS_DEBUG = new ConcurrentHashMap<>(), - CONTEXTS_NORMAL = new ConcurrentHashMap<>(); + private static Map,RestContext> REST_CONTEXTS = new ConcurrentHashMap<>(); //--- // Instance properties @@ -274,11 +272,9 @@ public class MockRestClient extends RestClient implements HttpClientConnection { String contextPath = ps.getProperty(MOCKRESTCLIENT_contextPath, String.class, null); String servletPath = ps.getProperty(MOCKRESTCLIENT_servletPath, String.class, null); String rootUrl = ps.getProperty(RESTCLIENT_rootUri, String.class, "http://localhost;); - boolean isDebug = ps.getProperty(CONTEXT_debug, Boolean.class, false); Class c = restBean instanceof Class ? (Class)restBean : restBean.getClass(); - Map,RestContext> contexts = isDebug ? CONTEXTS_DEBUG : CONTEXTS_NORMAL; - if (! contexts.containsKey(c)) { + if (! REST_CONTEXTS.containsKey(c)) { boolean isClass = restBean instanceof Class; Object o = isClass ? ((Class)restBean).newInstance() : restBean; RestContext rc = RestContext @@ -288,9 +284,9 @@ public class MockRestClient extends RestClient implements HttpClientConnection { .build() .postInit() .postInitChildFirst(); - contexts.put(c, rc); + REST_CONTEXTS.put(c, rc); } - RestContext restBeanCtx = contexts.get(c); + RestContext restBeanCtx = REST_CONTEXTS.get(c); psb.set(MOCKRESTCLIENT_restBeanCtx, restBeanCtx); if (servletPath == null)
[juneau] branch master updated: REST refactoring.
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 0bc8874 REST refactoring. 0bc8874 is described below commit 0bc8874be4647a1dc54fb4d888d9ce4f979bf36f Author: JamesBognar AuthorDate: Sun Jan 24 12:45:52 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/BasicFileFinder.java | 4 ++-- .../apache/juneau/rest/BasicRestInfoProvider.java| 2 +- .../org/apache/juneau/rest/BasicStaticFiles.java | 4 ++-- .../java/org/apache/juneau/rest/RestContext.java | 20 ++-- .../org/apache/juneau/rest/RestContextBuilder.java | 11 ++- .../apache/juneau/rest/RestMethodContextBuilder.java | 2 +- .../java/org/apache/juneau/rest/RestRequest.java | 9 + .../org/apache/juneau/rest/SwaggerGenerator.java | 6 ++ .../java/org/apache/juneau/rest/vars/RequestVar.java | 4 ++-- 9 files changed, 43 insertions(+), 19 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicFileFinder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicFileFinder.java index 3b9ebc7..961ad48 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicFileFinder.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicFileFinder.java @@ -44,8 +44,8 @@ public class BasicFileFinder extends FileFinder { .create() .dir("static") .dir("htdocs") - .cp(context.getResource().getClass(), "htdocs", true) - .cp(context.getResource().getClass(), "/htdocs", true) + .cp(context.getResourceClass(), "htdocs", true) + .cp(context.getResourceClass(), "/htdocs", true) .caching(1_000_000) .exclude("(?i).*\\.(class|properties)") ); diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java index 299ab68..d48f812 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java @@ -66,7 +66,7 @@ public class BasicRestInfoProvider implements RestInfoProvider { description; Builder(RestContext context) { - ClassInfo ci = ClassInfo.ofProxy(context.getResource()); + ClassInfo ci = ClassInfo.of(context.getResourceClass()); for (Rest r : ci.getAnnotations(Rest.class)) { if (! r.siteName().isEmpty()) siteName = r.siteName(); diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java index eb1f7f1..b3e091c 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicStaticFiles.java @@ -47,8 +47,8 @@ public class BasicStaticFiles extends StaticFiles { .create() .dir("static") .dir("htdocs") - .cp(context.getResource().getClass(), "htdocs", true) - .cp(context.getResource().getClass(), "/htdocs", true) + .cp(context.getResourceClass(), "htdocs", true) + .cp(context.getResourceClass(), "/htdocs", true) .caching(1_000_000) .exclude("(?i).*\\.(class|properties)") .headers(CacheControl.of("max-age=86400, public")) 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 9c103d9..d70c08e 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 @@ -3385,6 +3385,7 @@ public class RestContext extends BeanContext { //--- private final Supplier resource; + priva
[juneau] branch master updated: REST refactoring.
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 ac54809 REST refactoring. ac54809 is described below commit ac548099580d30ddb95e4e4f559522c0472a1313 Author: JamesBognar AuthorDate: Sun Jan 24 11:58:08 2021 -0500 REST refactoring. --- .../org/apache/juneau/cp/BeanFactory_Test.java | 4 +- .../java/org/apache/juneau/cp/BeanFactory.java | 10 + .../build-overlay/pom.xml | 18 +- .../build-overlay/pom.xml | 4 +- .../juneau-examples-rest-springboot/pom.xml| 4 +- .../apache/juneau/rest/mock/MockRestClient.java| 2 +- juneau-rest/juneau-rest-server-springboot/pom.xml | 2 +- .../rest/annotation/RestAnnotation_Test.java | 27 +- .../rest/annotation/RestMethodAnnotation_Test.java | 10 +- .../juneau/rest/annotation/Rest_Context_Test.java | 6 +- .../juneau/rest/annotation/Restx_Path_Test.java| 6 +- .../main/java/org/apache/juneau/rest/RestCall.java | 2 +- ...RestMethodsBuilder.java => RestChildMatch.java} | 60 +-- .../java/org/apache/juneau/rest/RestChildren.java | 125 ++ .../apache/juneau/rest/RestChildrenBuilder.java| 92 + .../java/org/apache/juneau/rest/RestContext.java | 450 - .../org/apache/juneau/rest/RestContextBuilder.java | 90 +++-- .../org/apache/juneau/rest/RestMethodContext.java | 67 ++- .../juneau/rest/RestMethodContextBuilder.java | 58 ++- .../java/org/apache/juneau/rest/RestMethods.java | 17 +- .../org/apache/juneau/rest/RestMethodsBuilder.java | 54 ++- .../java/org/apache/juneau/rest/RestServlet.java | 4 +- .../org/apache/juneau/rest/annotation/Rest.java| 64 +-- .../juneau/rest/annotation/RestAnnotation.java | 78 +++- .../apache/juneau/rest/annotation/RestMethod.java | 4 +- .../rest/annotation/RestMethodAnnotation.java | 18 +- pom.xml| 2 +- 27 files changed, 1020 insertions(+), 258 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java index 1ddd4a7..17fd8c8 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java @@ -39,7 +39,7 @@ public class BeanFactory_Test { bf.addBean(A.class, new A()); assertBoolean(bf.hasBean(A.class)).isTrue(); assertObject(bf.getBean(A.class)).exists(); - bf = new BeanFactory(bf, null); + bf = BeanFactory.of(bf); assertBoolean(bf.hasBean(A.class)).isTrue(); assertObject(bf.getBean(A.class)).exists(); } @@ -270,7 +270,7 @@ public class BeanFactory_Test { public void d01b_createBean_construct_withArgs_inner() throws Exception { BeanFactory bf = new BeanFactory(); assertThrown(()->bf.createBean(D1b.class)).stderr().is("Could not instantiate class "+CNAME+"$D1b: Public constructor found but could not find prerequisites: BeanFactory_Test,A."); - BeanFactory bf2 = new BeanFactory(null,this); + BeanFactory bf2 = BeanFactory.of(null,this); assertThrown(()->bf2.createBean(D1b.class)).stderr().is("Could not instantiate class "+CNAME+"$D1b: Public constructor found but could not find prerequisites: A."); bf2.addBean(A.class, new A()); assertObject(bf2.createBean(D1b.class)).exists(); diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java index 8b148af..e0b2bd7 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java @@ -61,6 +61,16 @@ public class BeanFactory { } /** +* Static creator. +* +* @param parent Parent bean factory. Can be null if this is the root resource. +* @return A new {@link BeanFactory} object. +*/ + public static BeanFactory of(BeanFactory parent) { + return new BeanFactory(parent, null); + } + + /** * Default constructor. */ public BeanFactory() { diff --git a/juneau-examples/juneau-examples-rest-jetty/build-overlay/pom.xml b/juneau-examples/juneau-examples-rest-jetty/build-overlay/pom.xml index 19bc870..cdd1078 100644 --- a/juneau-examples/juneau-examples-rest-jetty/build-overlay/pom.xml
[juneau] branch master updated: Minor perf improvement.
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 30f17a4 Minor perf improvement. 30f17a4 is described below commit 30f17a40e316ef5117fe67e1a9d73d30999d9eed Author: JamesBognar AuthorDate: Fri Jan 22 09:23:10 2021 -0500 Minor perf improvement. --- .../src/main/java/org/apache/juneau/PropertyStore.java | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index 9e8075f..317e4a4 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -198,15 +198,15 @@ public final class PropertyStore { */ public static PropertyStore DEFAULT = PropertyStore.create().build(); - final SortedMap groups; + final Map groups; private final int hashCode; // Created by PropertyStoreBuilder.build() PropertyStore(Map propertyMaps) { - TreeMap m = new TreeMap<>(); + Map m = new LinkedHashMap<>(); for (Map.Entry p : propertyMaps.entrySet()) m.put(p.getKey(), p.getValue().build()); - this.groups = Collections.unmodifiableSortedMap(m); + this.groups = Collections.unmodifiableMap(m); this.hashCode = groups.hashCode(); } @@ -228,7 +228,7 @@ public final class PropertyStore { } private PropertyStore(SortedMap propertyMaps) { - this.groups = Collections.unmodifiableSortedMap(propertyMaps); + this.groups = Collections.unmodifiableMap(new LinkedHashMap<>(propertyMaps)); this.hashCode = groups.hashCode(); } @@ -663,14 +663,14 @@ public final class PropertyStore { * A group of properties with the same prefixes. */ public static class PropertyGroup { - final SortedMap properties; + final Map properties; private final int hashCode; PropertyGroup(Map properties) { - TreeMap m = new TreeMap<>(); + Map m = new LinkedHashMap<>(); for (Map.Entry p : properties.entrySet()) m.put(p.getKey(), p.getValue().build()); - this.properties = Collections.unmodifiableSortedMap(m); + this.properties = Collections.unmodifiableMap(m); this.hashCode = this.properties.hashCode(); }
[juneau] branch master updated: REST refactoring.
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 f4afbf8 REST refactoring. f4afbf8 is described below commit f4afbf88cc514ca719371cef6883bee9ba13c877 Author: JamesBognar AuthorDate: Thu Jan 21 18:37:30 2021 -0500 REST refactoring. --- .../rest/annotation/RestMethodAnnotation_Test.java | 5 ++ .../juneau/rest/annotation/Rest_Context_Test.java | 2 +- .../java/org/apache/juneau/rest/RestContext.java | 12 +++-- .../org/apache/juneau/rest/RestContextBuilder.java | 7 ++- .../org/apache/juneau/rest/RestMethodContext.java | 58 ++ .../juneau/rest/RestMethodContextBuilder.java | 49 ++ .../apache/juneau/rest/RrpcRestMethodContext.java | 6 +-- .../apache/juneau/rest/annotation/RestMethod.java | 15 ++ .../rest/annotation/RestMethodAnnotation.java | 20 9 files changed, 141 insertions(+), 33 deletions(-) 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 5ecf817..3e46c26 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 @@ -36,6 +36,7 @@ public class RestMethodAnnotation_Test { RestMethod a1 = RestMethodAnnotation.create() .clientVersion("clientVersion") .consumes("consumes") + .context(RestMethodContext.class) .converters(RestConverter.class) .debug("debug") .defaultAccept("defaultAccept") @@ -68,6 +69,7 @@ public class RestMethodAnnotation_Test { RestMethod a2 = RestMethodAnnotation.create() .clientVersion("clientVersion") .consumes("consumes") + .context(RestMethodContext.class) .converters(RestConverter.class) .debug("debug") .defaultAccept("defaultAccept") @@ -103,6 +105,7 @@ public class RestMethodAnnotation_Test { + "{" + "clientVersion:'clientVersion'," + "consumes:['consumes']," + + "context:'org.apache.juneau.rest.RestMethodContext'," + "converters:['org.apache.juneau.rest.RestConverter']," + "debug:'debug'," + "defaultAccept:'defaultAccept'," @@ -178,6 +181,7 @@ public class RestMethodAnnotation_Test { @RestMethod( clientVersion="clientVersion", consumes="consumes", + context=RestMethodContext.class, converters=RestConverter.class, debug="debug", defaultAccept="defaultAccept", @@ -212,6 +216,7 @@ public class RestMethodAnnotation_Test { @RestMethod( clientVersion="clientVersion", consumes="consumes", + context=RestMethodContext.class, converters=RestConverter.class, debug="debug", defaultAccept="defaultAccept", diff --git a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Rest_Context_Test.java b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Rest_Context_Test.java index e09b6ce..cba61b1 100644 --- a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Rest_Context_Test.java +++ b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/Rest_Context_Test.java @@ -91,7 +91,7 @@ public class Rest_Context_Test { @Test public void a05_invalidConstructor() throws Exception { - assertThrown(()->client(A5.class)).contains("Invalid class specified for REST_context"); + assertThrown(()->client(A5.class)).contains("Could not create instance"); } //-- 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 4863d2
[juneau] branch master updated: REST refactoring.
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 bc3b4dd REST refactoring. bc3b4dd is described below commit bc3b4dde6f66aa12fd403ac0c0cd8cf45bd32235 Author: JamesBognar AuthorDate: Thu Jan 21 15:32:56 2021 -0500 REST refactoring. --- .../src/main/java/org/apache/juneau/Context.java | 2 +- .../juneau/rest/RestContext_ThreadLocals_Test.java | 10 +- .../java/org/apache/juneau/rest/RestContext.java | 228 ++--- .../org/apache/juneau/rest/RestMethodContext.java | 34 +-- .../juneau/rest/RestMethodContextBuilder.java | 21 +- .../java/org/apache/juneau/rest/RestMethods.java | 104 ++ .../org/apache/juneau/rest/RestMethodsBuilder.java | 61 ++ .../apache/juneau/rest/RrpcRestMethodContext.java | 92 + 8 files changed, 356 insertions(+), 196 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java index e5fcb75..d86e6b1 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java @@ -931,7 +931,7 @@ public abstract class Context { return new DefaultFilteringOMap() .a("Context", new DefaultFilteringOMap() .a("identityCode", identityCode) - .a("propertyStore", propertyStore) + .a("propertyStore", System.identityHashCode(propertyStore)) ); } } diff --git a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestContext_ThreadLocals_Test.java b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestContext_ThreadLocals_Test.java index 7d6bd0f..3e815ef 100644 --- a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestContext_ThreadLocals_Test.java +++ b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestContext_ThreadLocals_Test.java @@ -12,7 +12,7 @@ // *** package org.apache.juneau.rest; -import static org.junit.Assert.*; +import static org.apache.juneau.assertions.Assertions.*; import static org.junit.runners.MethodSorters.*; import org.apache.juneau.rest.annotation.*; @@ -36,8 +36,8 @@ public class RestContext_ThreadLocals_Test { @RestHook(HookEvent.END_CALL) public void assertThreadsNotSet() { - assertNull(getRequest()); - assertNull(getResponse()); + assertThrown(()->getRequest()).contains("No active request on current thread."); + assertThrown(()->getResponse()).contains("No active request on current thread."); } } static MockRestClient a = MockRestClient.build(A.class); @@ -62,8 +62,8 @@ public class RestContext_ThreadLocals_Test { public static class B extends BasicRestServletGroup { @RestHook(HookEvent.END_CALL) public void assertThreadsNotSet2() { - assertNull(getRequest()); - assertNull(getResponse()); + assertThrown(()->getRequest()).contains("No active request on current thread."); + assertThrown(()->getResponse()).contains("No active request on current thread."); } } static MockRestClient b = MockRestClient.build(B.class); 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 5f0cef5..4863d25 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 @@ -17,7 +17,6 @@ import static org.apache.juneau.internal.CollectionUtils.*; import static org.apache.juneau.internal.ObjectUtils.*; import static org.apache.juneau.internal.IOUtils.*; import static org.apache.juneau.internal.StringUtils.*; -import static org.apache.juneau.rest.util.RestUtils.*; import static org.apache.juneau.rest.HttpRuntimeException.*; import static org.apache.juneau.Enablement.*; import static java.util.Collections.*; @@ -64,7 +63,6 @@ import org.apache.juneau.rest.converters.*; import org.apache.juneau.rest.logging.*; import org.apache.juneau.rest.params.*;
[juneau] branch master updated: REST refactoring.
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 3340749 REST refactoring. 3340749 is described below commit 334074991df5d7adf993d54e2732fee77ea186a4 Author: JamesBognar AuthorDate: Thu Jan 21 09:50:48 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/cp/Messages_Test.java | 2 +- .../java/org/apache/juneau/cp/MessagesBuilder.java | 12 + .../java/org/apache/juneau/rest/RestContext.java | 58 -- .../org/apache/juneau/rest/annotation/Rest.java| 20 4 files changed, 76 insertions(+), 16 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/Messages_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/Messages_Test.java index 4e4d49e..df86893 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/Messages_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/Messages_Test.java @@ -75,7 +75,7 @@ public class Messages_Test { assertString(x1.forLocale(CHINA).getString("file")).is("MessageBundleTest1.properties"); assertString(x1.forLocale((Locale)null).getString("file")).is("MessageBundleTest1.properties"); - Messages x2 = Messages.create(MessageBundleTest1.class).locale(null).build(); + Messages x2 = Messages.create(MessageBundleTest1.class).locale((Locale)null).build(); assertString(x2.getString("file")).is("MessageBundleTest1.properties"); assertString(x2.forLocale(JAPANESE).getString("file")).is("MessageBundleTest1_ja.properties"); assertString(x2.forLocale(JAPAN).getString("file")).is("MessageBundleTest1_ja_JP.properties"); diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/MessagesBuilder.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/MessagesBuilder.java index 9f698a2..67db127 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/MessagesBuilder.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/MessagesBuilder.java @@ -94,6 +94,18 @@ public class MessagesBuilder { } /** +* Specifies the locale. +* +* @param locale +* The locale. +* If null, the default locale is used. +* @return This object (for method chaining). +*/ + public MessagesBuilder locale(String locale) { + return locale(locale == null ? null : Locale.forLanguageTag(locale)); + } + + /** * Creates a new {@link Messages} based on the setting of this builder. * * @return A new {@link Messages} object. 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 7579c7f..5f0cef5 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 @@ -52,6 +52,7 @@ import org.apache.juneau.httppart.*; import org.apache.juneau.httppart.bean.*; import org.apache.juneau.json.*; import org.apache.juneau.jsonschema.*; +import org.apache.juneau.marshall.*; import org.apache.juneau.msgpack.*; import org.apache.juneau.mstat.*; import org.apache.juneau.oapi.*; @@ -3345,29 +3346,25 @@ public class RestContext extends BeanContext { consumes = getListProperty(REST_consumes, MediaType.class, parsers.getSupportedMediaTypes()); produces = getListProperty(REST_produces, MediaType.class, serializers.getSupportedMediaTypes()); - Tuple2,String>[] mbl = getInstanceArrayProperty(REST_messages, Tuple2.class); - Messages msgs = null; - for (int i = mbl.length-1; i >= 0; i--) - msgs = Messages.create(firstNonNull(mbl[i].getA(), rci.inner())).name(mbl[i].getB()).parent(msgs).build(); - this.msgs = msgs; + msgs = createMessages(r); - this.fullPath = (builder.parentContext == null ? "" : (builder.parentContext.fullPath + '/')) + builder.getPath(); + fullPath = (builder.parentContext == null ? "" : (builder.parentContext.fullPath + '/')) + builder.getPath(); String p = builder.getPath(); if (! p.endsWith("/*"))
[juneau] branch master updated: REST refactoring.
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 7c4b579 REST refactoring. 7c4b579 is described below commit 7c4b57901818dc4d9d6589253fdc9e345e0ecfdb Author: JamesBognar AuthorDate: Sat Jan 16 15:45:23 2021 -0500 REST refactoring. --- .../main/java/org/apache/juneau/rest/RestCall.java | 41 -- .../java/org/apache/juneau/rest/RestContext.java | 21 +-- 2 files changed, 25 insertions(+), 37 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCall.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCall.java index 43d2249..2893ab9 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCall.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCall.java @@ -58,7 +58,11 @@ public class RestCall { * @param res The incoming HTTP servlet response object. */ public RestCall(Object resource, RestContext context, HttpServletRequest req, HttpServletResponse res) { - resource(resource).context(context).request(req).response(res); + this.context = context; + this.resource = resource; + beanFactory = new BeanFactory(context.rootBeanFactory, resource); + beanFactory.addBean(RestContext.class, context); + request(req).response(res); } //-- @@ -103,19 +107,6 @@ public class RestCall { } /** -* Overrides the context object on this call. -* -* @param value The context that's creating this call. -* @return This object (for method chaining). -*/ - public RestCall context(RestContext value) { - context = value; - beanFactory = new BeanFactory(value.rootBeanFactory, value.getResource()); - beanFactory.addBean(RestContext.class, value); - return this; - } - - /** * Sets the method context on this call. * * Used for logging statistics on the method. @@ -294,18 +285,9 @@ public class RestCall { * @throws InternalServerError If the RestRequest object has not yet been created on this call. */ public RestRequest getRestRequest() { - return getRestRequestOptional().orElseThrow(()->new InternalServerError("RestRequest object has not yet been created.")); + return Optional.ofNullable(rreq).orElseThrow(()->new InternalServerError("RestRequest object has not yet been created.")); } - /** -* Returns the REST request of this REST call. -* -* @return the REST request of this REST call. -* @throws InternalServerError If the RestRequest object has not yet been created on this call. -*/ - public Optional getRestRequestOptional() { - return Optional.ofNullable(rreq); - } /** * Returns the REST response of this REST call. @@ -313,16 +295,7 @@ public class RestCall { * @return the REST response of this REST call. */ public RestResponse getRestResponse() { - return getRestResponseOptional().orElseThrow(()->new InternalServerError("RestResponse object has not yet been created.")); - } - - /** -* Returns the REST response of this REST call. -* -* @return the REST response of this REST call. -*/ - public Optional getRestResponseOptional() { - return Optional.ofNullable(rres); + return Optional.ofNullable(rres).orElseThrow(()->new InternalServerError("RestResponse object has not yet been created.")); } /** 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 e0d5ea6..8e44a99 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 @@ -4831,6 +4831,7 @@ public class RestContext extends BeanContext { * The resource object. * Never null. */ + @BeanIgnore public Object getResource() { return resource.get(); } @@ -5845,9 +5846,9 @@ public class RestContext extends BeanContext { * * @return The HTTP request object, or null if it hasn't been created. */ +
[juneau] branch master updated: REST refactoring.
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 5fcefe7 REST refactoring. 5fcefe7 is described below commit 5fcefe76d4e08d546a1d2f747b04958f883a3d4b Author: JamesBognar AuthorDate: Sat Jan 16 14:54:53 2021 -0500 REST refactoring. --- .../apache/juneau/rest/RestMethod_Params_Test.java | 4 +- .../main/java/org/apache/juneau/rest/RestCall.java | 25 ++- .../java/org/apache/juneau/rest/RestContext.java | 149 - .../org/apache/juneau/rest/RestMethodContext.java | 4 +- .../org/apache/juneau/rest/RestMethodInvoker.java | 66 .../org/apache/juneau/rest/RestMethodParam.java| 19 +-- .../org/apache/juneau/rest/RestParamDefaults.java | 182 +++-- 7 files changed, 260 insertions(+), 189 deletions(-) diff --git a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestMethod_Params_Test.java b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestMethod_Params_Test.java index 3e597b9..5a86bf2 100644 --- a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestMethod_Params_Test.java +++ b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestMethod_Params_Test.java @@ -381,8 +381,8 @@ public class RestMethod_Params_Test { super(RestParamType.HEADER, "Custom", B2b.class); } @Override - public Object resolve(RestRequest req, RestResponse res) throws Exception { - return new B2b(req.getHeader("Custom")); + public Object resolve(RestCall call) throws Exception { + return new B2b(call.getRestRequest().getHeader("Custom")); } } diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCall.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCall.java index 79ab9c3..43d2249 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCall.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCall.java @@ -19,6 +19,7 @@ import java.util.*; import javax.servlet.http.*; import org.apache.juneau.cp.*; +import org.apache.juneau.http.exception.*; import org.apache.juneau.httppart.bean.*; import org.apache.juneau.rest.logging.*; import org.apache.juneau.rest.util.*; @@ -290,9 +291,20 @@ public class RestCall { * Returns the REST request of this REST call. * * @return the REST request of this REST call. +* @throws InternalServerError If the RestRequest object has not yet been created on this call. */ public RestRequest getRestRequest() { - return rreq; + return getRestRequestOptional().orElseThrow(()->new InternalServerError("RestRequest object has not yet been created.")); + } + + /** +* Returns the REST request of this REST call. +* +* @return the REST request of this REST call. +* @throws InternalServerError If the RestRequest object has not yet been created on this call. +*/ + public Optional getRestRequestOptional() { + return Optional.ofNullable(rreq); } /** @@ -301,7 +313,16 @@ public class RestCall { * @return the REST response of this REST call. */ public RestResponse getRestResponse() { - return rres; + return getRestResponseOptional().orElseThrow(()->new InternalServerError("RestResponse object has not yet been created.")); + } + + /** +* Returns the REST response of this REST call. +* +* @return the REST response of this REST call. +*/ + public Optional getRestResponseOptional() { + return Optional.ofNullable(rres); } /** 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 34f9280..e0d5ea6 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 @@ -3214,14 +3214,13 @@ public class RestContext extends BeanContext { private final MethodInvoker[] postInitMethods, postInitChildFirstMethods, - preCallMethods, - postCallMethods, startCallMethods, endCallMethods, destroyMethods; - private final RestMethodParam[][] - p
[juneau] branch master updated: Code cleanup.
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 92d656d Code cleanup. 92d656d is described below commit 92d656d07929585f5b6a75dee2d81e6452af50d4 Author: JamesBognar AuthorDate: Fri Jan 15 19:24:17 2021 -0500 Code cleanup. --- .../jena/annotation/RdfConfigAnnotation.java | 104 ++--- .../main/java/org/apache/juneau/ConfigApply.java | 17 +-- .../juneau/annotation/BeanConfigAnnotation.java| 127 - .../html/annotation/HtmlConfigAnnotation.java | 19 ++- .../html/annotation/HtmlDocConfigAnnotation.java | 49 +++- .../json/annotation/JsonConfigAnnotation.java | 12 +- .../annotation/JsonSchemaConfigAnnotation.java | 22 ++-- .../annotation/MsgPackConfigAnnotation.java| 3 +- .../oapi/annotation/OpenApiConfigAnnotation.java | 6 +- .../parser/annotation/ParserConfigAnnotation.java | 28 ++--- .../annotation/SerializerConfigAnnotation.java | 59 -- .../soap/annotation/SoapXmlConfigAnnotation.java | 3 +- .../juneau/uon/annotation/UonConfigAnnotation.java | 15 +-- .../juneau/xml/annotation/XmlConfigAnnotation.java | 33 ++ .../juneau/rest/annotation/RestAnnotation.java | 46 +--- .../rest/annotation/RestMethodAnnotation.java | 40 ++- 16 files changed, 183 insertions(+), 400 deletions(-) diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigAnnotation.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigAnnotation.java index 8b3e888..ecd802a 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigAnnotation.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfConfigAnnotation.java @@ -43,76 +43,40 @@ public class RdfConfigAnnotation { @Override public void apply(AnnotationInfo ai, PropertyStoreBuilder psb, VarResolverSession vr) { RdfConfig a = ai.getAnnotation(); - if (! a.language().isEmpty()) - psb.set(RDF_language, string(a.language())); - if (! a.juneauNs().isEmpty()) - psb.set(RDF_juneauNs, string(a.juneauNs())); - if (! a.juneauBpNs().isEmpty()) - psb.set(RDF_juneauBpNs, string(a.juneauBpNs())); - if (! a.disableUseXmlNamespaces().isEmpty()) - psb.set(RDF_disableUseXmlNamespaces, bool(a.disableUseXmlNamespaces())); - if (! a.arp_iriRules().isEmpty()) - psb.set(RDF_arp_iriRules, string(a.arp_iriRules())); - if (! a.arp_errorMode().isEmpty()) - psb.set(RDF_arp_errorMode, string(a.arp_errorMode())); - if (! a.arp_embedding().isEmpty()) - psb.set(RDF_arp_embedding, bool(a.arp_embedding())); - if (! a.rdfxml_xmlBase().isEmpty()) - psb.set(RDF_rdfxml_xmlBase, string(a.rdfxml_xmlBase())); - if (! a.rdfxml_longId().isEmpty()) - psb.set(RDF_rdfxml_longId, bool(a.rdfxml_longId())); - if (! a.rdfxml_allowBadUris().isEmpty()) - psb.set(RDF_rdfxml_allowBadUris, bool(a.rdfxml_allowBadUris())); - if (! a.rdfxml_relativeUris().isEmpty()) - psb.set(RDF_rdfxml_relativeUris, string(a.rdfxml_relativeUris())); - if (! a.rdfxml_showXmlDeclaration().isEmpty()) - psb.set(RDF_rdfxml_showXmlDeclaration, string(a.rdfxml_showXmlDeclaration())); - if (! a.rdfxml_disableShowDoctypeDeclaration().isEmpty()) - psb.set(RDF_rdfxml_disableShowDoctypeDeclaration, bool(a.rdfxml_disableShowDoctypeDeclaration())); - if (! a.rdfxml_tab().isEmpty()) - psb.set(RDF_rdfxml_tab, integer(a.rdfxml_tab(), "rdfxml_tab")); - if (! a.rdfxml_attributeQuoteChar().isEmpty()) - psb.set(RDF_rdfxml_attributeQuoteChar, string(a.rdfxml_attributeQuoteChar())); - if (! a.rdfxml_blockRules().isEmpty()) - psb.set(RDF_rdfxml_blockRules, string(a.rdfxml_blockRules())); - if (! a.n3_minGap().isEmpty()) - psb.set(RDF_n3_minGap, integer(a.n3_minGap(),
[juneau] branch master updated: REST refactoring.
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 576597a REST refactoring. 576597a is described below commit 576597ad03d343e34c12596ce39e31c61575b332 Author: JamesBognar AuthorDate: Wed Jan 13 16:41:29 2021 -0500 REST refactoring. --- .../org/apache/juneau/cp/BeanFactory_Test.java | 85 -- .../apache/juneau/cp/BeanCreateMethodFinder.java | 135 + .../java/org/apache/juneau/cp/BeanFactory.java | 65 ++-- .../org/apache/juneau/internal/ObjectUtils.java| 4 +- .../org/apache/juneau/rest/RequestFormData.java| 24 +- .../org/apache/juneau/rest/RequestHeaders.java | 25 +- .../java/org/apache/juneau/rest/RequestQuery.java | 25 +- .../java/org/apache/juneau/rest/RestContext.java | 217 +++--- .../org/apache/juneau/rest/RestContextBuilder.java | 7 +- .../org/apache/juneau/rest/RestMethodContext.java | 329 +++-- .../java/org/apache/juneau/rest/RestRequest.java | 8 +- 11 files changed, 736 insertions(+), 188 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java index 3e09892..1ddd4a7 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java @@ -351,36 +351,65 @@ public class BeanFactory_Test { } @Test - public void e01_createBeanViaMethod_noArgs() throws Exception { - BeanFactory bf = new BeanFactory(); + public void e01_beanCreateMethodFinder() throws Exception { + BeanFactory bf = BeanFactory.create(); E1 x = new E1(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA0", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA1", null)).exists(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA2", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA3", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA4", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA5", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA6", null)).doesNotExist(); - assertThrown(()->bf.createBeanViaMethod(E.class, x, "createA7", null)).contains("foo"); - - assertObject(bf.createBeanViaMethod(E.class, x, "createB0", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB1", null)).exists(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB2", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB3", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB4", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB5", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB6", null)).doesNotExist(); - assertThrown(()->bf.createBeanViaMethod(E.class, x, "createB7", null)).contains("foo"); - - assertObject(bf.createBeanViaMethod(E.class, x, "createC1", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createC2", null)).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createC3", null)).exists(); - assertObject(bf.createBeanViaMethod(E.class, x, "createC3", null).a).doesNotExist(); + assertObject(bf.beanCreateMethodFinder(E.class, x).find("createA0").run()).doesNotExist(); + assertObject(bf.beanCreateMethodFinder(E.class, x).find("createA1").run()).exists(); + assertObject(bf.beanCreateMethodFinder(E.class, x).find("createA2").run()).doesNotExist(); + assertObject(bf.beanCreateMethodFinder(E.class, x).find("createA3").run()).doesNotExist(); + assertObject(bf.beanCreateMethodFinder(E.class, x).find("createA4").run()).doesNotExist(); + assertObject(bf.beanCreateMethodFinder(E.class, x).find("createA5").run()).doesNotExist(); + assertObject(bf.beanCreateMethodFinder(E.class, x).find(
[juneau] branch master updated: REST refactoring.
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 d813408 REST refactoring. d813408 is described below commit d813408fb20e4f41b1e4d44688b7aca770bf5bd2 Author: JamesBognar AuthorDate: Wed Jan 13 09:06:33 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/RestContext.java | 2 - .../org/apache/juneau/rest/RestMethodContext.java | 119 +++-- 2 files changed, 87 insertions(+), 34 deletions(-) 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 0b29710..621f508 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 @@ -2743,7 +2743,6 @@ public class RestContext extends BeanContext { * This affects the returned values from the following: * * {@link RestContext#getProduces() RestContext.getProduces()} -* {@link RestRequest#getProduces()} * {@link RestInfoProvider#getSwagger(RestRequest)} - Affects produces field. * */ @@ -2809,7 +2808,6 @@ public class RestContext extends BeanContext { * This affects the returned values from the following: * * {@link RestContext#getConsumes() RestContext.getConsumes()} -* {@link RestRequest#getConsumes()} * {@link RestInfoProvider#getSwagger(RestRequest)} - Affects consumes field. * */ diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java index a50bca3..ab1b125 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java @@ -589,6 +589,18 @@ public class RestMethodContext extends BeanContext implements Comparable x.required()).toArray(RestMatcher[]::new); optionalMatchers = matchers.stream().filter(x -> ! x.required()).toArray(RestMatcher[]::new); + pathMatchers = createPathMatchers(r, beanFactory, b.dotAll); + beanFactory.addBean(UrlPathMatcher[].class, pathMatchers); + + encoders = createEncoders(r, beanFactory); + beanFactory.addBean(EncoderGroup.class, encoders); + + jsonSchemaGenerator = createJsonSchemaGenerator(r, beanFactory, ps); + beanFactory.addBean(JsonSchemaGenerator.class, jsonSchemaGenerator); + + supportedAcceptTypes = getListProperty(REST_produces, MediaType.class, serializers.getSupportedMediaTypes()); + supportedContentTypes = getListProperty(REST_consumes, MediaType.class, parsers.getSupportedMediaTypes()); + int _hierarchyDepth = 0; Class sc = b.method.getDeclaringClass().getSuperclass(); while (sc != null) { @@ -610,30 +622,7 @@ public class RestMethodContext extends BeanContext implements Comparable _pathMatchers = new ArrayList<>(); - for (String p : getArrayProperty(RESTMETHOD_paths, String.class)) { - if (dotAll && ! p.endsWith("/*")) - p += "/*"; - _pathMatchers.add(UrlPathMatcher.of(p)); - } - if (_pathMatchers.isEmpty()) { - String p = HttpUtils.detectHttpPath(method, true); - if (dotAll && ! p.endsWith("/*")) - p += "/*"; - _pathMatchers.add(UrlPathMatcher.of(p)); - } - pathMatchers = _pathMatchers.toArray(new UrlPathMatcher[_pathMatchers.size()]); - - methodParams = context.findParams(mi, false, this.pathMatchers[this.pathMatchers.length-1]); - - this.encoders = EncoderGroup - .create() - .append(IdentityEncoder.INSTANCE) - .append(createEncoders(r, beanFactory)) - .build(); - - this.jsonSchemaGenerator = JsonSchemaGenerator.create().apply(ps).build(); + methodParams = context.findParams(mi, false, pathMat
[juneau] branch master updated: REST refactoring.
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 bf1735c REST refactoring. bf1735c is described below commit bf1735c5501db69449b6cf5ef3caef26a61a5a1f Author: JamesBognar AuthorDate: Tue Jan 12 19:20:07 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/RestContext.java | 84 +++- .../org/apache/juneau/rest/RestMethodContext.java | 110 + 2 files changed, 83 insertions(+), 111 deletions(-) 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 4d2936f..0b29710 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 @@ -4011,30 +4011,26 @@ public class RestContext extends BeanContext { * @seealso #REST_serializers */ protected SerializerGroup createSerializers(Object resource, BeanFactory beanFactory, PropertyStore ps) throws Exception { - Object x = getArrayProperty(REST_serializers, Object.class); - if (x == null) - x = beanFactory.createBeanViaMethod(Serializer[].class, resource, "createSerializers", null); - if (x == null) - x = beanFactory.createBeanViaMethod(Class[].class, resource, "createSerializers", null); - if (x == null) { - x = beanFactory.createBeanViaMethod(SerializerGroup.class, resource, "createSerializers", null); - if (x != null) - return (SerializerGroup)x; - } - if (x == null) - x = beanFactory.getBean(Serializer[].class).orElse(null); - if (x == null) { - x = beanFactory.getBean(SerializerGroup.class).orElse(null); - if (x != null) - return (SerializerGroup)x; + SerializerGroup g = beanFactory.getBean(SerializerGroup.class).orElse(null); + + if (g == null) { + Object[] x = getArrayProperty(REST_serializers, Object.class); + if (x == null) + x = beanFactory.getBean(Serializer[].class).orElse(null); + if (x == null) + x = new Serializer[0]; + g = SerializerGroup + .create() + .append(x) + .apply(ps) + .build(); } - if (x == null) - x = new Serializer[0]; - return SerializerGroup - .create() - .append((Object[])x) - .apply(ps) - .build(); + + g = BeanFactory.of(beanFactory, resource) + .addBean(SerializerGroup.class, g) + .createBeanViaMethod(SerializerGroup.class, resource, "createSerializers", g); + + return g; } /** @@ -4067,30 +4063,26 @@ public class RestContext extends BeanContext { * @seealso #REST_parsers */ protected ParserGroup createParsers(Object resource, BeanFactory beanFactory, PropertyStore ps) throws Exception { - Object x = getArrayProperty(REST_parsers, Object.class); - if (x == null) - x = beanFactory.createBeanViaMethod(Parser[].class, resource, "createParsers", null); - if (x == null) - x = beanFactory.createBeanViaMethod(Class[].class, resource, "createParsers", null); - if (x == null) { - x = beanFactory.createBeanViaMethod(ParserGroup.class, resource, "createParsers", null); - if (x != null) - return (ParserGroup)x; - } - if (x == null) - x = beanFactory.getBean(Parser[].class).orElse(null); - if (x == null) { - x = beanFactory.getBean(ParserGroup.class).orElse(null); - if (x != null) - return (ParserGroup)x; + ParserGroup g = beanFactory.getBean(ParserGroup.class).orElse(null); + + if (g == null) { + Object[] x = getArrayProperty(REST_parsers, Object.class); + if (x == null) +
[juneau] branch master updated: REST refactoring.
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 3e0472c REST refactoring. 3e0472c is described below commit 3e0472c5f32922ce74e2cf2bdf9c30f545b31480 Author: JamesBognar AuthorDate: Tue Jan 12 18:57:01 2021 -0500 REST refactoring. --- .../org/apache/juneau/cp/BeanFactory_Test.java | 52 ++-- .../java/org/apache/juneau/cp/BeanFactory.java | 25 +- .../java/org/apache/juneau/rest/RestContext.java | 93 -- .../org/apache/juneau/rest/RestContextBuilder.java | 2 +- .../org/apache/juneau/rest/RestMethodContext.java | 70 +--- 5 files changed, 143 insertions(+), 99 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java index 4368671..3e09892 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java @@ -355,32 +355,32 @@ public class BeanFactory_Test { BeanFactory bf = new BeanFactory(); E1 x = new E1(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA0")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA1")).exists(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA2")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA3")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA4")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA5")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createA6")).doesNotExist(); - assertThrown(()->bf.createBeanViaMethod(E.class, x, "createA7")).contains("foo"); - - assertObject(bf.createBeanViaMethod(E.class, x, "createB0")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB1")).exists(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB2")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB3")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB4")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB5")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createB6")).doesNotExist(); - assertThrown(()->bf.createBeanViaMethod(E.class, x, "createB7")).contains("foo"); - - assertObject(bf.createBeanViaMethod(E.class, x, "createC1")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createC2")).doesNotExist(); - assertObject(bf.createBeanViaMethod(E.class, x, "createC3")).exists(); - assertObject(bf.createBeanViaMethod(E.class, x, "createC3").a).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createA0", null)).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createA1", null)).exists(); + assertObject(bf.createBeanViaMethod(E.class, x, "createA2", null)).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createA3", null)).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createA4", null)).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createA5", null)).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createA6", null)).doesNotExist(); + assertThrown(()->bf.createBeanViaMethod(E.class, x, "createA7", null)).contains("foo"); + + assertObject(bf.createBeanViaMethod(E.class, x, "createB0", null)).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createB1", null)).exists(); + assertObject(bf.createBeanViaMethod(E.class, x, "createB2", null)).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createB3", null)).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createB4", null)).doesNotExist(); + assertObject(bf.cr
[juneau] branch master updated: REST refactoring.
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 8b73403 REST refactoring. 8b73403 is described below commit 8b73403ca9be868f14c5d06049f2e1596a935c25 Author: JamesBognar AuthorDate: Tue Jan 12 18:13:55 2021 -0500 REST refactoring. --- .../apache/juneau/rest/ClientVersionMatcher.java | 2 +- .../java/org/apache/juneau/rest/RestMatcher.java | 2 +- .../org/apache/juneau/rest/RestMethodContext.java | 94 +++--- 3 files changed, 48 insertions(+), 50 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/ClientVersionMatcher.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/ClientVersionMatcher.java index 0708e52..0b7f8e9 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/ClientVersionMatcher.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/ClientVersionMatcher.java @@ -50,7 +50,7 @@ public class ClientVersionMatcher extends RestMatcher { } @Override /* RestMatcher */ - public boolean mustMatch() { + public boolean required() { return true; } } diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMatcher.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMatcher.java index a47b9d6..caf0e72 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMatcher.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMatcher.java @@ -85,7 +85,7 @@ public abstract class RestMatcher { * * @return true if this matcher is required to match in order for the method to be invoked. */ - public boolean mustMatch() { + public boolean required() { return false; } } diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java index d8d0e22..77218e8 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java @@ -562,14 +562,6 @@ public class RestMethodContext extends BeanContext implements Comparable sc = b.method.getDeclaringClass().getSuperclass(); - while (sc != null) { - _hierarchyDepth++; - sc = sc.getSuperclass(); - } - hierarchyDepth = _hierarchyDepth; - beanFactory = new BeanFactory(context.getBeanFactory(), r) .addBean(RestMethodContext.class, this) .addBean(Method.class, method); @@ -587,6 +579,24 @@ public class RestMethodContext extends BeanContext implements Comparable matchers = Arrays.asList(createMatchers(r, beanFactory)); + requiredMatchers = matchers.stream().filter(x -> x.required()).toArray(RestMatcher[]::new); + optionalMatchers = matchers.stream().filter(x -> ! x.required()).toArray(RestMatcher[]::new); + + int _hierarchyDepth = 0; + Class sc = b.method.getDeclaringClass().getSuperclass(); + while (sc != null) { + _hierarchyDepth++; + sc = sc.getSuperclass(); + } + hierarchyDepth = _hierarchyDepth; + String _httpMethod = getProperty(RESTMETHOD_httpMethod, String.class, null); if (_httpMethod == null) _httpMethod = HttpUtils.detectHttpMethod(method, true, "GET"); @@ -598,56 +608,24 @@ public class RestMethodContext extends BeanContext implements Comparable pathMatchers = new ArrayList<>(); + List _pathMatchers = new ArrayList<>(); for (String p : getArrayProperty(RESTMETHOD_paths, String.class)) { if (dotAll && ! p.endsWith("/*")) p += "/*"; - pathMatchers.add(UrlPathMatcher.of(p)); + _pathMatchers.add(UrlPathMatcher.of(p)); } - if (pathMatchers.isEmpty()) { + if (_pathMatchers.isEmpty()) { String p = HttpUtils.detectHttpPath(method, true); if (dotAll &&am
[juneau] branch master updated: REST refactoring.
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 a1a7e7a REST refactoring. a1a7e7a is described below commit a1a7e7a9317883b1834178d9ef67cfdbacf4f8f3 Author: JamesBognar AuthorDate: Tue Jan 12 17:51:15 2021 -0500 REST refactoring. --- .../apache/juneau/reflection/ClassInfoTest.java| 22 +++- .../juneau/reflection/ConstructorInfoTest.java | 4 +- .../apache/juneau/reflection/MethodInfoTest.java | 4 +- .../src/main/java/org/apache/juneau/ClassMeta.java | 4 - .../java/org/apache/juneau/cp/BeanFactory.java | 14 +-- .../juneau/httppart/bean/ResponseBeanMeta.java | 8 +- .../java/org/apache/juneau/reflect/ClassInfo.java | 119 - .../org/apache/juneau/reflect/ConstructorInfo.java | 12 +-- .../org/apache/juneau/reflect/ExecutableInfo.java | 10 +- .../java/org/apache/juneau/reflect/MethodInfo.java | 33 ++ .../java/org/apache/juneau/reflect/ParamInfo.java | 9 +- .../rest/client/remote/RemoteMethodMeta.java | 2 +- .../rest/client/remote/RemoteMethodReturn.java | 3 +- .../apache/juneau/rest/BasicRestInfoProvider.java | 2 +- .../java/org/apache/juneau/rest/RestContext.java | 2 +- .../org/apache/juneau/rest/RestContextBuilder.java | 2 +- .../juneau/rest/RestMethodContextBuilder.java | 2 +- .../org/apache/juneau/rest/SwaggerGenerator.java | 6 +- 18 files changed, 109 insertions(+), 149 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java index 6ea45e4..4ac6204 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java @@ -174,10 +174,28 @@ public class ClassInfoTest { @Test public void resolved() { - check("A1", of(A1.class).resolved()); - check("A1", of(A2.class).resolved()); + check("A1", of(A1.class).unwrap(Value.class)); + check("A1", of(A2.class).unwrap(Value.class)); } + public static class A6 { + public Optional m1(Optional bar) { + return null; + } + public Value m2(Value bar) { + return null; + } + } + + @Test + public void resolvedParams() { + MethodInfo mi = ClassInfo.of(A6.class).getPublicMethod("m1", Optional.class); + check("A1", mi.getParamType(0).unwrap(Optional.class)); + check("A1", mi.getReturnType().unwrap(Optional.class)); + mi = ClassInfo.of(A6.class).getPublicMethod("m2", Value.class); + check("A1", mi.getParamType(0).unwrap(Value.class)); + check("A1", mi.getReturnType().unwrap(Value.class)); + } //- // Parent classes and interfaces. diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ConstructorInfoTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ConstructorInfoTest.java index 7035dab..fa4b8bd 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ConstructorInfoTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ConstructorInfoTest.java @@ -69,7 +69,7 @@ public class ConstructorInfoTest { @Test public void of_withDeclaringClass() throws Exception { - check("A()", ConstructorInfo.of(ClassInfo.of(A.class), a.inner(), null)); + check("A()", ConstructorInfo.of(ClassInfo.of(A.class), a.inner())); } @Test @@ -85,7 +85,7 @@ public class ConstructorInfoTest { @Test public void of_null() throws Exception { check(null, ConstructorInfo.of(null)); - check(null, ConstructorInfo.of(null, null, null)); + check(null, ConstructorInfo.of(null, null)); } //- diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/MethodInfoTest.java index 4b8d304..0a39904 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apac
[juneau] branch master updated: REST refactoring.
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 bf26eca REST refactoring. bf26eca is described below commit bf26eca3dfa5ff05af283af7181a5d76615e83d0 Author: JamesBognar AuthorDate: Tue Jan 12 16:24:29 2021 -0500 REST refactoring. --- .../org/apache/juneau/cp/BeanFactory_Test.java | 16 - .../src/main/java/org/apache/juneau/Value.java | 10 +++ .../java/org/apache/juneau/cp/BeanFactory.java | 73 -- .../org/apache/juneau/internal/ObjectUtils.java| 14 + .../java/org/apache/juneau/reflect/ClassInfo.java | 35 ++- .../juneau/examples/rest/springboot/App.java | 44 - .../rest/springboot/HelloWorldMessageProvider.java | 29 + .../rest/springboot}/HelloWorldResource.java | 64 --- .../examples/rest/springboot/RootResources.java| 4 -- .../microservice/springboot/template/App.java | 57 ++--- .../template/HelloWorldMessageProvider.java| 29 + .../springboot/template/HelloWorldResource.java| 58 ++--- .../springboot/template/RootResources.java | 43 ++--- .../juneau/rest/springboot/SpringBeanFactory.java | 19 +++--- .../juneau/rest/springboot/SpringRestServlet.java | 8 ++- .../java/org/apache/juneau/rest/RestContext.java | 6 +- .../org/apache/juneau/rest/RestContextBuilder.java | 5 +- .../java/org/apache/juneau/rest/RestServlet.java | 5 +- 18 files changed, 411 insertions(+), 108 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java index a094f23..4368671 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/cp/BeanFactory_Test.java @@ -15,6 +15,8 @@ package org.apache.juneau.cp; import static org.apache.juneau.assertions.Assertions.*; import static org.junit.runners.MethodSorters.*; +import java.util.*; + import org.apache.juneau.annotation.*; import org.junit.*; @@ -279,7 +281,9 @@ public class BeanFactory_Test { // Create bean via method. //- - public static class E {} + public static class E { + public A a; + } public static class E1 { @@ -338,6 +342,12 @@ public class BeanFactory_Test { public static E createC2(A a) { return new E(); } + + public static E createC3(Optional a) { + E e = new E(); + e.a = a.orElse(null); + return e; + } } @Test @@ -365,8 +375,12 @@ public class BeanFactory_Test { assertObject(bf.createBeanViaMethod(E.class, x, "createC1")).doesNotExist(); assertObject(bf.createBeanViaMethod(E.class, x, "createC2")).doesNotExist(); + assertObject(bf.createBeanViaMethod(E.class, x, "createC3")).exists(); + assertObject(bf.createBeanViaMethod(E.class, x, "createC3").a).doesNotExist(); bf.addBean(A.class, new A()); assertObject(bf.createBeanViaMethod(E.class, x, "createC1")).exists(); assertObject(bf.createBeanViaMethod(E.class, x, "createC2")).exists(); + assertObject(bf.createBeanViaMethod(E.class, x, "createC3")).exists(); + assertObject(bf.createBeanViaMethod(E.class, x, "createC3").a).exists(); } } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Value.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Value.java index 37f3b2a..d982e9a 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Value.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Value.java @@ -27,6 +27,16 @@ import org.apache.juneau.reflect.*; public class Value { /** +* Creator. +* +* @param object The object being wrapped. +* @return A new {@link Value} object. +*/ + public static Value of(T object) { + return new Value<>(object); + } + + /** * Returns the generic parameter type of the Value parameter at the specified position. * * Example: diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp
[juneau] branch master updated: REST refactoring.
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 f29b9f2 REST refactoring. f29b9f2 is described below commit f29b9f2478087cdf9cc82295bdd063b8097c690e Author: JamesBognar AuthorDate: Tue Jan 12 10:41:24 2021 -0500 REST refactoring. --- .../org/apache/juneau/rest/mock/MockRestClient.java | 21 +++-- .../springboot/BasicSpringRestServletGroup.java | 2 -- .../java/org/apache/juneau/rest/RestContext.java| 18 ++ .../java/org/apache/juneau/rest/RestServlet.java| 21 - 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java index 7562a03..f47d9d5 100644 --- a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java +++ b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClient.java @@ -32,7 +32,6 @@ import org.apache.http.message.*; import org.apache.juneau.*; import org.apache.juneau.http.remote.*; import org.apache.juneau.parser.*; -import org.apache.juneau.reflect.*; import org.apache.juneau.rest.*; import org.apache.juneau.rest.annotation.*; import org.apache.juneau.rest.client.*; @@ -280,19 +279,13 @@ public class MockRestClient extends RestClient implements HttpClientConnection { if (! contexts.containsKey(c)) { boolean isClass = restBean instanceof Class; Object o = isClass ? ((Class)restBean).newInstance() : restBean; - RestContextBuilder rcb = RestContext.create(o).callLoggerDefault(BasicTestRestLogger.class).debugDefault(CONDITIONAL); - RestContext rc = rcb.build(); - MethodInfo mi = ClassInfo.of(o).getMethod("setContext", RestContext.class); - if (mi != null) - mi.accessible().invoke(o, rc); - if (o instanceof RestServlet) { - RestServlet rs = (RestServlet)o; - if (! rs.isInitialized()) - rc.postInit(); - } else { - rc.postInit(); - } - rc.postInitChildFirst(); + RestContext rc = RestContext + .create(o) + .callLoggerDefault(BasicTestRestLogger.class) + .debugDefault(CONDITIONAL) + .build() + .postInit() + .postInitChildFirst(); contexts.put(c, rc); } RestContext restBeanCtx = contexts.get(c); diff --git a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/BasicSpringRestServletGroup.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/BasicSpringRestServletGroup.java index 83a6361..a3ab546 100644 --- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/BasicSpringRestServletGroup.java +++ b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/BasicSpringRestServletGroup.java @@ -11,8 +11,6 @@ package org.apache.juneau.rest.springboot; // * "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. * // *** - - import static org.apache.juneau.http.HttpMethod.*; import org.apache.juneau.rest.*; 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 8a8c3d4..32cb3b7 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 @@ -29,6 +29,7 @@ import java.nio.charset.*; import java.time.*; import java.util.*; import java.util.c
[juneau] branch master updated: REST refactoring.
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 3190e0c REST refactoring. 3190e0c is described below commit 3190e0c567a0d859b757a0144debb96003284ba8 Author: JamesBognar AuthorDate: Tue Jan 12 10:12:12 2021 -0500 REST refactoring. --- .../org/apache/juneau/rest/RestMethodContext.java | 46 -- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java index a6054e9..d8d0e22 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java @@ -581,6 +581,12 @@ public class RestMethodContext extends BeanContext implements Comparable
[juneau] branch master updated: REST refactoring.
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 0fbd6e0 REST refactoring. 0fbd6e0 is described below commit 0fbd6e003746512ae234db21822271ad93d4763b Author: JamesBognar AuthorDate: Tue Jan 12 09:45:13 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/RestContext.java | 96 +--- .../org/apache/juneau/rest/RestMethodContext.java | 250 ++--- 2 files changed, 285 insertions(+), 61 deletions(-) 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 03db723..8a8c3d4 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 @@ -3278,61 +3278,59 @@ public class RestContext extends BeanContext { this.builder = builder; this.resource = builder.resource instanceof Supplier ? (Supplier)builder.resource : ()->builder.resource; - Object resource = getResource(); + Object r = getResource(); parentContext = builder.parentContext; - ClassInfo rci = ClassInfo.of(resource).resolved(); + ClassInfo rci = ClassInfo.of(r).resolved(); - rootBeanFactory = createRootBeanFactory(resource); + rootBeanFactory = createRootBeanFactory(r); - beanFactory = createBeanFactory(resource); + beanFactory = createBeanFactory(r); beanFactory.addBean(BeanFactory.class, beanFactory); PropertyStore ps = getPropertyStore(); beanFactory.addBean(PropertyStore.class, ps); - logger = createLogger(resource, beanFactory); + logger = createLogger(r, beanFactory); beanFactory.addBean(Logger.class, logger); - stackTraceStore = createStackTraceStore(resource, beanFactory); + stackTraceStore = createStackTraceStore(r, beanFactory); beanFactory.addBean(StackTraceStore.class, stackTraceStore); - varResolver = createVarResolver(resource, beanFactory); + varResolver = createVarResolver(r, beanFactory); beanFactory.addBean(VarResolver.class, varResolver); config = builder.config.resolving(varResolver.createSession()); beanFactory.addBean(Config.class, config); - responseHandlers = createResponseHandlers(resource, beanFactory); + responseHandlers = createResponseHandlers(r, beanFactory); beanFactory.addBean(ResponseHandler[].class, responseHandlers); - callLogger = createCallLogger(resource, beanFactory); + callLogger = createCallLogger(r, beanFactory); beanFactory.addBean(RestLogger.class, callLogger); - Serializer[] _serializers = createSerializers(resource, beanFactory); - beanFactory.addBean(Serializer[].class, _serializers); - serializers = SerializerGroup.create().append(_serializers).build(); + serializers = createSerializers(r, beanFactory, ps); + beanFactory.addBean(SerializerGroup.class, serializers); - Parser[] _parsers = createParsers(resource, beanFactory); - beanFactory.addBean(Parser[].class, _parsers); - parsers = ParserGroup.create().append(_parsers).build(); + parsers = createParsers(r, beanFactory, ps); + beanFactory.addBean(ParserGroup.class, parsers); - partSerializer = createPartSerializer(resource, beanFactory); + partSerializer = createPartSerializer(r, beanFactory); beanFactory.addBean(HttpPartSerializer.class, partSerializer); - partParser = createPartParser(resource, beanFactory); + partParser = createPartParser(r, beanFactory); beanFactory.addBean(HttpPartParser.class, partParser); - jsonSchemaGenerator = createJsonSchemaGenerator(resource, beanFactory); + jsonSchemaGenerator = createJsonSchemaGenerator(r, beanFactory); beanFactory.addB
[juneau] branch master updated: REST refactoring.
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 9a825aa REST refactoring. 9a825aa is described below commit 9a825aae0ff9123e5a2e839a0241f3868b78a576 Author: JamesBognar AuthorDate: Mon Jan 11 19:52:10 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/RestMethodContext.java | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java index 66bba0c..dff885d 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java @@ -24,6 +24,7 @@ import static org.apache.juneau.rest.HttpRuntimeException.*; import java.lang.annotation.*; import java.lang.reflect.*; +import java.lang.reflect.Method; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -46,7 +47,6 @@ import org.apache.juneau.jsonschema.*; import org.apache.juneau.parser.*; import org.apache.juneau.reflect.*; import org.apache.juneau.rest.annotation.*; -import org.apache.juneau.rest.annotation.Method; import org.apache.juneau.http.exception.*; import org.apache.juneau.http.remote.*; import org.apache.juneau.rest.guards.*; @@ -284,7 +284,7 @@ public class RestMethodContext extends BeanContext implements Comparable"*" * - Denotes any method. * Use this if you want to capture any HTTP methods in a single Java method. -* The {@link Method @Method} annotation and/or {@link RestRequest#getMethod()} method can be used to +* The {@link org.apache.juneau.rest.annotation.Method @Method} annotation and/or {@link RestRequest#getMethod()} method can be used to * distinguish the actual HTTP method name. * * "" @@ -519,7 +519,7 @@ public class RestMethodContext extends BeanContext implements ComparableLooks for a static or non-static createConverters() method that returns {@link RestConverter}[] on the * resource class with any of the following arguments: * -* {@link java.lang.reflect.Method} - The Java method this context belongs to. +* {@link Method} - The Java method this context belongs to. * {@link RestContext} * {@link BeanFactory} * Any {@doc RestInjection injected beans}. @@ -812,7 +812,7 @@ public class RestMethodContext extends BeanContext implements ComparableLooks for a static or non-static createGuards() method that returns {@link RestGuard}[] on the * resource class with any of the following arguments: * -* {@link java.lang.reflect.Method} - The Java method this context belongs to. +* {@link Method} - The Java method this context belongs to. * {@link RestContext} * {@link BeanFactory} * Any {@doc RestInjection injected beans}. @@ -869,7 +869,7 @@ public class RestMethodContext extends BeanContext implements ComparableLooks for a static or non-static createEncoders() method that returns {@link Encoder}[] on the * resource class with any of the following arguments: * -* {@link java.lang.reflect.Method} - The Java method this context belongs to. +* {@link Method} - The Java method this context belongs to. * {@link RestContext} * {@link BeanFactory} * Any {@doc RestInjection injected beans}.
[juneau] branch master updated: REST refactoring.
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 2b53e26 REST refactoring. 2b53e26 is described below commit 2b53e269a684a3c8b931abfb8e6213af00384884 Author: JamesBognar AuthorDate: Mon Jan 11 19:40:09 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/cp/BeanFactory.java | 5 +- .../java/org/apache/juneau/reflect/MethodInfo.java | 19 .../java/org/apache/juneau/rest/RestContext.java | 114 ++--- .../org/apache/juneau/rest/RestMethodContext.java | 29 -- 4 files changed, 97 insertions(+), 70 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java index 572d4ef..260fefc 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java @@ -173,15 +173,16 @@ public class BeanFactory { * @param c The bean type to create. * @param resource The object where the method is defined. * @param methodName The method name on the object to call. +* @param requiredParams The parameter types that must be present on the method. * @return A newly-created bean or null if method not found or it returns null. * @throws ExecutableException If bean could not be created. */ - public T createBeanViaMethod(Class c, Object resource, String methodName) throws ExecutableException { + public T createBeanViaMethod(Class c, Object resource, String methodName, Class...requiredParams) throws ExecutableException { ClassInfo ci = ClassInfo.of(resource); for (MethodInfo m : ci.getPublicMethods()) { if (m.isAll(NOT_DEPRECATED) && m.hasReturnType(c) && m.getSimpleName().equals(methodName) && (!m.hasAnnotation(BeanIgnore.class))) { List missing = getMissingParamTypes(m.getParamTypes()); - if (missing.isEmpty()) + if (missing.isEmpty() && m.hasAllArgs(requiredParams)) return m.invoke(resource, getParams(m.getParamTypes())); } } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java index c2bfe43..1822cbb 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/reflect/MethodInfo.java @@ -559,6 +559,25 @@ public final class MethodInfo extends ExecutableInfo implements Comparabletrue if this method has at least the specified parameters. +* +* +* Method may or may not have additional parameters besides those specified. +* +* @param requiredParams The parameter types to check for. +* @return true if this method has at least the specified parameters. +*/ + public boolean hasAllArgs(Class...requiredParams) { + List> rawParamTypes = getRawParamTypes(); + + for (Class c : requiredParams) + if (! rawParamTypes.contains(c)) + return false; + + return true; + } + + /** * Returns true if this method is a bridge method. * * @return true if this method is a bridge method. 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 449b06b..03db723 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 @@ -1077,7 +1077,7 @@ public class RestContext extends BeanContext { * * {@link org.apache.juneau.rest.RestContextBuilder#fileFinder(Class)} * {@link org.apache.juneau.rest.RestContextBuilder#fileFinder(FileFinder)} -* {@link org.apache.juneau.rest.RestContext#createFileFinder(BeanFactory)} +* {@link org.apache.juneau.rest.RestContext#createFileFinder(Object,BeanFactory)} * * * @@ -1096,7 +1096,7 @@ public class RestContext extends BeanContext { * * * -* The file finder is instantiated via the {
[juneau] branch master updated: REST refactoring.
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 42843cd REST refactoring. 42843cd is described below commit 42843cd6c73558806fecddc9809f17bb4c627111 Author: JamesBognar AuthorDate: Mon Jan 11 18:36:19 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/cp/BeanFactory.java | 25 +-- .../java/org/apache/juneau/rest/RestContext.java | 83 ++ 2 files changed, 58 insertions(+), 50 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java index a1b20a0..572d4ef 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java @@ -35,7 +35,7 @@ public class BeanFactory { */ public static final class Null extends BeanFactory {} - private final Map,Object> beanMap = new ConcurrentHashMap<>(); + private final Map,Supplier> beanMap = new ConcurrentHashMap<>(); private final BeanFactory parent; private final Object outer; @@ -67,9 +67,10 @@ public class BeanFactory { */ @SuppressWarnings("unchecked") public Optional getBean(Class c) { - T t = (T)beanMap.get(c); - if (t == null && parent != null) + Supplier o = beanMap.get(c); + if (o == null && parent != null) return parent.getBean(c); + T t = (T)(o == null ? null : o.get()); return Optional.ofNullable(t); } @@ -82,8 +83,22 @@ public class BeanFactory { * @return This object (for method chaining). */ public BeanFactory addBean(Class c, T t) { - if (t != null && ! c.isInstance(t)) - throw new BasicRuntimeException("Object not of type {0}: {1}", c.getName(), t.getClass().getName()); + if (t == null) + beanMap.remove(c); + else + beanMap.put(c, ()->t); + return this; + } + + /** +* Adds a bean supplier of the specified type to this factory. +* +* @param The class to associate this bean with. +* @param c The class to associate this bean with. +* @param t The bean supplier. +* @return This object (for method chaining). +*/ + public BeanFactory addBean(Class c, Supplier t) { if (t == null) beanMap.remove(c); else 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 1280168..449b06b 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 @@ -29,6 +29,7 @@ import java.nio.charset.*; import java.time.*; import java.util.*; import java.util.concurrent.*; +import java.util.function.*; import java.util.logging.*; import java.util.stream.*; @@ -3158,7 +3159,8 @@ public class RestContext extends BeanContext { // Instance //--- - private final Object resource; + private final Supplier resource; + final RestContextBuilder builder; private final boolean allowBodyParam, @@ -3274,7 +3276,10 @@ public class RestContext extends BeanContext { try { this.builder = builder; - resource = builder.resource; + + this.resource = builder.resource instanceof Supplier ? (Supplier)builder.resource : ()->builder.resource; + Object resource = getResource(); + parentContext = builder.parentContext; ClassInfo rci = ClassInfo.of(resource).resolved(); @@ -3681,6 +3686,7 @@ public class RestContext extends BeanContext { */ protected FileFinder createFileFinder(BeanFactory beanFactory) throws Exception { FileFinder x = null; + Object resource = getResource(); if (resource instanceof FileFinder) x = (FileFinder)resource; if (x == null) @@ -3726,6 +3732,7 @@ public class RestContext extends BeanContext { */ protected RestInfoPr
[juneau] branch master updated: REST refactoring.
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 5120823 REST refactoring. 5120823 is described below commit 5120823f2b47149676ac3be387b899106c072c3a Author: JamesBognar AuthorDate: Mon Jan 11 17:33:27 2021 -0500 REST refactoring. --- .../src/main/java/org/apache/juneau/rest/RestObject.java | 5 - .../src/main/java/org/apache/juneau/rest/RestServlet.java| 5 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestObject.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestObject.java index 42c2aa8..8e1764b 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestObject.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestObject.java @@ -39,7 +39,6 @@ import org.apache.juneau.rest.annotation.*; */ public abstract class RestObject { - private Logger logger = Logger.getLogger(getClass().getName()); private AtomicReference context = new AtomicReference<>(); //- @@ -139,6 +138,10 @@ public abstract class RestObject { * @param msg The message to log. */ protected void doLog(Level level, Throwable cause, Supplier msg) { + RestContext c = context.get(); + Logger logger = c == null ? null : c.getLogger(); + if (logger == null) + logger = Logger.getLogger(getClass().getName()); logger.log(level, cause, msg); } 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 06d0e13..99d9dd8 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 @@ -46,7 +46,6 @@ public abstract class RestServlet extends HttpServlet { private AtomicReference context = new AtomicReference<>(); private AtomicReference initException = new AtomicReference<>(); - private Logger logger = Logger.getLogger(getClass().getName()); @Override /* Servlet */ public synchronized void init(ServletConfig servletConfig) throws ServletException { @@ -249,6 +248,10 @@ public abstract class RestServlet extends HttpServlet { * @param msg The message to log. */ protected void doLog(Level level, Throwable cause, Supplier msg) { + RestContext c = context.get(); + Logger logger = c == null ? null : c.getLogger(); + if (logger == null) + logger = Logger.getLogger(getClass().getName()); logger.log(level, cause, msg); }
[juneau] branch master updated: REST refactoring.
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 4acaf26 REST refactoring. 4acaf26 is described below commit 4acaf26c5cd59e7936d3b928bd10c5b41ec33aef Author: JamesBognar AuthorDate: Mon Jan 11 16:41:43 2021 -0500 REST refactoring. --- .../src/main/java/org/apache/juneau/rest/RestContext.java | 5 + .../java/org/apache/juneau/rest/RestContextBuilder.java | 15 +-- .../src/main/java/org/apache/juneau/rest/RestServlet.java | 4 +--- 3 files changed, 7 insertions(+), 17 deletions(-) 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 6e3169e..aa8971c 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 @@ -3246,7 +3246,7 @@ public class RestContext extends BeanContext { /** * Constructor. -* +* * @param parentContext The parent context, or null if there is no parent context. * @param servletConfig The servlet config passed into the servlet by the servlet container. * @param resourceClass The class annotated with @Rest. @@ -3273,8 +3273,6 @@ public class RestContext extends BeanContext { HttpException _initException = null; try { - ServletContext servletContext = builder.servletContext; - this.builder = builder; resource = builder.resource; parentContext = builder.parentContext; @@ -3636,7 +3634,6 @@ public class RestContext extends BeanContext { childBuilder.init(r); if (r instanceof RestServlet) ((RestServlet)r).innerInit(childBuilder); - childBuilder.servletContext(servletContext); RestContext rc2 = childBuilder.build(); if (r instanceof RestServlet) ((RestServlet)r).setContext(rc2); 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 824af05..567b087 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 @@ -140,6 +140,7 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon beanFactory = createBeanFactory(parentContext, resource); beanFactory.addBean(RestContextBuilder.class, this); beanFactory.addBean(ServletConfig.class, servletConfig.orElse(this)); + beanFactory.addBean(ServletContext.class, servletConfig.orElse(this).getServletContext()); varResolverBuilder = new VarResolverBuilder() .defaultVars() @@ -279,12 +280,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon return this; } - RestContextBuilder servletContext(ServletContext servletContext) { - this.servletContext = servletContext; - beanFactory.addBean(ServletContext.class, servletContext); - return this; - } - /** * Adds the specified {@link Var} classes to this config. * @@ -2559,21 +2554,21 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon @Override /* ServletConfig */ public String getInitParameter(String name) { - return inner.getInitParameter(name); + return inner == null ? null : inner.getInitParameter(name); } @Override /* ServletConfig */ public Enumeration getInitParameterNames() { - return inner.getInitParameterNames(); + return inner == null ? new Vector().elements() : inner.getInitParameterNames(); } @Override /* ServletConfig */ public ServletContext getServletContext() { - return inner.getServletContext(); + return inner == null ? null : inner.getServletContext(); } @Override /* ServletConfig */ public String getServletName() { - return inner.getServletName(); + return inner == null ? null : inner.getServletName(); } } diff --git
[juneau] branch master updated: REST refactoring.
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 41318a0 REST refactoring. 41318a0 is described below commit 41318a0c84909037a9ba79f9e44b6da428e4ecf8 Author: JamesBognar AuthorDate: Mon Jan 11 12:39:42 2021 -0500 REST refactoring. --- .../src/main/java/org/apache/juneau/rest/RestContext.java | 14 +++--- .../java/org/apache/juneau/rest/RestContextBuilder.java| 2 +- .../src/main/java/org/apache/juneau/rest/RestServlet.java | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) 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 42aac79..6e3169e 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 @@ -3241,20 +3241,20 @@ public class RestContext extends BeanContext { * @throws ServletException Something bad happened. */ public static RestContextBuilder create(Object resource) throws ServletException { - return new RestContextBuilder(resource.getClass(), Optional.empty(), Optional.empty(), Optional.of(resource)).init(resource); + return new RestContextBuilder(Optional.empty(), Optional.empty(), resource.getClass(), Optional.of(resource)).init(resource); } /** * Constructor. -* +* +* @param parentContext The parent context, or null if there is no parent context. * @param servletConfig The servlet config passed into the servlet by the servlet container. * @param resourceClass The class annotated with @Rest. -* @param parentContext The parent context, or null if there is no parent context. * @return A new builder object. * @throws ServletException Something bad happened. */ - static RestContextBuilder create(ServletConfig servletConfig, Class resourceClass, RestContext parentContext) throws ServletException { - return new RestContextBuilder(resourceClass, Optional.ofNullable(servletConfig), Optional.ofNullable(parentContext), Optional.empty()); + static RestContextBuilder create(RestContext parentContext, ServletConfig servletConfig, Class resourceClass, Object resource) throws ServletException { + return new RestContextBuilder(Optional.ofNullable(parentContext), Optional.ofNullable(servletConfig), resourceClass, Optional.ofNullable(resource)); } /** @@ -3626,11 +3626,11 @@ public class RestContext extends BeanContext { if (o instanceof Class) { Class oc = (Class)o; - childBuilder = RestContext.create(builder.inner, oc, this); + childBuilder = RestContext.create(this, builder.inner, oc, null); r = new BeanFactory(beanFactory, resource).addBean(RestContextBuilder.class, childBuilder).createBean(oc); } else { r = o; - childBuilder = RestContext.create(builder.inner, o.getClass(), this); + childBuilder = RestContext.create(this, builder.inner, o.getClass(), o); } childBuilder.init(r); 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 4fbe9a0..824af05 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 @@ -109,7 +109,7 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon Config config; VarResolverBuilder varResolverBuilder; - RestContextBuilder(Class resourceClass, Optional servletConfig, Optional parentContext, Optional resource) throws ServletException { + RestContextBuilder(Optional parentContext, Optional servletConfig, Class resourceClass, Optional resource) throws ServletException { try { this.resourceClass = resourceClass; 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 470d2c3..9b7d352 100644 --- a/juneau-rest/juneau
[juneau] branch master updated: REST refactoring.
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 fa6edbf REST refactoring. fa6edbf is described below commit fa6edbfc4add296c07f056b61878d064358ee6ea Author: JamesBognar AuthorDate: Mon Jan 11 12:22:52 2021 -0500 REST refactoring. --- .../src/main/java/org/apache/juneau/rest/RestServlet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0b8df53..470d2c3 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 @@ -53,9 +53,9 @@ public abstract class RestServlet extends HttpServlet { try { if (context.get() != null) return; + super.init(servletConfig); RestContextBuilder builder = RestContext.create(servletConfig, this.getClass(), null); builder.init(this); - super.init(servletConfig); builder.servletContext(this.getServletContext()); context.set(builder.build()); context.get().postInit();
[juneau] branch master updated: REST refactoring.
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 9f9ec0b REST refactoring. 9f9ec0b is described below commit 9f9ec0b9ab0c3cb8a1b64f9dec32751759b21fc6 Author: JamesBognar AuthorDate: Mon Jan 11 12:05:51 2021 -0500 REST refactoring. --- .../src/main/java/org/apache/juneau/rest/RestServlet.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 44e9df3..0e0d281 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 @@ -44,7 +44,6 @@ public abstract class RestServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private RestContextBuilder builder; private AtomicReference context = new AtomicReference<>(); private AtomicReference initException = new AtomicReference<>(); private Logger logger = Logger.getLogger(getClass().getName()); @@ -54,7 +53,7 @@ public abstract class RestServlet extends HttpServlet { try { if (context.get() != null) return; - builder = RestContext.create(servletConfig, this.getClass(), null); + RestContextBuilder builder = RestContext.create(servletConfig, this.getClass(), null); builder.init(this); super.init(servletConfig); builder.servletContext(this.getServletContext()); @@ -95,7 +94,6 @@ public abstract class RestServlet extends HttpServlet { * @throws ServletException If error occurred during post-initialiation. */ public synchronized void setContext(RestContext context) throws ServletException { - this.builder = context.builder; this.context.set(context); context.postInit(); }
[juneau] branch master updated: REST refactoring.
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 568c6ba REST refactoring. 568c6ba is described below commit 568c6ba85f682893b5927f41bc0371bb6ddb18d2 Author: JamesBognar AuthorDate: Mon Jan 11 11:18:47 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/rest/RestServlet.java | 44 ++ 1 file changed, 20 insertions(+), 24 deletions(-) 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 2dde88b..13b6e33 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 @@ -20,6 +20,7 @@ import static org.apache.juneau.rest.annotation.HookEvent.*; import java.io.*; import java.text.*; +import java.util.concurrent.atomic.*; import java.util.function.*; import java.util.logging.*; @@ -44,28 +45,27 @@ public abstract class RestServlet extends HttpServlet { private static final long serialVersionUID = 1L; private RestContextBuilder builder; - private volatile RestContext context; - private volatile Exception initException; - private boolean isInitialized = false; // Should not be volatile. + private AtomicReference context = new AtomicReference<>(); + private AtomicReference initException = new AtomicReference<>(); private Logger logger = Logger.getLogger(getClass().getName()); @Override /* Servlet */ public synchronized void init(ServletConfig servletConfig) throws ServletException { try { - if (context != null) + if (context.get() != null) return; builder = RestContext.create(servletConfig, this.getClass(), null); builder.init(this); super.init(servletConfig); builder.servletContext(this.getServletContext()); setContext(builder.build()); - context.postInitChildFirst(); + context.get().postInitChildFirst(); } catch (ServletException e) { - initException = e; + initException.set(e); log(SEVERE, e, "Servlet init error on class ''{0}''", getClass().getName()); throw e; } catch (Throwable e) { - initException = toHttpException(e, InternalServerError.class); + initException.set(toHttpException(e, InternalServerError.class)); log(SEVERE, e, "Servlet init error on class ''{0}''", getClass().getName()); } } @@ -96,8 +96,7 @@ public abstract class RestServlet extends HttpServlet { */ public synchronized void setContext(RestContext context) throws ServletException { this.builder = context.builder; - this.context = context; - isInitialized = true; + this.context.set(context); context.postInit(); } @@ -107,7 +106,7 @@ public abstract class RestServlet extends HttpServlet { * @return true if this servlet has been initialized and {@link #getContext()} returns a value. */ public synchronized boolean isInitialized() { - return isInitialized; + return context.get() != null; } /** @@ -116,6 +115,7 @@ public abstract class RestServlet extends HttpServlet { * @return The path defined on this servlet, or an empty string if not specified. */ public synchronized String getPath() { + RestContext context = this.context.get(); if (context != null) return context.getPath(); ClassInfo ci = ClassInfo.of(getClass()); @@ -146,16 +146,11 @@ public abstract class RestServlet extends HttpServlet { @Override /* Servlet */ public void service(HttpServletRequest r1, HttpServletResponse r2) throws ServletException, InternalServerError, IOException { try { - // To avoid checking the volatile field context on every call, use the non-volatile isInitialized field as a first-check check. - if (! isInitialized) { - if (initException != null) - throw initException; - if (context == null) -
[juneau] branch master updated: REST refactoring.
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 8b65e13 REST refactoring. 8b65e13 is described below commit 8b65e13fed87f222c2970bedca326677e9dd2c58 Author: JamesBognar AuthorDate: Mon Jan 11 09:15:19 2021 -0500 REST refactoring. --- .../rest/springboot/BasicSpringRestServlet.java| 2 +- .../org/apache/juneau/rest/BasicRestObject.java| 2 +- .../org/apache/juneau/rest/BasicRestServlet.java | 2 +- .../java/org/apache/juneau/rest/RestContext.java | 10 -- .../java/org/apache/juneau/rest/RestObject.java| 93 +--- .../java/org/apache/juneau/rest/RestServlet.java | 165 + 6 files changed, 41 insertions(+), 233 deletions(-) diff --git a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/BasicSpringRestServlet.java b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/BasicSpringRestServlet.java index 587538a..d7dbc0d 100644 --- a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/BasicSpringRestServlet.java +++ b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/BasicSpringRestServlet.java @@ -165,7 +165,7 @@ public abstract class BasicSpringRestServlet extends SpringRestServlet implement @Override /* BasicRestConfig */ public Swagger getApi(RestRequest req) { try { - return getSwagger(req); + return req.getSwagger(); } catch (Exception e) { throw new InternalServerError(e); } diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestObject.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestObject.java index d94bb90..027683d 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestObject.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestObject.java @@ -44,7 +44,7 @@ public abstract class BasicRestObject extends RestObject implements BasicUnivers @Override /* BasicRestConfig */ public Swagger getApi(RestRequest req) { try { - return getSwagger(req); + return req.getSwagger(); } catch (Exception e) { throw new InternalServerError(e); } diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestServlet.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestServlet.java index 70c5623..b837269 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestServlet.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestServlet.java @@ -164,7 +164,7 @@ public abstract class BasicRestServlet extends RestServlet implements BasicUnive @Override /* BasicRestConfig */ public Swagger getApi(RestRequest req) { try { - return getSwagger(req); + return req.getSwagger(); } catch (Exception e) { throw new InternalServerError(e); } 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 5932161..42aac79 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 @@ -1077,8 +1077,6 @@ public class RestContext extends BeanContext { * {@link org.apache.juneau.rest.RestContextBuilder#fileFinder(Class)} * {@link org.apache.juneau.rest.RestContextBuilder#fileFinder(FileFinder)} * {@link org.apache.juneau.rest.RestContext#createFileFinder(BeanFactory)} -* {@link org.apache.juneau.rest.BasicRestObject#createFileFinder()} -* {@link org.apache.juneau.rest.BasicRestServlet#createFileFinder()} * * * @@ -1103,9 +1101,6 @@ public class RestContext extends BeanContext { * Returns the resource class itself if it's an instance of {@link FileFinder}. * Looks for {@link #REST_fileFinder} setting. * Looks for a public createFileFinder() method on the resource class with an optional {@link RestContext} argument. -* Note that the {@link RestObject
[juneau] branch master updated: REST refactoring.
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 cb1b14c REST refactoring. cb1b14c is described below commit cb1b14c13136caf8800a0463bbf93df012202220 Author: JamesBognar AuthorDate: Sun Jan 10 13:55:32 2021 -0500 REST refactoring. --- .../java/org/apache/juneau/cp/BeanFactory.java | 18 ++- .../java/org/apache/juneau/rest/RestContext.java | 9 +- .../org/apache/juneau/rest/RestContextBuilder.java | 174 + .../org/apache/juneau/rest/RestParamDefaults.java | 19 ++- 4 files changed, 150 insertions(+), 70 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java index 7583549..a1b20a0 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanFactory.java @@ -82,6 +82,8 @@ public class BeanFactory { * @return This object (for method chaining). */ public BeanFactory addBean(Class c, T t) { + if (t != null && ! c.isInstance(t)) + throw new BasicRuntimeException("Object not of type {0}: {1}", c.getName(), t.getClass().getName()); if (t == null) beanMap.remove(c); else @@ -171,7 +173,13 @@ public class BeanFactory { return null; } - private List getMissingParamTypes(List paramTypes) { + /** +* Given the list of param types, returns a list of types that are missing from this factory. +* +* @param paramTypes The param types to chec. +* @return A list of types that are missing from this factory. +*/ + public List getMissingParamTypes(List paramTypes) { List l = AList.of(); for (int i = 0; i < paramTypes.size(); i++) { ClassInfo pt = paramTypes.get(i); @@ -183,7 +191,13 @@ public class BeanFactory { return l; } - private Object[] getParams(List paramTypes) { + /** +* Returns the corresponding beans in this factory for the specified param types. +* +* @param paramTypes The param types to get from this factory. +* @return The corresponding beans in this factory for the specified param types. +*/ + public Object[] getParams(List paramTypes) { Object[] o = new Object[paramTypes.size()]; for (int i = 0; i < paramTypes.size(); i++) { ClassInfo pt = paramTypes.get(i); 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 acadeba..5932161 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 @@ -3208,7 +3208,8 @@ public class RestContext extends BeanContext { private final RestInfoProvider infoProvider; private final HttpException initException; private final RestContext parentContext; - private final BeanFactory rootBeanFactory, beanFactory; + final BeanFactory rootBeanFactory; + private final BeanFactory beanFactory; private final UriResolution uriResolution; private final UriRelativity uriRelativity; private final ConcurrentHashMap methodExecStats = new ConcurrentHashMap<>(); @@ -3250,7 +3251,7 @@ public class RestContext extends BeanContext { * @throws ServletException Something bad happened. */ public static RestContextBuilder create(Object resource) throws ServletException { - return new RestContextBuilder(null, resource.getClass(), null).init(resource); + return new RestContextBuilder(resource.getClass(), Optional.empty(), Optional.empty(), Optional.of(resource)).init(resource); } /** @@ -3263,7 +3264,7 @@ public class RestContext extends BeanContext { * @throws ServletException Something bad happened. */ static RestContextBuilder create(ServletConfig servletConfig, Class resourceClass, RestContext parentContext) throws ServletException { - return new RestContextBuilder(servletConfig, resourceClass, parentContext); + return new RestContextBuilder(resourceClass, Optional.ofNullable(servletConfig), Optional.ofNullable(parentContext), Optional.empty()); } /** @@ -5047,6 +5048,8 @@ public class R
[juneau] branch master updated: REST refactoring.
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 6af640c REST refactoring. 6af640c is described below commit 6af640ceba232bdfb87b2728694021b5b6632e18 Author: JamesBognar AuthorDate: Sun Jan 10 12:27:15 2021 -0500 REST refactoring. --- .../org/apache/juneau/BasicResourceResolver.java | 31 .../src/main/java/org/apache/juneau/Context.java | 78 -- .../org/apache/juneau/FuzzyResourceResolver.java | 31 .../main/java/org/apache/juneau/PropertyStore.java | 157 - .../java/org/apache/juneau/ResourceResolver.java | 47 -- .../rest/springboot/JuneauRestInitializer.java | 54 --- .../rest/springboot/JuneauRestPostProcessor.java | 94 .../springboot/SpringRestResourceResolver.java | 75 -- .../juneau/rest/BasicRestResourceResolver.java | 46 -- .../apache/juneau/rest/RestResourceResolver.java | 74 -- 10 files changed, 687 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java deleted file mode 100644 index 65be819..000 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java +++ /dev/null @@ -1,31 +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; - -import static org.apache.juneau.internal.ClassUtils.*; - -/** - * Basic implementation of a resource resolver. - */ -@Deprecated -public class BasicResourceResolver implements ResourceResolver { - - @Override /* ResourceResolver */ - public T resolve(Object parent, Class c, Object...args) { - try { - return castOrCreateFromOuter(parent, c, c, false, args); - } catch (Exception e) { - throw new BeanRuntimeException(e, c, "Could not instantiate resource class"); - } - } -} diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java index f363e0e..e5fcb75 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java @@ -716,47 +716,6 @@ public abstract class Context { * @param def * The default value if the property doesn't exist. * Can either be an instance of T, or a Class? extends T. -* @param resolver -* The resolver to use for instantiating objects. -* @param args -* Arguments to pass to the constructor. -* Constructors matching the arguments are always used before no-arg constructors. -* @return A new property instance. -*/ - @Deprecated - public T getInstanceProperty(String key, Class type, Object def, ResourceResolver resolver, Object...args) { - return propertyStore.getInstanceProperty(key, type, def, resolver, args); - } - - /** -* Returns an instance of the specified class, string, or object property. -* -* @param key The property
[juneau] branch master updated: Replace ResourceResolver with BeanFactory.
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 fc66353 Replace ResourceResolver with BeanFactory. fc66353 is described below commit fc6635394a89167599acb5ecc7e5caf003192d6a Author: JamesBognar AuthorDate: Fri Jan 8 15:31:07 2021 -0500 Replace ResourceResolver with BeanFactory. --- .../org/apache/juneau/BasicResourceResolver.java | 1 + .../src/main/java/org/apache/juneau/Context.java | 33 ++ .../org/apache/juneau/FuzzyResourceResolver.java | 1 + .../main/java/org/apache/juneau/PropertyStore.java | 121 - .../java/org/apache/juneau/ResourceResolver.java | 1 + 5 files changed, 155 insertions(+), 2 deletions(-) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java index fa7bc38..65be819 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BasicResourceResolver.java @@ -17,6 +17,7 @@ import static org.apache.juneau.internal.ClassUtils.*; /** * Basic implementation of a resource resolver. */ +@Deprecated public class BasicResourceResolver implements ResourceResolver { @Override /* ResourceResolver */ diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java index ea10788..f363e0e 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/Context.java @@ -17,6 +17,7 @@ import java.util.*; import org.apache.juneau.annotation.*; import org.apache.juneau.collections.*; +import org.apache.juneau.cp.*; import org.apache.juneau.http.*; import org.apache.juneau.internal.*; import org.apache.juneau.json.*; @@ -722,6 +723,7 @@ public abstract class Context { * Constructors matching the arguments are always used before no-arg constructors. * @return A new property instance. */ + @Deprecated public T getInstanceProperty(String key, Class type, Object def, ResourceResolver resolver, Object...args) { return propertyStore.getInstanceProperty(key, type, def, resolver, args); } @@ -742,11 +744,27 @@ public abstract class Context { * Constructors matching the arguments are always used before no-arg constructors. * @return A new property instance. */ + @Deprecated public T getInstanceProperty(String key, Object outer, Class type, Object def, ResourceResolver resolver, Object...args) { return propertyStore.getInstanceProperty(key, outer, type, def, resolver, args); } /** +* Returns an instance of the specified class, string, or object property. +* +* @param key The property name. +* @param type The class type of the property. +* @param def +* The default value if the property doesn't exist. +* Can either be an instance of T, or a Class? extends T. +* @param beanFactory The bean factory to use to instantiate beans. +* @return A new property instance. +*/ + public T getInstanceProperty(String key, Class type, Object def, BeanFactory beanFactory) { + return propertyStore.getInstanceProperty(key, type, def, beanFactory); + } + + /** * Returns the specified property as an array of instantiated objects. * * @param key The property name. @@ -783,6 +801,7 @@ public abstract class Context { * Constructors matching the arguments are always used before no-arg constructors. * @return A new property instance. */ + @Deprecated public T[] getInstanceArrayProperty(String key, Class type, T[] def, ResourceResolver resolver, Object...args) { return propertyStore.getInstanceArrayProperty(key, type, def, resolver, args); } @@ -801,11 +820,25 @@ public abstract class Context { * Constructors matching the arguments are always used before no-arg constructors. * @return A new property instance. */ + @Deprecated public T[] getInstanceArrayProperty(String key, Object outer, Class type, T[] def, ResourceResolver resolver, Object...args) { return propertyStore.getInstanceArrayProperty(key, outer, type, def, resolver, args); } /** +* Returns the specified property as an array of instantiated objects. +* +* @param key The property name. +* @param
[juneau] branch master updated: REST refactoring.
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 4ba1b00 REST refactoring. 4ba1b00 is described below commit 4ba1b00b4d3934dfc97c1fd2dc51584171c98c15 Author: JamesBognar AuthorDate: Fri Jan 8 14:56:59 2021 -0500 REST refactoring. --- .../juneau/http/SerializedHttpEntity_Test.java |2 +- .../org/apache/juneau/http/remote/Remote_Test.java |4 +- .../java/org/apache/juneau/cp/BeanFactory.java | 143 +++ .../juneau/examples/rest/HelloWorldResource.java |3 +- .../juneau/examples/rest/RequestEchoResource.java |2 +- .../client/BasicHttpRequestRetryHandler_Test.java |2 +- .../juneau/rest/client/RestCallException_Test.java |2 +- .../rest/client/RestClient_BasicCalls_Test.java|2 +- .../juneau/rest/client/RestClient_Body_Test.java |2 +- .../client/RestClient_Config_BeanContext_Test.java |4 +- .../client/RestClient_Config_Context_Test.java |2 +- .../client/RestClient_Config_OpenApi_Test.java |2 +- .../rest/client/RestClient_Config_Parser_Test.java |2 +- .../client/RestClient_Config_RestClient_Test.java |4 +- .../client/RestClient_Config_Serializer_Test.java |2 +- .../rest/client/RestClient_FormData_Test.java |2 +- .../rest/client/RestClient_Headers_Test.java |2 +- .../rest/client/RestClient_Logging_Test.java |2 +- .../rest/client/RestClient_Marshalls_Test.java |2 +- .../juneau/rest/client/RestClient_Paths_Test.java |2 +- .../juneau/rest/client/RestClient_Query_Test.java |2 +- .../rest/client/RestClient_Response_Body_Test.java |2 +- .../client/RestClient_Response_Headers_Test.java |2 +- .../rest/client/RestClient_Response_Test.java |6 +- .../apache/juneau/rest/client/RestClient_Test.java |4 +- .../rest/springboot/BasicSpringRestServlet.java} | 70 +- .../springboot/BasicSpringRestServletGroup.java} | 20 +- .../juneau/rest/springboot/SpringBeanFactory.java} | 91 +- .../juneau/rest/springboot/SpringRestServlet.java} | 78 +- .../juneau/rest/annotation/Rest_Debug_Test.java|2 +- .../org/apache/juneau/rest/BasicRestObject.java| 83 ++ ...sicRestGroup.java => BasicRestObjectGroup.java} |2 +- .../org/apache/juneau/rest/BasicRestServlet.java | 62 -- .../java/org/apache/juneau/rest/RestContext.java | 22 +- .../org/apache/juneau/rest/RestContextBuilder.java |4 +- .../rest/{BasicRest.java => RestObject.java} | 1096 ++-- .../java/org/apache/juneau/rest/RestServlet.java | 64 +- .../org/apache/juneau/rest/annotation/Rest.java| 14 +- 38 files changed, 951 insertions(+), 861 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/SerializedHttpEntity_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/SerializedHttpEntity_Test.java index b8bc079..935f5ae 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/SerializedHttpEntity_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/SerializedHttpEntity_Test.java @@ -38,7 +38,7 @@ import org.junit.*; public class SerializedHttpEntity_Test { @Rest - public static class A extends BasicRest { + public static class A extends BasicRestObject { @RestMethod public String[] postCheckHeader(org.apache.juneau.rest.RestRequest req) { return req.getHeaders().get(req.getHeader("Check")); diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java index 4c51368..7f04a11 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java @@ -518,7 +518,7 @@ public class Remote_Test { //- @Rest - public static class F extends BasicRest { + public static class F extends BasicRestObject { @RestMethod public String[] getHeaders(org.apache.juneau.rest.RestRequest req) { return req.getHeaders().get(req.getHeader("Check")); @@ -566,7 +566,7 @@ public class Remote_Test { //- @Rest - public static class G extends BasicRest {} + public static class G extends BasicRestObject {} @Remote public
[juneau] branch master updated: REST refactoring.
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 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 cla
[juneau] branch master updated: Remove juneau-releng project.
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 2afc76f Remove juneau-releng project. 2afc76f is described below commit 2afc76ff546c4a946e9012ad6cfddc443f290912 Author: JamesBognar AuthorDate: Mon Dec 21 14:12:53 2020 -0500 Remove juneau-releng project. --- .../juneau-distrib => juneau-all}/.gitignore | 0 {juneau-releng/juneau-all => juneau-all}/pom.xml | 4 +-- .../juneau-all => juneau-all}/src/assembly/all.xml | 0 .../main/ConfigurablePropertyCodeGenerator.java| 0 .../src/java/main/FieldSorter.java | 0 .../juneau-all => juneau-distrib}/.gitignore | 0 .../juneau-distrib => juneau-distrib}/pom.xml | 4 +-- .../src/assembly/bin.xml | 0 .../src/assembly/src.xml | 0 juneau-releng/.gitignore | 6 juneau-releng/pom.xml | 36 -- pom.xml| 3 +- 12 files changed, 6 insertions(+), 47 deletions(-) diff --git a/juneau-releng/juneau-distrib/.gitignore b/juneau-all/.gitignore similarity index 100% rename from juneau-releng/juneau-distrib/.gitignore rename to juneau-all/.gitignore diff --git a/juneau-releng/juneau-all/pom.xml b/juneau-all/pom.xml similarity index 98% rename from juneau-releng/juneau-all/pom.xml rename to juneau-all/pom.xml index 95be782..3c6139a 100644 --- a/juneau-releng/juneau-all/pom.xml +++ b/juneau-all/pom.xml @@ -19,12 +19,12 @@ org.apache.juneau - juneau-releng + juneau 9.0.0-SNAPSHOT juneau-all - juneau/releng/all + juneau/all Apache Juneau UberJar jar diff --git a/juneau-releng/juneau-all/src/assembly/all.xml b/juneau-all/src/assembly/all.xml similarity index 100% rename from juneau-releng/juneau-all/src/assembly/all.xml rename to juneau-all/src/assembly/all.xml diff --git a/juneau-releng/juneau-all/src/java/main/ConfigurablePropertyCodeGenerator.java b/juneau-all/src/java/main/ConfigurablePropertyCodeGenerator.java similarity index 100% rename from juneau-releng/juneau-all/src/java/main/ConfigurablePropertyCodeGenerator.java rename to juneau-all/src/java/main/ConfigurablePropertyCodeGenerator.java diff --git a/juneau-releng/juneau-all/src/java/main/FieldSorter.java b/juneau-all/src/java/main/FieldSorter.java similarity index 100% rename from juneau-releng/juneau-all/src/java/main/FieldSorter.java rename to juneau-all/src/java/main/FieldSorter.java diff --git a/juneau-releng/juneau-all/.gitignore b/juneau-distrib/.gitignore similarity index 100% rename from juneau-releng/juneau-all/.gitignore rename to juneau-distrib/.gitignore diff --git a/juneau-releng/juneau-distrib/pom.xml b/juneau-distrib/pom.xml similarity index 99% rename from juneau-releng/juneau-distrib/pom.xml rename to juneau-distrib/pom.xml index b968984..cd66921 100644 --- a/juneau-releng/juneau-distrib/pom.xml +++ b/juneau-distrib/pom.xml @@ -19,13 +19,13 @@ org.apache.juneau - juneau-releng + juneau 9.0.0-SNAPSHOT juneau-distrib pom - juneau/releng/distrib + juneau/distrib Apache Juneau Distribution diff --git a/juneau-releng/juneau-distrib/src/assembly/bin.xml b/juneau-distrib/src/assembly/bin.xml similarity index 100% rename from juneau-releng/juneau-distrib/src/assembly/bin.xml rename to juneau-distrib/src/assembly/bin.xml diff --git a/juneau-releng/juneau-distrib/src/assembly/src.xml b/juneau-distrib/src/assembly/src.xml similarity index 100% rename from juneau-releng/juneau-distrib/src/assembly/src.xml rename to juneau-distrib/src/assembly/src.xml diff --git a/juneau-releng/.gitignore b/juneau-releng/.gitignore deleted file mode 100644 index 34acf88..000 --- a/juneau-releng/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/target/ -**/.DS_Store -.classpath -.project -/.settings/ -/bin/ diff --git a/juneau-releng/pom.xml b/juneau-releng/pom.xml deleted file mode 100644 index f9de54b..000 --- a/juneau-releng/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - -http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> - - 4.0.0 - - - org.apache.juneau - juneau - 9.0.0-SNAPSHOT - - - juneau-releng - pom - juneau/releng - Apache Juneau Release Engineering Projects - - - juneau-all - juneau-distrib - - - diff --git a/pom.xml b/pom.xml index da1f040..a16219
[juneau] branch master updated: Remove docs from build.
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 c72c62e Remove docs from build. c72c62e is described below commit c72c62ee9a06709c811c58a0dcfbc7557a593d1c Author: JamesBognar AuthorDate: Mon Dec 21 14:02:44 2020 -0500 Remove docs from build. --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 597bac6..da1f040 100644 --- a/pom.xml +++ b/pom.xml @@ -120,7 +120,6 @@ juneau-microservice juneau-sc juneau-examples - juneau-doc juneau-releng
[juneau] branch master updated: Fix Java 11 compilation errors/warnings.
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 b8b7bdd Fix Java 11 compilation errors/warnings. b8b7bdd is described below commit b8b7bddeacdc8173f4ee2453b6f4525c824f570d Author: JamesBognar AuthorDate: Mon Dec 7 16:31:25 2020 -0500 Fix Java 11 compilation errors/warnings. --- .../juneau/config/store/ConfigFileStore.java | 3 ++- .../org/apache/juneau/http/remote/Remote_Test.java | 2 -- .../java/org/apache/juneau/internal/IOUtils.java | 26 +- .../apache/juneau/internal/ReaderInputStream.java | 5 ++--- .../org/apache/juneau/internal/StringUtils.java| 2 +- .../serializer/OutputStreamSerializerSession.java | 2 +- juneau-doc/pom.xml | 4 +++- .../juneau/examples/rest/springboot/App.java | 1 + .../microservice/springboot/template/App.java | 1 + .../juneau/rest/client/RestResponseBody.java | 1 + .../juneau/rest/mock/MockServletResponse.java | 2 +- .../juneau/rest/Header_AcceptEncoding_Test.java| 1 - .../apache/juneau/rest/RestMethod_Params_Test.java | 2 -- .../juneau/rest/RestMethod_Returns_Test.java | 1 - .../java/org/apache/juneau/rest/StaticFiles.java | 3 +-- .../juneau/rest/annotation/RestAnnotation.java | 1 - .../rest/annotation/RestMethodAnnotation.java | 1 - 17 files changed, 29 insertions(+), 29 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 1c04d42..309cd2b 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 @@ -253,6 +253,7 @@ public class ConfigFileStore extends ConfigStore { } } + @SuppressWarnings("cast") @Override /* ConfigStore */ public synchronized String read(String name) throws IOException { name = resolveName(name); @@ -278,7 +279,7 @@ 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(; + sb.append(charset.decode((ByteBuffer)((Buffer)(buf.flip(); // Fixes Java 11 issue involving overridden flip method. buf.clear(); } s = sb.toString(); diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java index 13d5047..42b3ed6 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java @@ -24,8 +24,6 @@ import org.apache.juneau.rest.client.remote.*; import org.apache.juneau.rest.config.*; import org.apache.juneau.rest.mock.*; import org.apache.juneau.http.*; -import org.apache.juneau.http.remote.RemoteMethod; -import org.apache.juneau.http.remote.RemoteReturn; import org.apache.juneau.marshall.*; import org.junit.*; diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/IOUtils.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/IOUtils.java index a6cf8c1..ba58f97 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/IOUtils.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/IOUtils.java @@ -235,15 +235,13 @@ public final class IOUtils { public static byte[] readBytes(InputStream in, int buffSize) throws IOException { if (buffSize == 0) buffSize = 1024; - final ByteArrayOutputStream buff = new ByteArrayOutputStream(buffSize); -try { - int nRead; - byte[] b = new byte[buffSize]; - while ((nRead = in.read(b, 0, b.length)) != -1) - buff.write(b, 0, nRead); - buff.flush(); - return buff.toByteArray(); -} + ByteArrayOutputStream buff = new ByteArrayOutputStream(buffSize); + int nRead; + byte[] b = new byte[buffSize]; + while ((nRead = in.read(b, 0, b.leng
[juneau] branch master updated (19e5aa8 -> c1dbef6)
This is an automated email from the ASF dual-hosted git repository. jamesbognar pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/juneau.git. from 19e5aa8 Temporarily remove deprecated tag from Property. new c556139 Fix unecessary closes new 5a213ae Fix synchronization issues for addAll new 3951fef Fix flush outputstream before using it new c1dbef6 Merge pull request #55 from lcc/java-api-fixes The 2260 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../src/main/java/org/apache/juneau/config/Config.java | 2 +- .../java/org/apache/juneau/http/SerializedHttpEntity.java | 3 ++- .../java/org/apache/juneau/internal/DelegateBeanMap.java| 2 +- .../src/main/java/org/apache/juneau/internal/IOUtils.java | 13 - .../juneau/serializer/OutputStreamSerializerSession.java| 1 + .../java/org/apache/juneau/rest/mock/MockRestClient.java| 1 + .../org/apache/juneau/rest/mock/MockServletResponse.java| 1 + .../src/main/java/org/apache/juneau/rest/RestContext.java | 2 +- .../src/main/java/org/apache/juneau/rest/StaticFiles.java | 3 ++- 9 files changed, 14 insertions(+), 14 deletions(-)
[juneau] branch master updated: Temporarily remove deprecated tag from Property.
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 19e5aa8 Temporarily remove deprecated tag from Property. 19e5aa8 is described below commit 19e5aa8de0d0dddaa8e0f64347721e65efb48e46 Author: JamesBognar AuthorDate: Mon Nov 16 16:53:12 2020 -0500 Temporarily remove deprecated tag from Property. --- .../src/main/java/org/apache/juneau/rest/annotation/Property.java| 1 - 1 file changed, 1 deletion(-) 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 index 729bbd1..6f56749 100644 --- 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 @@ -35,7 +35,6 @@ import java.lang.annotation.*; @Target(ANNOTATION_TYPE) @Retention(RUNTIME) @Inherited -@Deprecated public @interface Property { /**
[juneau] branch master updated: Better reusability of MockRestClient.
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 c0457be Better reusability of MockRestClient. c0457be is described below commit c0457be5cda07e04864523a13d224110a0ff0d19 Author: JamesBognar AuthorDate: Mon Nov 16 11:51:52 2020 -0500 Better reusability of MockRestClient. --- .../java/org/apache/juneau/PropertyStoreTest.java | 1 + .../remote/Remote_RemoteMethodAnnotation_Test.java | 7 +--- .../main/java/org/apache/juneau/PropertyStore.java | 2 + .../org/apache/juneau/assertions/Assertions.java | 16 .../client/RestClient_Config_Context_Test.java | 6 ++- .../client/RestClient_Config_RestClient_Test.java | 45 .../rest/client/RestClient_Marshalls_Test.java | 7 ++-- .../org/apache/juneau/rest/client/RestClient.java | 48 +- .../juneau/rest/client/RestClientBuilder.java | 10 +++-- .../org/apache/juneau/rest/client/RestRequest.java | 16 .../juneau/rest/client/RestResponseBody.java | 10 +++-- .../rest/mock/MockHttpClientConnectionManager.java | 13 +- .../apache/juneau/rest/mock/MockRestClient.java| 7 +++- .../juneau/rest/mock/MockRestClientBuilder.java| 6 +-- 14 files changed, 157 insertions(+), 37 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java index 3611052..f50ca4c 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java @@ -1564,6 +1564,7 @@ public class PropertyStoreTest { public void testSet() { PropertyStoreBuilder b = PropertyStore.create(); b.set(OMap.of("A.foo", "bar")); + b.clear(); b.set(OMap.of("A.baz", "qux")); b.add(null); assertObject(b.build()).json().is("{A:{baz:'qux'}}"); diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_RemoteMethodAnnotation_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_RemoteMethodAnnotation_Test.java index 0f0ceac..920d4e3 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_RemoteMethodAnnotation_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_RemoteMethodAnnotation_Test.java @@ -23,7 +23,6 @@ import org.apache.juneau.http.annotation.Body; import org.apache.juneau.http.annotation.Response; import org.apache.juneau.internal.*; import org.apache.juneau.rest.annotation.*; -import org.apache.juneau.rest.client.*; import org.apache.juneau.rest.config.*; import org.apache.juneau.rest.mock.*; import org.junit.*; @@ -238,7 +237,7 @@ public class Remote_RemoteMethodAnnotation_Test { @Test public void d01_returnTypes_partSerialization() throws Exception { - D1 x = client(D.class).openApi().build().getRemote(D1.class); + D1 x = MockRestClient.create(D.class).openApi().build().getRemote(D1.class); assertEquals("foo",x.postX1("foo")); assertEquals("foo",IOUtils.read(x.postX2("foo").getEntity().getContent())); assertEquals("foo",IOUtils.read(x.postX3("foo"))); @@ -257,10 +256,6 @@ public class Remote_RemoteMethodAnnotation_Test { // Helper methods. //-- - private static RestClientBuilder client(Class c) { - return MockRestClient.create(c).simpleJson(); - } - private static T remote(Class rest, Class t) { return MockRestClient.build(rest).getRemote(t); } diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java index f9218d9..6c1f025 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/PropertyStore.java @@ -20,6 +20,7 @@ import java.lang.reflect.*; import java.util.*; import org.apache.juneau.PropertyStoreBuilder.*; +import org.apache.juneau.assertions.*; import org.apache.juneau.collections.*; import org.apache.juneau.internal.*; import org.apache.juneau.json.*; @@ -565,6 +566,7 @@ public final class PropertyStore { * @return A new property instance. */
[juneau] branch master updated: Configurable boolean properties should default to false.
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 0817f7c Configurable boolean properties should default to false. 0817f7c is described below commit 0817f7c6da4effd1fa00a2cdffaa7a9dda6c78b1 Author: JamesBognar AuthorDate: Fri Nov 13 12:24:57 2020 -0500 Configurable boolean properties should default to false. --- .../apache/juneau/dto/swagger/ui/SwaggerUI.java| 2 +- .../36.RestBuiltInParameters.html | 2 +- .../07.MicroserviceJettyUiCustomization.html | 2 +- .../juneau-examples-rest-jetty.cfg | 2 +- .../rest/annotation/RestAnnotation_Test.java | 22 .../rest/annotation/Rest_AllowBodyParam_Test.java | 10 ++-- .../java/org/apache/juneau/rest/RestContext.java | 59 +++--- .../org/apache/juneau/rest/RestContextBuilder.java | 41 +++ .../org/apache/juneau/rest/annotation/Rest.java| 12 ++--- .../juneau/rest/annotation/RestAnnotation.java | 36 ++--- .../juneau-sc-server/juneau-server-config.cfg | 2 +- 11 files changed, 80 insertions(+), 110 deletions(-) diff --git a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/ui/SwaggerUI.java b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/ui/SwaggerUI.java index c5ab2ee..dd9b361 100644 --- a/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/ui/SwaggerUI.java +++ b/juneau-core/juneau-dto/src/main/java/org/apache/juneau/dto/swagger/ui/SwaggerUI.java @@ -70,7 +70,7 @@ public class SwaggerUI extends PojoSwap { public static final String SWAGGERUI_resolveRefsMaxDepth = PREFIX + "resolveRefsMaxDepth.i"; - static final ResourceManager RESOURCES = new ResourceManager(SwaggerUI.class, BasicResourceFinder.INSTANCE, Boolean.getBoolean("RestContext.useClasspathResourceCaching.b")); + static final ResourceManager RESOURCES = new ResourceManager(SwaggerUI.class, BasicResourceFinder.INSTANCE, ! Boolean.getBoolean("RestContext.disableClasspathResourceCaching.b")); private static final Set STANDARD_METHODS = ASet.of("get", "put", "post", "delete", "options"); diff --git a/juneau-doc/docs/Topics/06.juneau-rest-server/36.RestBuiltInParameters.html b/juneau-doc/docs/Topics/06.juneau-rest-server/36.RestBuiltInParameters.html index 7bdecf7..68b17fb 100644 --- a/juneau-doc/docs/Topics/06.juneau-rest-server/36.RestBuiltInParameters.html +++ b/juneau-doc/docs/Topics/06.juneau-rest-server/36.RestBuiltInParameters.html @@ -63,7 +63,7 @@ Built-in Parameters body=X Pass in the HTTP body content on PUT and POST methods as a UON-encoded GET parameter. - Must be enabled via {@link oajr.annotation.Rest#allowBodyParam() @Rest(allowBodyParam)} setting. + Can be disabled via {@link oajr.annotation.Rest#disableAllowBodyParam() @Rest(disableAllowBodyParam)} setting. diff --git a/juneau-doc/docs/Topics/12.juneau-microservice-jetty/07.MicroserviceJettyUiCustomization.html b/juneau-doc/docs/Topics/12.juneau-microservice-jetty/07.MicroserviceJettyUiCustomization.html index 9938d1d..00a8524 100644 --- a/juneau-doc/docs/Topics/12.juneau-microservice-jetty/07.MicroserviceJettyUiCustomization.html +++ b/juneau-doc/docs/Topics/12.juneau-microservice-jetty/07.MicroserviceJettyUiCustomization.html @@ -122,6 +122,6 @@ UI Customization # Disable classpath resource caching. # Useful if you're attached using a debugger and you're modifying classpath resources while running. - RestContext.useClasspathResourceCaching.b = false + RestContext.disableClasspathResourceCaching.b = true diff --git a/juneau-examples/juneau-examples-rest-jetty/juneau-examples-rest-jetty.cfg b/juneau-examples/juneau-examples-rest-jetty/juneau-examples-rest-jetty.cfg index 24c7561..366a923 100755 --- a/juneau-examples/juneau-examples-rest-jetty/juneau-examples-rest-jetty.cfg +++ b/juneau-examples/juneau-examples-rest-jetty/juneau-examples-rest-jetty.cfg @@ -178,7 +178,7 @@ derby.stream.error.file = $C{Logging/logDir}/derby-errors.log # Disable classpath resource caching. # Useful if you're attached using a debugger and you're modifying classpath resources while running. -RestContext.useClasspathResourceCaching.b = false +RestContext.disableClasspathResourceCaching.b = true #=== # DockerRegistryResource properties diff --git a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/annotation/RestAnnotation_Te
[juneau] branch master updated: JUnit tests.
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 877338d JUnit tests. 877338d is described below commit 877338de7866f05bad7f89ab8cb694a39d4c0bf7 Author: JamesBognar AuthorDate: Thu Nov 12 15:33:40 2020 -0500 JUnit tests. --- .../BeanConfigAnnotation_Test.java | 16 +++ .../main/java/org/apache/juneau/BeanContext.java | 40 .../main/java/org/apache/juneau/BeanSession.java | 50 +-- .../org/apache/juneau/BeanTraverseContext.java | 8 ++-- .../org/apache/juneau/BeanTraverseSession.java | 8 ++-- .../src/main/java/org/apache/juneau/Context.java | 8 ++-- .../org/apache/juneau/annotation/BeanConfig.java | 56 +++--- .../juneau/annotation/BeanConfigAnnotation.java| 8 8 files changed, 79 insertions(+), 115 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotation_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java similarity index 96% rename from juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotation_Test.java rename to juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java index dff21d7..4031434 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotation_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/annotation/BeanConfigAnnotation_Test.java @@ -10,7 +10,7 @@ // * "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; +package org.apache.juneau.annotation; import static org.junit.Assert.*; import static org.junit.runners.MethodSorters.*; @@ -19,7 +19,7 @@ import java.util.*; import java.util.function.*; import java.util.stream.*; -import org.apache.juneau.annotation.*; +import org.apache.juneau.*; import org.apache.juneau.collections.*; import org.apache.juneau.internal.*; import org.apache.juneau.json.*; @@ -110,7 +110,6 @@ public class BeanConfigAnnotation_Test { beanConstructorVisibility="$X{PRIVATE}", dictionary={A1.class,A2.class}, dictionary_replace={A1.class,A2.class,A3.class}, - dictionary_remove=A2.class, beanFieldVisibility="$X{PRIVATE}", beanMapPutReturnsOldValue="$X{true}", beanMethodVisibility="$X{PRIVATE}", @@ -134,13 +133,10 @@ public class BeanConfigAnnotation_Test { mediaType="$X{text/foo}", notBeanClasses={A1.class,A2.class}, notBeanClasses_replace={A1.class,A2.class,A3.class}, - notBeanClasses_remove=A2.class, notBeanPackages={"$X{foo1}","$X{foo2}"}, notBeanPackages_replace={"$X{foo1}","$X{foo2}","$X{foo3}"}, - notBeanPackages_remove={"$X{foo2}"}, swaps={AB1.class,AB2.class}, swaps_replace={AB1.class,AB2.class,AB3.class}, - swaps_remove=AB2.class, propertyNamer=PropertyNamerULC.class, sortProperties="$X{true}", timeZone="$X{z}", @@ -158,7 +154,7 @@ public class BeanConfigAnnotation_Test { check("PRIVATE", bc.getBeanClassVisibility()); check("PRIVATE", bc.getBeanConstructorVisibility()); - check("A1,A3", bc.getBeanDictionaryClasses()); + check("A1,A2,A3", bc.getBeanDictionaryClasses()); check("PRIVATE", bc.getBeanFieldVisibility()); check("true", bc.isBeanMapPutReturnsOldValue()); check("PRIVATE", bc.getBeanMethodVisibility()); @@ -180,9 +176,9 @@ public class BeanConfigAnnotation_Test { check("en_US", bc.getLocale()); check("1", bc.getMaxDepth()); check("application/json", bc.getMediaType()); - check("A1,A3", bc.getNotBeanClasses()); - check("foo1,foo3", bc.getNotBeanPackagesNames()); - check("AB1,AB3", bc.getSwaps()); + check("A1,A2,A3", bc.getNotBeanClasses()); +
[juneau] branch master updated: Remove unused/untested APIs.
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 8ffdc92 Remove unused/untested APIs. 8ffdc92 is described below commit 8ffdc92a9e0460eabefff1cc9c7bf20e62c7325b Author: JamesBognar AuthorDate: Thu Nov 12 15:09:52 2020 -0500 Remove unused/untested APIs. --- .../juneau/http/header/BasicDateHeader_Test.java | 2 +- .../java/org/apache/juneau/oapi/OpenApiTest.java | 1 - .../apache/juneau/testutils}/CalendarUtils.java| 2 +- .../org/apache/juneau/internal/ClassTreeSet.java | 47 --- .../org/apache/juneau/internal/MappedIterable.java | 65 .../apache/juneau/internal/TeeOutputStream.java| 133 --- .../java/org/apache/juneau/internal/TeeWriter.java | 139 --- .../apache/juneau/internal/WriterOutputStream.java | 340 - .../apache/juneau/serializer/WriterSerializer.java | 11 - .../java/org/apache/juneau/utils/IdGenerator.java | 35 -- .../java/org/apache/juneau/utils/IdGenerators.java | 83 - .../main/java/org/apache/juneau/utils/IdMap.java | 106 -- .../java/org/apache/juneau/utils/ProcBuilder.java | 411 - .../org/apache/juneau/utils/StringMessage.java | 78 .../java/org/apache/juneau/utils/StringObject.java | 98 - .../java/org/apache/juneau/utils/ZipFileList.java | 173 - pom.xml| 1 - 17 files changed, 2 insertions(+), 1723 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/header/BasicDateHeader_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/header/BasicDateHeader_Test.java index 40942ad..f72cd6a 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/header/BasicDateHeader_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/header/BasicDateHeader_Test.java @@ -24,7 +24,7 @@ import org.apache.juneau.internal.*; import org.apache.juneau.rest.annotation.*; import org.apache.juneau.rest.client.*; import org.apache.juneau.rest.mock.*; -import org.apache.juneau.utils.*; +import org.apache.juneau.testutils.*; import static org.apache.juneau.assertions.Assertions.*; import static org.apache.juneau.http.header.BasicDateHeader.*; diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/oapi/OpenApiTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/oapi/OpenApiTest.java index 982a794..23e6c38 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/oapi/OpenApiTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/oapi/OpenApiTest.java @@ -25,7 +25,6 @@ import org.apache.juneau.collections.*; import org.apache.juneau.httppart.*; import org.apache.juneau.marshall.*; import org.apache.juneau.testutils.*; -import org.apache.juneau.utils.*; import org.junit.*; /** diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/CalendarUtils.java similarity index 99% rename from juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java rename to juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/CalendarUtils.java index da1c152..bc0d7ea 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/utils/CalendarUtils.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/testutils/CalendarUtils.java @@ -10,7 +10,7 @@ // * "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.utils; +package org.apache.juneau.testutils; import static org.apache.juneau.internal.DateUtils.*; import static org.apache.juneau.internal.StringUtils.*; diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassTreeSet.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassTreeSet.java deleted file mode 100644 index eca4e5a..000 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/ClassTreeSet.java +++ /dev/null @@ -1,47 +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
[juneau] branch master updated: Add @RemoteMethod(value) and @RestMethod(value) annotations.
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 a8cbb94 Add @RemoteMethod(value) and @RestMethod(value) annotations. a8cbb94 is described below commit a8cbb94815a0ba038d97b2796a12d5c20031507f Author: JamesBognar AuthorDate: Thu Nov 12 14:40:01 2020 -0500 Add @RemoteMethod(value) and @RestMethod(value) annotations. --- .../org/apache/juneau/http/remote/Remote_Test.java | 12 .../apache/juneau/http/remote/RemoteMethod.java| 29 juneau-doc/docs/ReleaseNotes/9.0.0.html| 20 ++ .../rest/client/remote/RemoteMethodMeta.java | 11 .../rest/annotation/RestMethodAnnotation_Test.java | 11 ++-- .../apache/juneau/rest/annotation/RestMethod.java | 28 +++ .../rest/annotation/RestMethodAnnotation.java | 32 -- 7 files changed, 138 insertions(+), 5 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java index 3876a94..13d5047 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/http/remote/Remote_Test.java @@ -239,17 +239,29 @@ public class Remote_Test { public String x1() { return "foo"; } + @RestMethod("GET") + public String x2() { + return "bar"; + } + @RestMethod("GET /x3") + public String x3x() { + return "baz"; + } } @Remote(path="/") public static interface C1 { String x1(); + @RemoteMethod("GET") String x2(); + @RemoteMethod("GET /x3") String x3x(); } @Test public void c01_overriddenRootUrl() throws Exception { C1 x = client(C.class).build().getRemote(C1.class,"http://localhost/C1;); assertEquals("foo",x.x1()); + assertEquals("bar",x.x2()); + assertEquals("baz",x.x3x()); } @Test diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/remote/RemoteMethod.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/remote/RemoteMethod.java index 071b372..a5db17b 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/remote/RemoteMethod.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/remote/RemoteMethod.java @@ -56,6 +56,9 @@ public @interface RemoteMethod { * @RemoteMethod * public void postPet(...) {...} * +* +* +* Note that you can also use {@link #value()} to specify the method name and path in shortened form. */ String path() default ""; @@ -73,6 +76,9 @@ public @interface RemoteMethod { * * * If the method cannot be inferred, then the default is "GET". +* +* +* Note that you can also use {@link #value()} to specify the method name and path in shortened form. */ String method() default ""; @@ -113,4 +119,27 @@ public @interface RemoteMethod { * */ RemoteReturn returns() default RemoteReturn.BODY; + + /** +* REST method name and path. +* +* +* Can be used to provide a shortened combined form for the {@link #method()} and {@link #path()} values. +* +* +* The following examples are considered equivalent. +* +* // Normal form +* @RemoteMethod(method=PUT, path="/{propertyName}") +* +* // Shortened form +* @RemoteMethod("PUT /{propertyName}") +* +* +* +* +* The path portion is optional. +* +*/ + String value() default ""; } diff --git a/juneau-doc/docs/ReleaseNotes/9.0.0.html b/juneau-doc/docs/ReleaseNotes/9.0.0.html index 30a3eff..e5b5031 100644 --- a/juneau-doc/docs/ReleaseNotes/9.0.0.html +++ b/juneau-doc/docs/ReleaseNotes/9.0.0.html @@ -40,6 +40,15 @@ Juneau 9.0.0 is a major release. public Object myRestMethod() { ... } } + + New shortened form {@link oaj.http.remote.annotation.RemoteMethod#value()} for specifying http m
[juneau] branch master updated: Update POM versions to 9.0.0.
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 98c94e6 Update POM versions to 9.0.0. 98c94e6 is described below commit 98c94e69a794448b6cdb8a2941561c384ef0f1e2 Author: JamesBognar AuthorDate: Thu Nov 12 12:36:57 2020 -0500 Update POM versions to 9.0.0. --- juneau-core/juneau-config/pom.xml | 2 +- juneau-core/juneau-core-utest/pom.xml | 2 +- juneau-core/juneau-dto/pom.xml | 2 +- juneau-core/juneau-marshall-rdf/pom.xml| 2 +- juneau-core/juneau-marshall/pom.xml| 2 +- juneau-core/pom.xml| 2 +- juneau-doc/pom.xml | 2 +- juneau-examples/juneau-examples-core/pom.xml | 2 +- .../juneau-examples-rest-jetty-ftest/pom.xml | 2 +- .../juneau-examples-rest-jetty.launch | 26 +-- juneau-examples/juneau-examples-rest-jetty/pom.xml | 2 +- .../juneau-examples-rest-springboot.launch | 28 ++-- .../juneau-examples-rest-springboot/pom.xml| 2 +- juneau-examples/juneau-examples-rest/pom.xml | 2 +- juneau-examples/pom.xml| 2 +- .../juneau-microservice-core/pom.xml | 2 +- .../juneau-microservice-test.launch| 30 +++--- .../juneau-microservice-ftest/pom.xml | 2 +- .../juneau-microservice-jetty/pom.xml | 2 +- .../juneau-microservice-test.launch| 30 +++--- .../my-jetty-microservice.launch | 28 ++-- .../juneau-my-jetty-microservice/pom.xml | 4 +-- .../my-springboot-microservice.launch | 28 ++-- .../juneau-my-springboot-microservice/pom.xml | 4 +-- juneau-microservice/pom.xml| 2 +- juneau-release-env.sh | 6 ++--- juneau-releng/juneau-all/pom.xml | 2 +- juneau-releng/juneau-distrib/pom.xml | 2 +- juneau-releng/pom.xml | 2 +- juneau-rest/juneau-rest-client-utest/pom.xml | 2 +- juneau-rest/juneau-rest-client/pom.xml | 2 +- juneau-rest/juneau-rest-mock-utest/pom.xml | 2 +- juneau-rest/juneau-rest-mock/pom.xml | 2 +- juneau-rest/juneau-rest-server-jaxrs/pom.xml | 2 +- juneau-rest/juneau-rest-server-rdf/pom.xml | 2 +- juneau-rest/juneau-rest-server-springboot/pom.xml | 2 +- juneau-rest/juneau-rest-server-utest/pom.xml | 2 +- juneau-rest/juneau-rest-server/pom.xml | 2 +- juneau-rest/pom.xml| 2 +- juneau-sc/juneau-sc-client/pom.xml | 2 +- juneau-sc/juneau-sc-server/pom.xml | 2 +- juneau-sc/pom.xml | 2 +- launches/juneau-env.sh | 2 +- pom.xml| 2 +- 44 files changed, 127 insertions(+), 127 deletions(-) diff --git a/juneau-core/juneau-config/pom.xml b/juneau-core/juneau-config/pom.xml index 4e42a90..64e7a22 100644 --- a/juneau-core/juneau-config/pom.xml +++ b/juneau-core/juneau-config/pom.xml @@ -20,7 +20,7 @@ org.apache.juneau juneau-core - 8.2.1-SNAPSHOT + 9.0.0-SNAPSHOT juneau-config diff --git a/juneau-core/juneau-core-utest/pom.xml b/juneau-core/juneau-core-utest/pom.xml index 7e50d57..49455ac 100644 --- a/juneau-core/juneau-core-utest/pom.xml +++ b/juneau-core/juneau-core-utest/pom.xml @@ -20,7 +20,7 @@ org.apache.juneau juneau-core - 8.2.1-SNAPSHOT + 9.0.0-SNAPSHOT juneau-core-utest diff --git a/juneau-core/juneau-dto/pom.xml b/juneau-core/juneau-dto/pom.xml index e6e6690..1dcab03 100644 --- a/juneau-core/juneau-dto/pom.xml +++ b/juneau-core/juneau-dto/pom.xml @@ -20,7 +20,7 @@ org.apache.juneau juneau-core - 8.2.1-SNAPSHOT + 9.0.0-SNAPSHOT juneau-dto diff --git a/juneau-core/juneau-marshall-rdf/pom.xml b/juneau-core/juneau-marshall-rdf/pom.xml index 353dc53..1369e04 100644 --- a/juneau-core/juneau-marshall-rdf/pom.xml +++ b/juneau-core/juneau-marshall-rdf/pom.xml @@ -20,7 +20,7 @@ org.apache.juneau juneau-core - 8.2.1-SNAPSHOT + 9.0.0-SNAPSHOT juneau-marshall-rdf diff --git a/juneau-core/juneau-marshall/pom.xml b/juneau-core/juneau-marshall/pom.xml index 645d55c..6bcfd93 100644 --- a/juneau-core/juneau-marshall/pom.xml +++ b
[juneau] branch master updated: Remove all applyX annotations.
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 df08236 Remove all applyX annotations. df08236 is described below commit df082369f322a30b7dc011da110113ead4d8dd93 Author: JamesBognar AuthorDate: Thu Nov 12 09:51:55 2020 -0500 Remove all applyX annotations. --- .../java/org/apache/juneau/PropertyStoreTest.java | 15 ++--- .../juneau/a/rttests/RoundTripBeanMapsTest.java| 10 -- .../org/apache/juneau/html/BasicHtml_Test.java | 36 -- .../java/org/apache/juneau/html/Html_Test.java | 26 ++-- .../test/java/org/apache/juneau/json/JsonTest.java | 18 +++ .../juneau/jsonschema/JsonSchemaGeneratorTest.java | 32 +-- .../org/apache/juneau/testutils/pojos/XBeans.java | 2 +- .../java/org/apache/juneau/urlencoding/DTOs2.java | 4 ++- .../org/apache/juneau/jena/annotation/Rdf.java | 3 +- .../apache/juneau/jena/annotation/RdfConfig.java | 13 .../jena/annotation/RdfConfigAnnotation.java | 4 --- .../java/org/apache/juneau/annotation/Bean.java| 30 ++ .../java/org/apache/juneau/csv/annotation/Csv.java | 3 +- .../apache/juneau/csv/annotation/CsvConfig.java| 13 .../juneau/csv/annotation/CsvConfigAnnotation.java | 6 .../org/apache/juneau/html/annotation/Html.java| 3 +- .../apache/juneau/html/annotation/HtmlConfig.java | 26 .../html/annotation/HtmlConfigAnnotation.java | 6 .../apache/juneau/html/annotation/HtmlLink.java| 3 +- .../java/org/apache/juneau/jso/annotation/Jso.java | 3 +- .../apache/juneau/jso/annotation/JsoConfig.java| 13 .../juneau/jso/annotation/JsoConfigAnnotation.java | 6 .../org/apache/juneau/json/annotation/Json.java| 3 +- .../apache/juneau/json/annotation/JsonConfig.java | 13 .../json/annotation/JsonConfigAnnotation.java | 4 --- .../jsonschema/annotation/JsonSchemaConfig.java| 13 .../annotation/JsonSchemaConfigAnnotation.java | 4 --- .../juneau/jsonschema/annotation/Schema.java | 3 +- .../apache/juneau/msgpack/annotation/MsgPack.java | 3 +- .../juneau/msgpack/annotation/MsgPackConfig.java | 13 .../annotation/MsgPackConfigAnnotation.java| 4 --- .../org/apache/juneau/oapi/annotation/OpenApi.java | 3 +- .../juneau/oapi/annotation/OpenApiConfig.java | 13 .../oapi/annotation/OpenApiConfigAnnotation.java | 3 -- .../juneau/plaintext/annotation/PlainText.java | 3 +- .../plaintext/annotation/PlainTextConfig.java | 13 .../annotation/PlainTextConfigAnnotation.java | 6 .../org/apache/juneau/soap/annotation/SoapXml.java | 3 +- .../juneau/soap/annotation/SoapXmlConfig.java | 13 .../soap/annotation/SoapXmlConfigAnnotation.java | 4 --- .../java/org/apache/juneau/uon/annotation/Uon.java | 3 +- .../apache/juneau/uon/annotation/UonConfig.java| 13 .../juneau/uon/annotation/UonConfigAnnotation.java | 4 --- .../juneau/urlencoding/annotation/UrlEncoding.java | 3 +- .../urlencoding/annotation/UrlEncodingConfig.java | 13 .../annotation/UrlEncodingConfigAnnotation.java| 5 --- .../java/org/apache/juneau/xml/annotation/Xml.java | 3 +- .../apache/juneau/xml/annotation/XmlConfig.java| 13 .../juneau/xml/annotation/XmlConfigAnnotation.java | 4 --- juneau-doc/docs/ReleaseNotes/9.0.0.html| 15 + .../apache/juneau/rest/annotation/Body_Test.java | 7 ++--- 51 files changed, 174 insertions(+), 305 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java index c604b14..1284e4f 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/PropertyStoreTest.java @@ -1797,17 +1797,22 @@ public class PropertyStoreTest { public void testEqualsWithAnnotations() { HtmlSerializer s1 = HtmlSerializer.create().build(), - s2 = HtmlSerializer.create().applyAnnotations(B1.class).build(), - s3 = HtmlSerializer.create().applyAnnotations(B1.class).build(), - s4 = HtmlSerializer.create().applyAnnotations(B2.class).build(); + s2 = HtmlSerializer.create().applyAnnotations(B1Config.class).build(), + s3 = HtmlSerializer.create().applyAnnotations(B1Config.class).build(), + s4 = HtmlSerializer.create().applyAnnotations(B2Config.class).build(); assertFalse(s1
[juneau] branch master updated: Annotation improvements.
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 d80acb8 Annotation improvements. d80acb8 is described below commit d80acb8cd4c9fce4e1ec9d2cb5cdab71fd837699 Author: JamesBognar AuthorDate: Wed Nov 11 19:01:28 2020 -0500 Annotation improvements. --- .../java/org/apache/juneau/BeanConfigTest.java | 11 +- .../java/org/apache/juneau/BeanFilterTest.java | 24 ++-- .../java/org/apache/juneau/BeanMapErrorsTest.java | 32 +++-- .../test/java/org/apache/juneau/BeanMapTest.java | 36 -- .../java/org/apache/juneau/PojoExamplesTest.java | 40 +-- .../apache/juneau/ReadWriteOnlyPropertiesTest.java | 32 ++--- .../a/rttests/RoundTripTransformBeansTest.java | 34 -- .../a/rttests/RountTripBeansWithBuilders.java | 8 +- .../apache/juneau/annotation/BeanIgnore_Test.java | 18 +-- .../org/apache/juneau/annotation/Bean_Test.java| 17 ++- .../juneau/jsonschema/JsonSchemaGeneratorTest.java | 84 - .../org/apache/juneau/serializer/TestURIc.java | 10 +- .../juneau/serializer/UriResolutionTest.java | 36 +++--- .../org/apache/juneau/testutils/pojos/XBeans.java | 3 +- .../apache/juneau/transform/AutoListSwapTest.java | 26 +++-- .../apache/juneau/transform/AutoMapSwapTest.java | 24 ++-- .../juneau/transform/AutoNumberSwapTest.java | 24 ++-- .../juneau/transform/AutoObjectSwapTest.java | 24 ++-- .../apache/juneau/transforms/DefaultSwapsTest.java | 24 ++-- .../java/org/apache/juneau/urlencoding/DTOs2.java | 4 +- .../main/java/org/apache/juneau/BeanContext.java | 5 - .../main/java/org/apache/juneau/MetaProvider.java | 21 ++-- .../org/apache/juneau/PropertyStoreBuilder.java| 1 + .../org/apache/juneau/annotation/BeanConfig.java | 130 - .../juneau/annotation/BeanConfigAnnotation.java| 21 .../org/apache/juneau/annotation/BeanIgnore.java | 4 +- .../java/org/apache/juneau/annotation/Beanc.java | 21 ++-- .../java/org/apache/juneau/annotation/Beanp.java | 2 +- .../java/org/apache/juneau/annotation/Example.java | 4 +- .../juneau/annotation/ExampleAnnotation.java | 2 +- .../org/apache/juneau/annotation/Marshalled.java | 8 +- .../org/apache/juneau/annotation/NameProperty.java | 4 +- .../apache/juneau/annotation/ParentProperty.java | 4 +- .../annotation/ParentPropertyAnnotation.java | 2 +- .../java/org/apache/juneau/annotation/Swap.java| 3 +- .../apache/juneau/annotation/SwapAnnotation.java | 2 +- .../java/org/apache/juneau/annotation/Uri.java | 4 +- .../juneau/examples/rest/RequestEchoResource.java | 8 +- .../juneau/examples/rest/dto/AtomFeedResource.java | 4 +- .../examples/rest/dto/JsonSchemaResource.java | 4 +- .../apache/juneau/rest/annotation/Body_Test.java | 6 +- 41 files changed, 377 insertions(+), 394 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java index 1c5e5ac..78eaebe 100755 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java @@ -432,7 +432,7 @@ public class BeanConfigTest { @Test public void testReadOnlyProperties_usingConfig() throws Exception { - BeanSession session = BeanContext.DEFAULT.builder().applyAnnotations(ReadOnlyPerson2.class).build().createSession(); + BeanSession session = BeanContext.DEFAULT.builder().applyAnnotations(ReadOnlyPerson2Config.class).build().createSession(); Object o; // Bean to String @@ -445,7 +445,6 @@ public class BeanConfigTest { } - @BeanConfig(applyBean=@Bean(on="ReadOnlyPerson2",p="name,age"),applyBeanc=@Beanc(on="ReadOnlyPerson2(String,int)",properties="name,age")) public static class ReadOnlyPerson2 { private final String name; private final int age; @@ -470,6 +469,14 @@ public class BeanConfigTest { } } + @Bean(on="Dummy1",p="dummy") + @Bean(on="ReadOnlyPerson2",p="name,age") + @Bean(on="Dummy2",p="dummy") + @Beanc(on="Dummy1",properties="dummy") + @Beanc(on="ReadOnlyPerson2(String,int)",properties="name,age") + @Beanc(on="Dummy2",properties="dummy") + private static class ReadOnlyPerson2Config {} + //===
[juneau] branch master updated: Annotation improvements.
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 fbb4d3e Annotation improvements. fbb4d3e is described below commit fbb4d3ea74da8009edb0736c301e20bf6b30d989 Author: JamesBognar AuthorDate: Wed Nov 11 14:54:49 2020 -0500 Annotation improvements. --- .../jsonschema/JsonSchemaConfigAnnotationTest.java | 5 - .../juneau/jsonschema/JsonSchemaGeneratorTest.java | 104 - .../juneau/html/HtmlSchemaSerializerBuilder.java | 5 +- .../juneau/json/JsonSchemaSerializerBuilder.java | 5 +- .../juneau/jsonschema/JsonSchemaGenerator.java | 44 - .../jsonschema/JsonSchemaGeneratorBuilder.java | 5 +- .../jsonschema/JsonSchemaGeneratorSession.java | 21 + .../jsonschema/annotation/JsonSchemaConfig.java| 20 .../annotation/JsonSchemaConfigAnnotation.java | 3 - 9 files changed, 73 insertions(+), 139 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaConfigAnnotationTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaConfigAnnotationTest.java index a82633a..2ae1ccb 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaConfigAnnotationTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaConfigAnnotationTest.java @@ -20,7 +20,6 @@ import java.util.function.*; import java.util.stream.*; import org.apache.juneau.*; -import org.apache.juneau.annotation.*; import org.apache.juneau.jsonschema.annotation.*; import org.apache.juneau.reflect.*; import org.apache.juneau.svl.*; @@ -62,7 +61,6 @@ public class JsonSchemaConfigAnnotationTest { allowNestedDescriptions="$X{true}", allowNestedExamples="$X{true}", beanDefMapper=BasicBeanDefMapper.class, - defaultSchemas=@CS(k=A.class,v="{foo:'bar'}"), ignoreTypes="$X{foo}", useBeanDefs="$X{true}" ) @@ -78,7 +76,6 @@ public class JsonSchemaConfigAnnotationTest { check("true", x.isAllowNestedDescriptions()); check("true", x.isAllowNestedExamples()); check("BasicBeanDefMapper", x.getBeanDefMapper()); - check("{org.apache.juneau.jsonschema.JsonSchemaConfigAnnotationTest$A={foo:'bar'}}", x.getDefaultSchemas()); check("foo", x.getIgnoreTypes()); check("true", x.isUseBeanDefs()); } @@ -100,7 +97,6 @@ public class JsonSchemaConfigAnnotationTest { check("false", x.isAllowNestedDescriptions()); check("false", x.isAllowNestedExamples()); check("BasicBeanDefMapper", x.getBeanDefMapper()); - check("{}", x.getDefaultSchemas()); check("", x.getIgnoreTypes()); check("false", x.isUseBeanDefs()); } @@ -121,7 +117,6 @@ public class JsonSchemaConfigAnnotationTest { check("false", x.isAllowNestedDescriptions()); check("false", x.isAllowNestedExamples()); check("BasicBeanDefMapper", x.getBeanDefMapper()); - check("{}", x.getDefaultSchemas()); check("", x.getIgnoreTypes()); check("false", x.isUseBeanDefs()); } diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java index 547fa50..0c4e962 100755 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/jsonschema/JsonSchemaGeneratorTest.java @@ -21,6 +21,8 @@ import org.apache.juneau.*; import org.apache.juneau.annotation.*; import org.apache.juneau.collections.*; import org.apache.juneau.jsonschema.annotation.*; +import org.apache.juneau.reflect.*; +import org.apache.juneau.svl.*; import org.apache.juneau.testutils.pojos.*; import org.apache.juneau.transform.*; import org.junit.*; @@ -1215,27 +1217,27 @@ public class JsonSchemaGeneratorTest { .defaultSchema(char.class, OMap.of("type", "bar")) .defaultSchema(TestEnumToString.class, OMap.of("type", "bar")) .build().createSession(); - assertObject(s.getSchema(SimpleBean.class)).json().is(&q
[juneau] branch master updated: Annotation improvements.
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 f98b764 Annotation improvements. f98b764 is described below commit f98b764a609482e9d1f3522a01e9709b35ee7b3a Author: JamesBognar AuthorDate: Fri Nov 6 10:03:28 2020 -0500 Annotation improvements. --- .../apache/juneau/reflection/ClassInfoTest.java| 6 +- .../apache/juneau/reflection/MethodInfoTest.java | 6 +- .../juneau/jena/annotation/RdfAnnotation.java | 10 +- .../jena/annotation/RdfConfigAnnotation.java | 8 +- .../main/java/org/apache/juneau/ConfigApply.java | 34 ++--- .../org/apache/juneau/PropertyStoreBuilder.java| 6 +- .../apache/juneau/annotation/BeanAnnotation.java | 10 +- .../juneau/annotation/BeanConfigAnnotation.java| 8 +- .../juneau/annotation/BeanIgnoreAnnotation.java| 10 +- .../apache/juneau/annotation/BeancAnnotation.java | 10 +- .../apache/juneau/annotation/BeanpAnnotation.java | 10 +- .../juneau/annotation/ExampleAnnotation.java | 10 +- .../juneau/annotation/MarshalledAnnotation.java| 10 +- .../juneau/annotation/NamePropertyAnnotation.java | 10 +- .../annotation/ParentPropertyAnnotation.java | 10 +- .../apache/juneau/annotation/SwapAnnotation.java | 10 +- .../apache/juneau/annotation/UriAnnotation.java| 10 +- .../juneau/csv/annotation/CsvAnnotation.java | 10 +- .../juneau/csv/annotation/CsvConfigAnnotation.java | 8 +- .../juneau/html/annotation/HtmlAnnotation.java | 10 +- .../html/annotation/HtmlConfigAnnotation.java | 8 +- .../html/annotation/HtmlDocConfigAnnotation.java | 8 +- .../juneau/html/annotation/HtmlLinkAnnotation.java | 10 +- .../juneau/http/annotation/BodyAnnotation.java | 10 +- .../juneau/http/annotation/FormDataAnnotation.java | 10 +- .../juneau/http/annotation/HeaderAnnotation.java | 10 +- .../juneau/http/annotation/PathAnnotation.java | 10 +- .../juneau/http/annotation/QueryAnnotation.java| 10 +- .../juneau/http/annotation/RequestAnnotation.java | 10 +- .../juneau/http/annotation/ResponseAnnotation.java | 10 +- .../http/annotation/ResponseBodyAnnotation.java| 10 +- .../http/annotation/ResponseHeaderAnnotation.java | 10 +- .../http/annotation/ResponseStatusAnnotation.java | 10 +- .../juneau/jso/annotation/JsoAnnotation.java | 10 +- .../juneau/jso/annotation/JsoConfigAnnotation.java | 8 +- .../juneau/json/annotation/JsonAnnotation.java | 10 +- .../json/annotation/JsonConfigAnnotation.java | 8 +- .../jsonschema/JsonSchemaBeanPropertyMeta.java | 2 +- .../juneau/jsonschema/JsonSchemaClassMeta.java | 2 +- .../org/apache/juneau/jsonschema/SchemaUtils.java | 148 - .../annotation/ExternalDocsAnnotation.java | 22 +++ .../annotation/JsonSchemaConfigAnnotation.java | 8 +- .../jsonschema/annotation/SchemaAnnotation.java| 92 - .../jsonschema/annotation/SubItemsAnnotation.java | 38 ++ .../msgpack/annotation/MsgPackAnnotation.java | 10 +- .../annotation/MsgPackConfigAnnotation.java| 8 +- .../juneau/oapi/annotation/OpenApiAnnotation.java | 10 +- .../oapi/annotation/OpenApiConfigAnnotation.java | 8 +- .../parser/annotation/ParserConfigAnnotation.java | 8 +- .../plaintext/annotation/PlainTextAnnotation.java | 10 +- .../annotation/PlainTextConfigAnnotation.java | 8 +- .../annotation/SerializerConfigAnnotation.java | 8 +- .../juneau/soap/annotation/SoapXmlAnnotation.java | 10 +- .../soap/annotation/SoapXmlConfigAnnotation.java | 8 +- .../juneau/uon/annotation/UonAnnotation.java | 10 +- .../juneau/uon/annotation/UonConfigAnnotation.java | 8 +- .../annotation/UrlEncodingAnnotation.java | 10 +- .../annotation/UrlEncodingConfigAnnotation.java| 8 +- .../juneau/xml/annotation/XmlAnnotation.java | 10 +- .../juneau/xml/annotation/XmlConfigAnnotation.java | 8 +- .../juneau/rest/annotation/RestAnnotation.java | 8 +- .../rest/annotation/RestMethodAnnotation.java | 8 +- 62 files changed, 440 insertions(+), 398 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java index f2716b2..6ea45e4 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/reflection/ClassInfoTest.java @@ -64,11 +64,11 @@ public class ClassInfoTest { } public static class AConfigApply extends ConfigApply { - protected AConfigApply(Class c, VarResolverSession r) { - super(c
[juneau-petstore] branch master updated: Fix broken SOURCE link.
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-petstore.git The following commit(s) were added to refs/heads/master by this push: new 0d80e66 Fix broken SOURCE link. 0d80e66 is described below commit 0d80e66c229ee8fac1e0d9bc872829c2c24d9d88 Author: JamesBognar AuthorDate: Tue Oct 20 09:04:15 2020 -0400 Fix broken SOURCE link. --- juneau-petstore-server/src/main/resources/juneau.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/juneau-petstore-server/src/main/resources/juneau.cfg b/juneau-petstore-server/src/main/resources/juneau.cfg index 98e4574..ef5716e 100755 --- a/juneau-petstore-server/src/main/resources/juneau.cfg +++ b/juneau-petstore-server/src/main/resources/juneau.cfg @@ -61,7 +61,7 @@ includeRowNums = false # Source code location #=== [Source] -gitHub = https://github.com/apache/juneau/blob/master/juneau-examples/juneau-examples-rest/src/main/java +gitHub = https://github.com/apache/juneau-petstore/blob/master/juneau-petstore-server/src/main/java/ #=== # PetStoreResource properties
[juneau-petstore] branch master updated: Updates for Juneau 8.2.0
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-petstore.git The following commit(s) were added to refs/heads/master by this push: new 600b081 Updates for Juneau 8.2.0 600b081 is described below commit 600b081dedf5ecee6706b9fb4cf660d5748dc7ab Author: JamesBognar AuthorDate: Mon Oct 19 15:45:26 2020 -0400 Updates for Juneau 8.2.0 --- Dockerfile | 2 +- juneau-petstore-api/pom.xml| 2 +- juneau-petstore-client/pom.xml | 2 +- juneau-petstore-server/pom.xml | 2 +- pom.xml| 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d40cb0c..ef45abf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN mvn clean package -DskipTests FROM java:8 -COPY --from=build ./juneau-petstore-server/target/juneau-petstore-server-8.1.2-SNAPSHOT.war ./run.war +COPY --from=build ./juneau-petstore-server/target/juneau-petstore-server-8.2.0-SNAPSHOT.war ./run.war EXPOSE 5000 diff --git a/juneau-petstore-api/pom.xml b/juneau-petstore-api/pom.xml index cfbc538..b320d95 100644 --- a/juneau-petstore-api/pom.xml +++ b/juneau-petstore-api/pom.xml @@ -20,7 +20,7 @@ org.apache.juneau.petstore juneau-petstore -8.1.2-SNAPSHOT +8.2.0-SNAPSHOT juneau-petstore-api diff --git a/juneau-petstore-client/pom.xml b/juneau-petstore-client/pom.xml index 44c9906..9645c48 100644 --- a/juneau-petstore-client/pom.xml +++ b/juneau-petstore-client/pom.xml @@ -20,7 +20,7 @@ org.apache.juneau.petstore juneau-petstore -8.1.2-SNAPSHOT +8.2.0-SNAPSHOT juneau-petstore-client diff --git a/juneau-petstore-server/pom.xml b/juneau-petstore-server/pom.xml index f90efeb..d034034 100644 --- a/juneau-petstore-server/pom.xml +++ b/juneau-petstore-server/pom.xml @@ -16,7 +16,7 @@ http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> 4.0.0 -8.1.2-SNAPSHOT +8.2.0-SNAPSHOT org.springframework.boot diff --git a/pom.xml b/pom.xml index bb1c4d5..2ebe36d 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.apache.juneau.petstore juneau-petstore -8.1.2-SNAPSHOT +8.2.0-SNAPSHOT pom Apache Juneau Petstore Application Sample application for demonstrating Apache Juneau.
[juneau-petstore] branch master updated: Updates for Juneau 8.2.0
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-petstore.git The following commit(s) were added to refs/heads/master by this push: new c03eb20 Updates for Juneau 8.2.0 new 1bc5eb5 Merge branch 'master' of https://gitbox.apache.org/repos/asf/juneau-petstore.git c03eb20 is described below commit c03eb202329a1c67776473ed374a5032c9b8c371 Author: JamesBognar AuthorDate: Mon Oct 19 15:35:21 2020 -0400 Updates for Juneau 8.2.0 --- Dockerfile | 13 + .../java/org/apache/juneau/petstore/PetStore.java | 2 +- .../java/org/apache/juneau/petstore/dto/Pet.java | 6 +- .../main/java/org/apache/juneau/petstore/Main.java | 41 +-- juneau-petstore-server/pom.xml | 4 +- .../main/java/org/apache/juneau/petstore/App.java | 24 +- .../juneau/petstore/rest/PetStoreResource.java | 2 +- .../apache/juneau/petstore/rest/RootResources.java | 1 - .../src/main/resources/htdocs/images/asf.png | Bin 0 -> 8875 bytes .../src/main/resources/htdocs/images/juneau.png| Bin 0 -> 6274 bytes .../src/main/resources/htdocs/styles/SwaggerUI.css | 342 + .../src/main/resources/htdocs/themes/dark.css | 285 + .../src/main/resources/htdocs/themes/devops.css| 275 + .../src/main/resources/htdocs/themes/light.css | 272 .../src/main/resources/htdocs/themes/original.css | 236 ++ .../juneau/petstore/service/init/Orders.json} | 31 +- .../apache/juneau/petstore/service/init/Pets.json} | 37 +-- .../juneau/petstore/service/init/Users.json} | 31 +- .../org/apache/juneau/petstore/test/MockTest.java | 276 - pom.xml| 2 +- 20 files changed, 1612 insertions(+), 268 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16bf7af..c21a507 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,16 @@ +# *** +# * 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. * +# *** + FROM maven:3.5-jdk-8 as build COPY . . diff --git a/juneau-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java b/juneau-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java index 5db76c5..76d184f 100644 --- a/juneau-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java +++ b/juneau-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java @@ -12,7 +12,7 @@ // *** package org.apache.juneau.petstore; -import static org.apache.juneau.http.HttpMethodName.*; +import static org.apache.juneau.http.HttpMethod.*; import java.util.*; diff --git a/juneau-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java b/juneau-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java index 40c1222..c7fb76b 100644 --- a/juneau-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java +++ b/juneau-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java @@ -71,7 +71,7 @@ public class Pet { this.name = x.getName(); this.price = x.getPrice(); this.species = x.getSpecies(); - this.tags = x.getTags() == null ? null : Arrays.asList(x.getTags()); +
[juneau] branch master updated: Clean up deprecated code.
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 b21fa24 Clean up deprecated code. b21fa24 is described below commit b21fa24b76c3014483dcab17266ac1f2208fcb66 Author: JamesBognar AuthorDate: Fri Oct 16 11:36:34 2020 -0400 Clean up deprecated code. --- .../java/org/apache/juneau/rest/widget/Widget.java | 27 -- 1 file changed, 27 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Widget.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Widget.java index d04facb..76f9d81 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Widget.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/widget/Widget.java @@ -102,15 +102,6 @@ public abstract class Widget implements HtmlWidget { } /** -* Implement {@link #getHtml(RestRequest, RestResponse)}. -*/ - @SuppressWarnings("javadoc") - @Deprecated - public String getHtml(RestRequest req) throws Exception { - return getHtml(req, null); - } - - /** * Resolves any Javascript that should be added to the head/script element. * * @@ -126,15 +117,6 @@ public abstract class Widget implements HtmlWidget { } /** -* Implement {@link #getScript(RestRequest, RestResponse)}. -*/ - @SuppressWarnings("javadoc") - @Deprecated - public String getScript(RestRequest req) throws Exception { - return getScript(req, null); - } - - /** * Resolves any CSS styles that should be added to the head/style element. * * @@ -150,15 +132,6 @@ public abstract class Widget implements HtmlWidget { } /** -* Implement {@link #getStyle(RestRequest, RestResponse)}. -*/ - @SuppressWarnings("javadoc") - @Deprecated - public String getStyle(RestRequest req) throws Exception { - return getStyle(req, null); - } - - /** * Retrieves the specified classpath resource and returns the contents as a string. * *
[juneau] branch master updated: Clean up deprecated code.
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 369353e Clean up deprecated code. 369353e is described below commit 369353edabadd24809ee8bb182a381eae42b85d0 Author: JamesBognar AuthorDate: Fri Oct 16 11:33:07 2020 -0400 Clean up deprecated code. --- .../java/org/apache/juneau/rest/RestContext.java | 13 +-- .../org/apache/juneau/rest/RestContextBuilder.java | 98 --- .../org/apache/juneau/rest/RestMethodContext.java | 8 -- .../java/org/apache/juneau/rest/RestRequest.java | 16 --- .../org/apache/juneau/rest/vars/WidgetVar.java | 108 - 5 files changed, 1 insertion(+), 242 deletions(-) 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 7fc6749..784dd22 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 @@ -3428,16 +3428,6 @@ public class RestContext extends BeanContext { */ public static final String REST_uriResolution = PREFIX + ".uriResolution.s"; - /** -* Configuration property: HTML Widgets. -* -* -* Deprecated - Use {@link HtmlDocSerializer#HTMLDOC_widgets} -* -*/ - @Deprecated - public static final String REST_widgets = PREFIX + ".widgets.lo"; - //--- // Static @@ -3599,7 +3589,6 @@ public class RestContext extends BeanContext { * @param builder The servlet configuration object. * @throws Exception If any initialization problems were encountered. */ - @SuppressWarnings("deprecation") public RestContext(RestContextBuilder builder) throws Exception { super(builder.getPropertyStore()); @@ -3635,7 +3624,7 @@ public class RestContext extends BeanContext { SwaggerVar.class, UrlVar.class, UrlEncodeVar.class, - WidgetVar.class + HtmlWidgetVar.class ) .build() ; 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 3229149..0474b6f 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 @@ -30,7 +30,6 @@ import org.apache.juneau.config.*; import org.apache.juneau.config.vars.*; import org.apache.juneau.cp.*; import org.apache.juneau.encoders.*; -import org.apache.juneau.html.*; import org.apache.juneau.http.*; import org.apache.juneau.http.exception.*; import org.apache.juneau.httppart.*; @@ -42,7 +41,6 @@ import org.apache.juneau.rest.annotation.*; import org.apache.juneau.rest.reshandlers.*; import org.apache.juneau.rest.util.RestUtils; import org.apache.juneau.rest.vars.*; -import org.apache.juneau.rest.widget.*; import org.apache.juneau.serializer.*; import org.apache.juneau.svl.*; import org.apache.juneau.svl.vars.*; @@ -2262,102 +2260,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon return set(REST_useClasspathResourceCaching, value); } - /** -* RestContext configuration property: HTML Widgets. -* -* -* Deprecated - Use {@link HtmlDocSerializerBuilder#widgets(Class[])} -* -* -* -* Defines widgets that can be used in conjunction with string variables of the form "$W{name}"to quickly -* generate arbitrary replacement text. -* -* -* {@link RestContext#REST_widgets} -* -* -* @param values The values to add to this setting. -* @return This object (for method chaining). -* -*/ - @SuppressWarnings("unchecked") - @Deprecated - @FluentSetter - public RestContextBuilder widgets(Class...values) { - return prependTo(REST_widgets, values); - } - - /** -* RestContext configuration property: HTML Widgets. -* -* -* Deprecated - Use {@l
[juneau] branch master updated: Clean up deprecated code.
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 03e4fdb Clean up deprecated code. 03e4fdb is described below commit 03e4fdbe5165f351a1bce07ce7114be8bb7b8773 Author: JamesBognar AuthorDate: Fri Oct 16 11:19:08 2020 -0400 Clean up deprecated code. --- .../apache/juneau/BeanConfigAnnotationTest.java| 8 - .../main/java/org/apache/juneau/BeanContext.java | 197 - .../src/main/java/org/apache/juneau/BeanMeta.java | 8 +- .../main/java/org/apache/juneau/annotation/SC.java | 25 --- .../main/java/org/apache/juneau/annotation/SS.java | 25 --- 5 files changed, 4 insertions(+), 259 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java index e369e7f..0028d45 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java @@ -222,10 +222,6 @@ public class BeanConfigAnnotationTest { check("false", bc.isBeansRequireSettersForGetters()); check("true", bc.isBeansRequireSomeProperties()); check("_type", bc.getBeanTypePropertyName()); - check("", bc.getBpi()); - check("", bc.getBpx()); - check("", bc.getBpro()); - check("", bc.getBpwo()); check("false", bc.isDebug()); check("false", bc.isDetectRecursions()); check("", bc.getExamples()); @@ -273,10 +269,6 @@ public class BeanConfigAnnotationTest { check("false", bc.isBeansRequireSettersForGetters()); check("true", bc.isBeansRequireSomeProperties()); check("_type", bc.getBeanTypePropertyName()); - check("", bc.getBpi()); - check("", bc.getBpx()); - check("", bc.getBpro()); - check("", bc.getBpwo()); check("false", bc.isDebug()); check("false", bc.isDetectRecursions()); check("", bc.getExamples()); diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java index 67ecd61..7daec07 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java @@ -1096,46 +1096,6 @@ public class BeanContext extends Context implements MetaProvider { public static final String BEAN_typePropertyName = PREFIX + ".typePropertyName.s"; /** -* Configuration property: Bean property includes. -* -* -* Deprecated - Use {@link Bean#bpi()} and {@link BeanConfig#bpi()} -* -*/ - @Deprecated - public static final String BEAN_bpi = PREFIX + ".bpi.sms"; - - /** -* Configuration property: Bean property excludes. -* -* -* Deprecated - Use {@link Bean#bpx()} and {@link BeanConfig#bpx()} -* -*/ - @Deprecated - public static final String BEAN_bpx = PREFIX + ".bpx.sms"; - - /** -* Configuration property: Read-only bean properties. -* -* -* Deprecated - Use {@link Bean#bpro()} and {@link BeanConfig#bpro()} -* -*/ - @Deprecated - public static final String BEAN_bpro = PREFIX + ".bpro.sms"; - - /** -* Configuration property: Write-only bean properties. -* -* -* Deprecated - Use {@link Bean#bpwo()} and {@link BeanConfig#bpwo()} -* -*/ - @Deprecated - public static final String BEAN_bpwo = PREFIX + ".bpwo.sms"; - - /** * Configuration property: POJO examples. * * Property: @@ -2285,7 +2245,6 @@ public class BeanContext extends Context implements MetaProvider { private final Map examples; private final BeanRegistry beanRegistry; private final Map implClasses; - private final Map> bpi, bpx, bpro, bpwo; private final PropertyNamer propertyNamer; private final String typePropertyName; private final int beanHashCode; @@ -2403,27 +2362,6 @@ public class BeanContext extends Context implements MetaProv
[juneau] branch master updated: Rename @URI to @Uri
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 63b3af0 Rename @URI to @Uri 63b3af0 is described below commit 63b3af02d4f0e38408bb33445a9087a76be1fe57 Author: JamesBognar AuthorDate: Fri Oct 16 10:45:06 2020 -0400 Rename @URI to @Uri --- .../java/org/apache/juneau/SerializerPropertiesComboTest.java | 2 +- .../src/test/java/org/apache/juneau/serializer/TestURI.java| 10 +- .../src/test/java/org/apache/juneau/serializer/TestURIc.java | 2 +- .../test/java/org/apache/juneau/testutils/pojos/TestURI.java | 8 .../src/main/java/org/apache/juneau/BeanPropertyMeta.java | 10 +- .../src/main/java/org/apache/juneau/ClassMeta.java | 2 +- .../src/main/java/org/apache/juneau/annotation/BeanConfig.java | 6 +++--- .../java/org/apache/juneau/annotation/{URI.java => Uri.java} | 2 +- .../main/java/org/apache/juneau/annotation/UriAnnotation.java | 6 +++--- .../src/main/java/org/apache/juneau/serializer/Serializer.java | 4 ++-- .../java/org/apache/juneau/serializer/SerializerBuilder.java | 4 ++-- .../apache/juneau/serializer/annotation/SerializerConfig.java | 4 ++-- .../juneau/rest/client/RestClient_Config_Serializer_Test.java | 2 +- .../java/org/apache/juneau/rest/client/RestClientBuilder.java | 4 ++-- 14 files changed, 33 insertions(+), 33 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/SerializerPropertiesComboTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/SerializerPropertiesComboTest.java index 6477760..b4c98d0 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/SerializerPropertiesComboTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/SerializerPropertiesComboTest.java @@ -420,7 +420,7 @@ public class SerializerPropertiesComboTest extends ComboRoundTripTest { } public static class T9 { - @URI + @Uri public String f = "foo"; } diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURI.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURI.java index 801bded..d82fdc9 100755 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURI.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURI.java @@ -23,7 +23,7 @@ import org.apache.juneau.xml.annotation.*; public class TestURI { // String annotated as a URI - @org.apache.juneau.annotation.URI + @Uri @Rdf(beanUri=true) @Xml(format=XmlFormat.ATTR) public String f0 = "f0/x0"; @@ -47,7 +47,7 @@ public class TestURI { fio = null; // Strings annotated with @URI properties - @org.apache.juneau.annotation.URI + @Uri public String f2a = "http://www.apache.org/f2a;, f2b = "/f2b", @@ -66,7 +66,7 @@ public class TestURI { f2o = null; // Strings with labels - @org.apache.juneau.annotation.URI + @Uri public String f3a = "http://www.apache.org/f3a/x?label=MY_LABEL=bar;, f3b = StringUtils.urlEncode("<>&'\""), @@ -76,12 +76,12 @@ public class TestURI { public TestURIb f4 = new TestURIb(); // @URI on bean property method. - @org.apache.juneau.annotation.URI + @Uri public String getF5() { return "f5/x"; } - @org.apache.juneau.annotation.URI + @Uri public static class TestURIb { @Override /* Object */ public String toString() { diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURIc.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURIc.java index 3b2c390..7063b50 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURIc.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/serializer/TestURIc.java @@ -22,7 +22,7 @@ import org.apache.juneau.xml.annotation.*; @Bean(sort=true) @BeanConfig( applyURI={ - @org.apache.juneau.annotation.URI(on="TestURIc.f0,TestURIc.f2a,TestURIc.f2b,TestURIc.f2c,TestURIc.f2d,TestURIc.f2e,TestURIc.f2f,TestURIc.f2g,TestURIc.f2h,TestURIc.f2i,TestURIc.f2j,TestURIc.f2k,TestURIc.f2l,TestURIc.f2m,TestURIc.f2n,TestURIc.f2o,TestURIc.f3a,,TestURIc.f3b,TestURIc.f3c,TestURIc.getF5,TestURIbc") + @Uri(on="TestURIc.f0,TestURIc.f2a,TestURIc.f2b,TestURIc.f2c,TestURIc.f2d,TestURIc.f
[juneau] branch master updated: Remove deprecated code.
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 3858884 Remove deprecated code. 3858884 is described below commit 3858884d2f13af18745ae8286ec9dc1245a6c1ef Author: JamesBognar AuthorDate: Fri Oct 16 10:27:31 2020 -0400 Remove deprecated code. --- .../apache/juneau/annotation/UriAnnotation.java| 32 ++ 1 file changed, 32 insertions(+) diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/UriAnnotation.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/UriAnnotation.java index 84129b0..5cdfa72 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/UriAnnotation.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/annotation/UriAnnotation.java @@ -13,6 +13,7 @@ package org.apache.juneau.annotation; import java.lang.annotation.*; +import java.lang.reflect.*; import org.apache.juneau.*; @@ -36,5 +37,36 @@ public class UriAnnotation extends TargetedAnnotation.OnClassMethodField impleme } // + + @Override /* GENERATED - TargetedAnnotation */ + public UriAnnotation on(String...value) { + super.on(value); + return this; + } + + @Override /* GENERATED - OnClass */ + public UriAnnotation on(java.lang.Class...value) { + super.on(value); + return this; + } + + @Override /* GENERATED - OnClass */ + public UriAnnotation onClass(java.lang.Class...value) { + super.onClass(value); + return this; + } + + @Override /* GENERATED - OnClassMethodField */ + public UriAnnotation on(Field...value) { + super.on(value); + return this; + } + + @Override /* GENERATED - OnClassMethodField */ + public UriAnnotation on(Method...value) { + super.on(value); + return this; + } + // }
[juneau] branch master updated: Add @X(onClass) annotations.
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 988c777 Add @X(onClass) annotations. 988c777 is described below commit 988c7776e8519e2fa82b2ef181997a04d7d6ee2f Author: JamesBognar AuthorDate: Fri Oct 16 10:03:03 2020 -0400 Add @X(onClass) annotations. --- .../org/apache/juneau/jena/annotation/Rdf.java | 14 +- .../juneau/jena/annotation/RdfAnnotation.java | 106 +++ .../main/java/org/apache/juneau/BeanContext.java | 24 ++- .../java/org/apache/juneau/annotation/Bean.java| 14 +- .../apache/juneau/annotation/BeanAnnotation.java | 62 +++ .../org/apache/juneau/annotation/BeanIgnore.java | 14 +- .../juneau/annotation/BeanIgnoreAnnotation.java| 116 +++- .../java/org/apache/juneau/annotation/Beanc.java | 2 +- .../apache/juneau/annotation/BeancAnnotation.java | 64 ++- .../java/org/apache/juneau/annotation/Beanp.java | 2 +- .../apache/juneau/annotation/BeanpAnnotation.java | 91 +++-- .../java/org/apache/juneau/annotation/Example.java | 14 +- .../juneau/annotation/ExampleAnnotation.java | 107 +++ .../org/apache/juneau/annotation/NameProperty.java | 2 +- .../juneau/annotation/NamePropertyAnnotation.java | 73 ++-- .../apache/juneau/annotation/ParentProperty.java | 2 +- .../annotation/ParentPropertyAnnotation.java | 72 ++-- .../java/org/apache/juneau/annotation/Swap.java| 14 +- .../apache/juneau/annotation/SwapAnnotation.java | 120 .../juneau/annotation/TargetedAnnotation.java | 205 + .../java/org/apache/juneau/annotation/URI.java | 14 +- .../apache/juneau/annotation/UriAnnotation.java| 93 +- .../java/org/apache/juneau/csv/annotation/Csv.java | 14 +- .../juneau/csv/annotation/CsvAnnotation.java | 96 +++--- .../org/apache/juneau/html/annotation/Html.java| 14 +- .../juneau/html/annotation/HtmlAnnotation.java | 107 +++ .../apache/juneau/html/annotation/HtmlLink.java| 14 +- .../juneau/html/annotation/HtmlLinkAnnotation.java | 70 +++ .../juneau/http/annotation/AnnotationUtils.java| 4 +- .../java/org/apache/juneau/jso/annotation/Jso.java | 14 +- .../juneau/jso/annotation/JsoAnnotation.java | 96 +++--- .../org/apache/juneau/json/annotation/Json.java| 14 +- .../juneau/json/annotation/JsonAnnotation.java | 106 +++ .../juneau/jsonschema/annotation/Schema.java | 14 +- .../jsonschema/annotation/SchemaAnnotation.java| 70 +++ .../apache/juneau/msgpack/annotation/MsgPack.java | 14 +- .../msgpack/annotation/MsgPackAnnotation.java | 96 +++--- .../org/apache/juneau/oapi/annotation/OpenApi.java | 14 +- .../juneau/oapi/annotation/OpenApiAnnotation.java | 96 +++--- .../juneau/plaintext/annotation/PlainText.java | 14 +- .../plaintext/annotation/PlainTextAnnotation.java | 96 +++--- .../org/apache/juneau/soap/annotation/SoapXml.java | 14 +- .../juneau/soap/annotation/SoapXmlAnnotation.java | 96 +++--- .../java/org/apache/juneau/uon/annotation/Uon.java | 14 +- .../juneau/uon/annotation/UonAnnotation.java | 96 +++--- .../juneau/urlencoding/annotation/UrlEncoding.java | 14 +- .../annotation/UrlEncodingAnnotation.java | 98 +++--- .../java/org/apache/juneau/xml/annotation/Xml.java | 14 +- .../juneau/xml/annotation/XmlAnnotation.java | 106 +++ .../main/ConfigurablePropertyCodeGenerator.java| 51 - 50 files changed, 1061 insertions(+), 1630 deletions(-) diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/Rdf.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/Rdf.java index ca7854a..1ed4d1a 100644 --- a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/Rdf.java +++ b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/Rdf.java @@ -149,7 +149,19 @@ public @interface Rdf { * {@doc DynamicallyAppliedAnnotations} * */ - String on() default ""; + String[] on() default {}; + + /** +* Dynamically apply this annotation to the specified classes. +* +* +* Identical to {@link #on()} except allows you to specify class objects instead of a strings. +* +* +* {@doc DynamicallyAppliedAnnotations} +* +*/ + Class[] onClass() default {}; /** * Sets the XML prefix of this property or class. diff --git a/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/juneau/jena/annotation/RdfAnnotation.java b/juneau-core/juneau-marshall-rdf/src/main/java/org/apache/j
[juneau] branch master updated: Remove deprecated code.
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 38abd8a Remove deprecated code. 38abd8a is described below commit 38abd8a82ceb13c83c175ed3514262cfc97824c7 Author: JamesBognar AuthorDate: Thu Oct 15 15:09:19 2020 -0400 Remove deprecated code. --- .../apache/juneau/BeanConfigAnnotationTest.java| 10 +- .../java/org/apache/juneau/BeanConfigTest.java | 3 - .../main/java/org/apache/juneau/BeanContext.java | 89 +- .../java/org/apache/juneau/BeanContextBuilder.java | 42 - ...UnmodifiableBeanFilter.java => BeanFilter.java} | 22 ++--- .../BeanFilter.java => BeanFilterBuilder.java} | 101 + .../src/main/java/org/apache/juneau/BeanMap.java | 3 - .../src/main/java/org/apache/juneau/BeanMeta.java | 15 +-- .../main/java/org/apache/juneau/BeanSession.java | 11 --- .../src/main/java/org/apache/juneau/ClassMeta.java | 18 +--- .../org/apache/juneau/annotation/BeanConfig.java | 54 --- .../apache/juneau/annotation/BeanConfigApply.java | 7 -- .../juneau/examples/rest/RequestEchoResource.java | 7 +- .../apache/juneau/rest/jaxrs/JuneauProvider.java | 13 --- .../apache/juneau/rest/annotation/RestMethod.java | 42 - .../rest/annotation/RestMethodAnnotation.java | 18 .../rest/annotation/RestMethodConfigApply.java | 33 --- 17 files changed, 56 insertions(+), 432 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java index f8d367c..e369e7f 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java @@ -64,8 +64,8 @@ public class BeanConfigAnnotationTest { Map.Entry e = (Map.Entry)t; return apply(e.getKey()) + "=" + apply(e.getValue()); } - if (t instanceof UnmodifiableBeanFilter) - return ((UnmodifiableBeanFilter)t).getBeanClass().getSimpleName(); + if (t instanceof BeanFilter) + return ((BeanFilter)t).getBeanClass().getSimpleName(); if (t instanceof Class) return ((Class)t).getSimpleName(); if (t instanceof ClassInfo) @@ -112,9 +112,6 @@ public class BeanConfigAnnotationTest { dictionary_replace={A1.class,A2.class,A3.class}, dictionary_remove=A2.class, beanFieldVisibility="$X{PRIVATE}", - beanFilters={A1.class,A2.class}, - beanFilters_replace={A1.class,A2.class,A3.class}, - beanFilters_remove=A2.class, beanMapPutReturnsOldValue="$X{true}", beanMethodVisibility="$X{PRIVATE}", beansRequireDefaultConstructor="$X{true}", @@ -169,7 +166,6 @@ public class BeanConfigAnnotationTest { check("PRIVATE", bc.getBeanConstructorVisibility()); check("A1,A3", bc.getBeanDictionaryClasses()); check("PRIVATE", bc.getBeanFieldVisibility()); - check("A1,A3", bc.getBeanFilters()); check("true", bc.isBeanMapPutReturnsOldValue()); check("PRIVATE", bc.getBeanMethodVisibility()); check("true", bc.isBeansRequireDefaultConstructor()); @@ -219,7 +215,6 @@ public class BeanConfigAnnotationTest { check("PUBLIC", bc.getBeanConstructorVisibility()); check("", bc.getBeanDictionaryClasses()); check("PUBLIC", bc.getBeanFieldVisibility()); - check("", bc.getBeanFilters()); check("false", bc.isBeanMapPutReturnsOldValue()); check("PUBLIC", bc.getBeanMethodVisibility()); check("false", bc.isBeansRequireDefaultConstructor()); @@ -271,7 +266,6 @@ public class BeanConfigAnnotationTest { check("PUBLIC", bc.getBeanConstructorVisibility()); check("", bc.getBeanDictionaryClasses()); check("PUBLIC", bc.getBeanFieldVisibility()); - check("", bc.getBeanFilters()); check("false", bc.isBeanMapPutReturnsOldValue()); check("PUBLIC", bc.getBeanMethodVisibility());
[juneau] branch master updated: Simplify BeanConfig APIs
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 a6b6859 Simplify BeanConfig APIs a6b6859 is described below commit a6b68594985c8e00fb03f4c3238190b4a8bd1bbd Author: JamesBognar AuthorDate: Thu Oct 15 13:56:30 2020 -0400 Simplify BeanConfig APIs --- .../apache/juneau/BeanConfigAnnotationTest.java| 4 +- .../java/org/apache/juneau/BeanConfigTest.java | 6 +- .../main/java/org/apache/juneau/BeanContext.java | 42 +- .../src/main/java/org/apache/juneau/BeanMap.java | 2 +- .../src/main/java/org/apache/juneau/BeanMeta.java | 12 +- .../main/java/org/apache/juneau/BeanSession.java | 2 +- .../src/main/java/org/apache/juneau/ClassMeta.java | 12 +- .../org/apache/juneau/annotation/BeanConfig.java | 4 +- .../transform/AnnotationBeanFilterBuilder.java | 82 -- .../org/apache/juneau/transform/BeanFilter.java| 955 - .../apache/juneau/transform/BeanFilterBuilder.java | 672 --- .../transform/InterfaceBeanFilterBuilder.java | 99 --- ...BeanFilter.java => UnmodifiableBeanFilter.java} | 10 +- .../apache/juneau/rest/jaxrs/JuneauProvider.java | 4 +- 14 files changed, 782 insertions(+), 1124 deletions(-) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java index 96998e7..f8d367c 100644 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigAnnotationTest.java @@ -64,8 +64,8 @@ public class BeanConfigAnnotationTest { Map.Entry e = (Map.Entry)t; return apply(e.getKey()) + "=" + apply(e.getValue()); } - if (t instanceof BeanFilter) - return ((BeanFilter)t).getBeanClass().getSimpleName(); + if (t instanceof UnmodifiableBeanFilter) + return ((UnmodifiableBeanFilter)t).getBeanClass().getSimpleName(); if (t instanceof Class) return ((Class)t).getSimpleName(); if (t instanceof ClassInfo) diff --git a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java index 5207b6e..393c919 100755 --- a/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java +++ b/juneau-core/juneau-core-utest/src/test/java/org/apache/juneau/BeanConfigTest.java @@ -770,9 +770,9 @@ public class BeanConfigTest { public static class DummyPojoSwapA extends MapSwap {} public static class DummyPojoSwapB extends MapSwap {} public static class DummyPojoSwapC extends MapSwap {} - public static class DummyBeanFilterA extends BeanFilterBuilder {} - public static class DummyBeanFilterB extends BeanFilterBuilder {} - public static class DummyBeanFilterC extends BeanFilterBuilder {} + public static class DummyBeanFilterA extends BeanFilter {} + public static class DummyBeanFilterB extends BeanFilter {} + public static class DummyBeanFilterC extends BeanFilter {} public static class C {} private void assertSameCache(ParserBuilder p1b, ParserBuilder p2b) { diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java index 59eae57..6afb857 100644 --- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java +++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanContext.java @@ -40,7 +40,7 @@ import org.apache.juneau.utils.*; * * Provides the ability to wrap beans inside {@link Map} interfaces. * - * Serves as a repository for metadata on POJOs, such as associated {@link BeanFilter BeanFilters}, + * Serves as a repository for metadata on POJOs, such as associated {@link UnmodifiableBeanFilter BeanFilters}, * {@link PropertyNamer PropertyNamers}, etc... which are used to tailor how POJOs are serialized and parsed. * * @@ -485,7 +485,7 @@ public class BeanContext extends Context implements MetaProvider { * Methods: * * {@link org.apache.juneau.BeanContextBuilder#dictionary(Object...)} -* {@link org.apache.juneau.transform.BeanFilterBuilder#dictionary(Class...)} +*
[juneau] branch master updated: Remove deprecated code.
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 62e5f64 Remove deprecated code. 62e5f64 is described below commit 62e5f649fdc241e1903464db786d36972e464d5a Author: JamesBognar AuthorDate: Tue Oct 13 17:39:19 2020 -0400 Remove deprecated code. --- .../src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java | 3 --- .../main/java/org/apache/juneau/rest/jaxrs/JuneauProvider.java| 8 2 files changed, 11 deletions(-) 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 1cc30a7..413ae19 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 @@ -47,7 +47,6 @@ public class BaseProvider implements MessageBodyReader, MessageBodyWrite /** * Constructor. */ - @SuppressWarnings("deprecation") protected BaseProvider() { try { properties = new OMap(); @@ -60,14 +59,12 @@ public class BaseProvider implements MessageBodyReader, MessageBodyWrite serializers = SerializerGroup.create() .append(jp.serializers()) - .swaps((Object[])jp.pojoSwaps()) .swaps((Object[])jp.swaps()) .set(properties) .build(); parsers = ParserGroup.create() .append(jp.parsers()) - .swaps((Object[])jp.pojoSwaps()) .swaps((Object[])jp.swaps()) .set(properties) .build(); 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 ed6193b..8c62363 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 @@ -53,14 +53,6 @@ public @interface JuneauProvider { Class[] beanFilters() default {}; /** -* Provider-level POJO swaps. -* -* @deprecated Use {@link #swaps()} -*/ - @Deprecated - Class[] pojoSwaps() default {}; - - /** * Provider-level properties. * *
[juneau] branch master updated: Remove deprecated code.
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 22a5923 Remove deprecated code. 22a5923 is described below commit 22a5923fb6f627d91216dc0a652894f4c72c2b73 Author: JamesBognar AuthorDate: Tue Oct 13 17:34:58 2020 -0400 Remove deprecated code. --- .../org/apache/juneau/rest/RestContextBuilder.java | 84 -- .../org/apache/juneau/rest/RestMethodContext.java | 55 -- 2 files changed, 139 deletions(-) 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 c007a9a..3229149 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 @@ -878,34 +878,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon } /** -* RestContext configuration property: Default request attributes. -* -* -* Deprecated - Use {@link #reqAttrs(String...)} -* -*/ - @SuppressWarnings("javadoc") - @Deprecated - @FluentSetter - public RestContextBuilder attrs(String...values) throws RestServletException { - return reqAttrs(values); - } - - /** -* RestContext configuration property: Default request headers. -* -* -* Deprecated - Use {@link #reqHeaders(String...)} -* -*/ - @SuppressWarnings("javadoc") - @Deprecated - @FluentSetter - public RestContextBuilder defaultRequestHeaders(String...headers) throws RestServletException { - return reqHeaders(headers); - } - - /** * Specifies a default Accept header value if not specified on a request. * * @param value @@ -936,62 +908,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon } /** -* RestContext configuration property: Default request attribute. -* -* -* Deprecated - Use {@link #reqAttr(String, Object)} -* -*/ - @SuppressWarnings("javadoc") - @Deprecated - @FluentSetter - public RestContextBuilder attr(String name, Object value) { - return reqAttr(name, value); - } - - /** -* RestContext configuration property: Default request headers. -* -* -* Deprecated - Use {@link #reqHeader(String,Object)} -* -*/ - @SuppressWarnings("javadoc") - @Deprecated - @FluentSetter - public RestContextBuilder defaultRequestHeader(String name, Object value) { - return reqHeader(name, value); - } - - /** -* RestContext configuration property: Default response headers. -* -* -* Deprecated - Use {@link #resHeaders(String...)} -* -*/ - @SuppressWarnings("javadoc") - @Deprecated - @FluentSetter - public RestContextBuilder defaultResponseHeaders(String...headers) throws RestServletException { - return resHeaders(headers); - } - - /** -* RestContext configuration property: Default response headers. -* -* -* Deprecated - Use {@link #resHeader(String, Object)} -* -*/ - @SuppressWarnings("javadoc") - @Deprecated - @FluentSetter - public RestContextBuilder defaultResponseHeader(String name, Object value) { - return resHeader(name, value); - } - - /** * RestContext configuration property: Compression encoders. * * diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java index da7881e..5d69d5c 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java @@ -68,16 +68,6 @@ public class RestMethodContext extends BeanContext implements Comparable -* Deprecated - Use {@link #RESTMETHOD_reqAttrs} -* -*/ - @Deprecated - public static final String RESTMETHOD_attrs = PREFIX + ".reqAttrs.smo"; - - /** * Configuration property: Client version pattern matcher. * * Property: @@ -257,16 +2
[juneau] branch master updated: Remove deprecated code.
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 bac681b Remove deprecated code. bac681b is described below commit bac681bf83ccda5dfd76643190bcfd9ab38f4a39 Author: JamesBognar AuthorDate: Tue Oct 13 17:30:55 2020 -0400 Remove deprecated code. --- .../org/apache/juneau/rest/annotation/Rest.java| 30 --- .../apache/juneau/rest/annotation/RestMethod.java | 44 -- .../rest/annotation/RestMethodAnnotation.java | 18 - .../rest/annotation/RestMethodConfigApply.java | 16 4 files changed, 108 deletions(-) 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 46a14fb..e952d4d 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 @@ -150,16 +150,6 @@ public @interface Rest { String allowedMethodParams() default ""; /** -* Default request attributes. -* -* -* Deprecated - Use {@link #reqAttrs()} -* -*/ - @Deprecated - String[] attrs() default {}; - - /** * REST children. * * @@ -496,26 +486,6 @@ public @interface Rest { String defaultContentType() default ""; /** -* Default request headers. -* -* -* Deprecated - Use {@link #reqHeaders()} -* -*/ - @Deprecated - String[] defaultRequestHeaders() default {}; - - /** -* Default response headers. -* -* -* Deprecated - Use {@link #resHeaders()} -* -*/ - @Deprecated - String[] defaultResponseHeaders() default {}; - - /** * Optional servlet description. * * 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 d3cfe80..406411d 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 @@ -38,16 +38,6 @@ import org.apache.juneau.http.remote.*; public @interface RestMethod { /** -* Default request attributes. -* -* -* Deprecated - Use {@link #reqAttrs()} -* -*/ - @Deprecated - String[] attrs() default {}; - - /** * Sets the bean filters for the serializers and parsers defined on this method. * * @@ -291,16 +281,6 @@ public @interface RestMethod { String[] defaultQuery() default {}; /** -* Default request headers. -* -* -* Deprecated - Use {@link #reqHeaders()} -* -*/ - @Deprecated - String[] defaultRequestHeaders() default {}; - - /** * Optional description for the exposed API. * * @@ -592,30 +572,6 @@ public @interface RestMethod { String[] paths() default {}; /** -* Sets the POJO swaps for the serializers and parsers defined on this method. -* -* -* Deprecated - Use {@link BeanConfig#swaps()} -* -* -* -* If no value is specified, the POJO swaps are inherited from the class. -* Otherwise, this value overrides the POJO swaps defined on the class. -* -* -* Use {@link Inherit} to inherit POJO swaps defined on the class. -* -* -* Use {@link None} to suppress inheriting POJO swaps defined on the class. -* -* -* {@link BeanContext#BEAN_swaps} -* -*/ - @Deprecated - Class[] pojoSwaps() default {}; - - /** * URL path pattern priority. * * 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 1bab2b9..ba2cea9 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 @@ -42,12 +42,10 @@ public class RestMethodAnnotation implements RestMethod { summary = "&q
[juneau] branch master updated: Remove deprecated code.
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 a914e50 Remove deprecated code. a914e50 is described below commit a914e50588127c3aefe56027a8ea3f2b4451fcba Author: JamesBognar AuthorDate: Tue Oct 13 17:25:48 2020 -0400 Remove deprecated code. --- .../java/org/apache/juneau/rest/RestContext.java | 94 -- .../org/apache/juneau/rest/RestContextBuilder.java | 31 --- .../java/org/apache/juneau/rest/RestRequest.java | 34 .../juneau/rest/annotation/RestConfigApply.java| 25 -- .../rest/annotation/RestMethodConfigApply.java | 8 -- 5 files changed, 192 deletions(-) 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 8009a84..7fc6749 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 @@ -29,7 +29,6 @@ import java.nio.charset.*; import java.time.*; import java.util.*; import java.util.concurrent.*; -import java.util.concurrent.atomic.*; import java.util.stream.*; import javax.activation.*; @@ -386,16 +385,6 @@ public class RestContext extends BeanContext { public static final String REST_allowedMethodParams = PREFIX + ".allowedMethodParams.s"; /** -* Configuration property: Allow header URL parameters. -* -* -* Deprecated - Use {@link #REST_allowedHeaderParams} -* -*/ - @Deprecated - public static final String REST_allowHeaderParams = PREFIX + ".allowHeaderParams.b"; - - /** * Configuration property: REST call logger. * * Property: @@ -1082,36 +1071,6 @@ public class RestContext extends BeanContext { public static final String REST_defaultCharset = PREFIX + ".defaultCharset.s"; /** -* Configuration property: Default request attributes. -* -* -* Deprecated - Use {@link #REST_reqAttrs} -* -*/ - @Deprecated - public static final String REST_attrs = PREFIX + ".reqAttrs.smo"; - - /** -* Configuration property: Default request headers. -* -* -* Deprecated - Use {@link #REST_reqHeaders} -* -*/ - @Deprecated - public static final String REST_defaultRequestHeaders = PREFIX + ".reqHeaders.smo"; - - /** -* Configuration property: Default response headers. -* -* -* Deprecated - Use {@link #REST_resHeaders} -* -*/ - @Deprecated - public static final String REST_defaultResponseHeaders = PREFIX + ".resHeaders.omo"; - - /** * Configuration property: Compression encoders. * * Property: @@ -1375,16 +1334,6 @@ public class RestContext extends BeanContext { public static final String REST_infoProvider = PREFIX + ".infoProvider.o"; /** -* Configuration property: REST logger. -* -* -* Deprecated - Use {@link #REST_callLogger} -* -*/ - @Deprecated - public static final String REST_logger = PREFIX + ".logger.o"; - - /** * Configuration property: The maximum allowed input size (in bytes) on HTTP requests. * * Property: @@ -3213,16 +3162,6 @@ public class RestContext extends BeanContext { public static final String REST_useClasspathResourceCaching = PREFIX + ".useClasspathResourceCaching.b"; /** -* Configuration property: Use stack trace hashes. -* -* -* Deprecated - Use {@link Logging#useStackTraceHashing} -* -*/ - @Deprecated - public static final String REST_useStackTraceHashes = PREFIX + ".useStackTraceHashes.b"; - - /** * Configuration property: Resource URI authority path. * * Property: @@ -3555,8 +3494,6 @@ public class RestContext extends BeanContext { renderResponseStackTraces, useClasspathResourceCaching; private final Enablement debug; - @Deprecated private final boolean - useStackTraceHashes; private final String clientVersionHeader, uriAuthority, @@ -3627,7 +3564,6 @@ public class RestContext extends BeanContext { private final Map staticFilesCache = new ConcurrentHashMap<>(); private final ResourceManager staticReso
[juneau] branch master updated: Remove deprecated code.
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 c2baa85 Remove deprecated code. c2baa85 is described below commit c2baa85e9a41411420a12f32efa4440c0f8d357d Author: JamesBognar AuthorDate: Tue Oct 13 17:11:44 2020 -0400 Remove deprecated code. --- .../org/apache/juneau/rest/BasicRestConfig.java| 126 - .../org/apache/juneau/rest/response/Accepted.java | 57 -- .../juneau/rest/response/AlreadyReported.java | 56 - .../org/apache/juneau/rest/response/Continue.java | 60 -- .../org/apache/juneau/rest/response/Created.java | 56 - .../apache/juneau/rest/response/EarlyHints.java| 56 - .../org/apache/juneau/rest/response/Found.java | 96 .../apache/juneau/rest/response/HttpResponse.java | 47 .../org/apache/juneau/rest/response/IMUsed.java| 56 - .../juneau/rest/response/MovedPermanently.java | 92 --- .../apache/juneau/rest/response/MultiStatus.java | 56 - .../juneau/rest/response/MultipleChoices.java | 57 -- .../org/apache/juneau/rest/response/NoContent.java | 56 - .../rest/response/NonAuthoritiveInformation.java | 56 - .../apache/juneau/rest/response/NotModified.java | 57 -- .../java/org/apache/juneau/rest/response/Ok.java | 60 -- .../juneau/rest/response/PartialContent.java | 57 -- .../juneau/rest/response/PermanentRedirect.java| 93 --- .../apache/juneau/rest/response/Processing.java| 58 -- .../apache/juneau/rest/response/ResetContent.java | 57 -- .../org/apache/juneau/rest/response/SeeOther.java | 118 --- .../juneau/rest/response/SwitchingProtocols.java | 56 - .../juneau/rest/response/TemporaryRedirect.java| 94 --- .../org/apache/juneau/rest/response/UseProxy.java | 57 -- .../apache/juneau/rest/response/package-info.java | 18 --- 25 files changed, 1652 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestConfig.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestConfig.java deleted file mode 100644 index b269c46..000 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestConfig.java +++ /dev/null @@ -1,126 +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 org.apache.juneau.annotation.*; -import org.apache.juneau.html.*; -import org.apache.juneau.html.annotation.*; -import org.apache.juneau.json.*; -import org.apache.juneau.msgpack.*; -import org.apache.juneau.oapi.*; -import org.apache.juneau.plaintext.*; -import org.apache.juneau.rest.annotation.*; -import org.apache.juneau.rest.config.*; -import org.apache.juneau.serializer.annotation.*; -import org.apache.juneau.soap.*; -import org.apache.juneau.uon.*; -import org.apache.juneau.urlencoding.*; -import org.apache.juneau.xml.*; - -/** - * Basic configuration for a REST resource that supports all languages. - * - * - * Classes that don't extend from {@link BasicRestServlet} can implement this interface to - * be configured with the same serializers/pars
[juneau] branch master updated: Remove deprecated code.
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 a54f232 Remove deprecated code. a54f232 is described below commit a54f232d5ae3675f117f158e87e6c145d848de66 Author: JamesBognar AuthorDate: Tue Oct 13 17:08:42 2020 -0400 Remove deprecated code. --- .../org/apache/juneau/rest/RestCallHandler.java| 117 - .../java/org/apache/juneau/rest/RestContext.java | 10 -- .../org/apache/juneau/rest/RestContextBuilder.java | 28 - .../org/apache/juneau/rest/annotation/Rest.java| 11 -- .../juneau/rest/annotation/RestConfigApply.java| 3 - 5 files changed, 169 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCallHandler.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCallHandler.java deleted file mode 100644 index 026f059..000 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestCallHandler.java +++ /dev/null @@ -1,117 +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.io.*; -import java.util.*; - -import javax.servlet.*; -import javax.servlet.http.*; - -/** - * Class that handles the basic lifecycle of an HTTP REST call. - * - * - * Deprecated - Use {@link RestContext#REST_context} and override methods. - * - */ -@Deprecated -public interface RestCallHandler { - - /** -* Represents no RestCallHandler. -*/ - public interface Null extends RestCallHandler {} - - /** -* The main service method. -* -* @param r1 The incoming HTTP servlet request object. -* @param r2 The incoming HTTP servlet response object. -* @throws ServletException Error occurred. -* @throws IOException Thrown by underlying stream. -*/ - public void execute(HttpServletRequest r1, HttpServletResponse r2) throws ServletException, IOException; - - /** -* Wraps an incoming servlet request/response pair into a single {@link RestCall} object. -* -* @param req The rest request. -* @param res The rest response. -* @return The wrapped request/response pair. -*/ - public RestCall createCall(HttpServletRequest req, HttpServletResponse res); - - /** -* Creates a {@link RestRequest} object based on the specified incoming {@link HttpServletRequest} object. -* -* @param call The current REST call. -* @return The wrapped request object. -* @throws ServletException If any errors occur trying to interpret the request. -*/ - public RestRequest createRequest(RestCall call) throws ServletException; - - /** -* Creates a {@link RestResponse} object based on the specified incoming {@link HttpServletResponse} object -* and the request returned by {@link #createRequest(RestCall)}. -* -* @param call The current REST call. -* @return The wrapped response object. -* @throws ServletException If any errors occur trying to interpret the request or response. -*/ - public RestResponse createResponse(RestCall call) throws ServletException; - - /** -* The main method f
[juneau] branch master updated: Remove deprecated code.
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 b2953a8 Remove deprecated code. b2953a8 is described below commit b2953a87b46557a0fb9f18da1340f46bd061511c Author: JamesBognar AuthorDate: Tue Oct 13 17:04:04 2020 -0400 Remove deprecated code. --- .../apache/juneau/rest/HttpRuntimeException.java | 5 +- .../java/org/apache/juneau/rest/RestContext.java | 10 +- .../org/apache/juneau/rest/RestContextBuilder.java | 26 --- .../java/org/apache/juneau/rest/RestException.java | 205 - .../apache/juneau/rest/RestMethodProperties.java | 57 -- .../apache/juneau/rest/exception/BadRequest.java | 89 - .../org/apache/juneau/rest/exception/Conflict.java | 89 - .../juneau/rest/exception/ExpectationFailed.java | 89 - .../juneau/rest/exception/FailedDependency.java| 89 - .../apache/juneau/rest/exception/Forbidden.java| 90 - .../org/apache/juneau/rest/exception/Gone.java | 93 -- .../rest/exception/HttpVersionNotSupported.java| 89 - .../juneau/rest/exception/InsufficientStorage.java | 89 - .../juneau/rest/exception/InternalServerError.java | 89 - .../juneau/rest/exception/LengthRequired.java | 89 - .../org/apache/juneau/rest/exception/Locked.java | 89 - .../apache/juneau/rest/exception/LoopDetected.java | 89 - .../juneau/rest/exception/MethodNotAllowed.java| 89 - .../juneau/rest/exception/MisdirectedRequest.java | 89 - .../exception/NetworkAuthenticationRequired.java | 90 - .../juneau/rest/exception/NotAcceptable.java | 89 - .../apache/juneau/rest/exception/NotExtended.java | 89 - .../org/apache/juneau/rest/exception/NotFound.java | 90 - .../juneau/rest/exception/NotImplemented.java | 90 - .../juneau/rest/exception/PayloadTooLarge.java | 89 - .../juneau/rest/exception/PreconditionFailed.java | 89 - .../rest/exception/PreconditionRequired.java | 90 - .../juneau/rest/exception/RangeNotSatisfiable.java | 90 - .../exception/RequestHeaderFieldsTooLarge.java | 89 - .../juneau/rest/exception/ServiceUnavailable.java | 90 - .../juneau/rest/exception/TooManyRequests.java | 90 - .../apache/juneau/rest/exception/Unauthorized.java | 92 - .../rest/exception/UnavailableForLegalReasons.java | 89 - .../juneau/rest/exception/UnprocessableEntity.java | 89 - .../rest/exception/UnsupportedMediaType.java | 90 - .../juneau/rest/exception/UpgradeRequired.java | 89 - .../apache/juneau/rest/exception/UriTooLong.java | 90 - .../rest/exception/VariantAlsoNegotiates.java | 89 - .../apache/juneau/rest/exception/package-info.java | 18 -- 39 files changed, 5 insertions(+), 3270 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HttpRuntimeException.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HttpRuntimeException.java index d5cdbfd..0e6b1d8 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HttpRuntimeException.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HttpRuntimeException.java @@ -68,12 +68,11 @@ public final class HttpRuntimeException extends BasicRuntimeException { * @param args The message arguments to pass to the ec class constructor. * @return RuntimeException The new exception to throw. */ - @SuppressWarnings("deprecation") public static RuntimeException toHttpException(Throwable t, Class ec, String msg, Object...args) { ClassInfo ci = ClassInfo.ofc(t); - // If it's a RestException or is any RuntimeException annotated with @Response, it can be rethrown. - if (ci.isRuntimeException() && (ci.isChildOf(RestException.class) || ci.hasAnnotation(Response.class))) + // If it's any RuntimeException annotated with @Response, it can be rethrown. + if (ci.isRuntimeException() && ci.hasAnnotation(Response.class)) return (RuntimeException)t; // If it's a non-RuntimeException but annotated with @Response, it can be wrapped and rethrown. 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 ab69106..dd4b08b 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java +++ b/juneau-rest/juneau-rest-serve
[juneau-website] branch asf-site updated: Fix build link.
This is an automated email from the ASF dual-hosted git repository. jamesbognar pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/juneau-website.git The following commit(s) were added to refs/heads/asf-site by this push: new 29c893b Fix build link. 29c893b is described below commit 29c893beabb60e054a35579618d55f20214fa3b2 Author: JamesBognar AuthorDate: Tue Oct 13 17:02:48 2020 -0400 Fix build link. --- content/sourceCode.html | 2 +- juneau-website.properties | 2 +- templates/sourceCode.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/sourceCode.html b/content/sourceCode.html index 079..64222be 100644 --- a/content/sourceCode.html +++ b/content/sourceCode.html @@ -34,7 +34,7 @@ Builds - Jenkins + Jenkins diff --git a/juneau-website.properties b/juneau-website.properties index 97b5b2f..28985de 100644 --- a/juneau-website.properties +++ b/juneau-website.properties @@ -1,2 +1,2 @@ -juneauVersion = 8.2.0 +juneauVersion = 8.2.1 juneauVersionNext = 9.0.0 diff --git a/templates/sourceCode.html b/templates/sourceCode.html index 079..64222be 100644 --- a/templates/sourceCode.html +++ b/templates/sourceCode.html @@ -34,7 +34,7 @@ Builds - Jenkins + Jenkins
[juneau] branch master updated: Remove deprecated code.
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 7132ee6 Remove deprecated code. 7132ee6 is described below commit 7132ee6e58d5f7e37a995718e6ed6b6d12a14bb8 Author: JamesBognar AuthorDate: Tue Oct 13 15:10:54 2020 -0400 Remove deprecated code. --- .../org/apache/juneau/rest/RequestProperties.java | 52 - .../org/apache/juneau/rest/RestMethodContext.java | 18 + .../juneau/rest/RestMethodContextBuilder.java | 13 .../org/apache/juneau/rest/RestParamDefaults.java | 16 +--- .../java/org/apache/juneau/rest/RestRequest.java | 86 +- .../java/org/apache/juneau/rest/RestResponse.java | 72 +- 6 files changed, 7 insertions(+), 250 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestProperties.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestProperties.java deleted file mode 100644 index 776ef67..000 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RequestProperties.java +++ /dev/null @@ -1,52 +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 org.apache.juneau.svl.*; - -/** - * Encapsulates request-level properties. - * - * - * Deprecated - Use {@link RequestAttributes} - * - * - * - * These are properties specified for a single HTTP request that extends the properties defined on {@link RestMethodProperties} - * and are accessible and modifiable through the following: - * - * {@link RestRequest#getProperties()} - * {@link RestRequest#prop(String, Object)} - * {@link RestResponse#getProperties()} - * {@link RestResponse#prop(String, Object)} - * - * - * - * {@doc RestConfigurableProperties} - * - */ -@SuppressWarnings("serial") -@Deprecated -public class RequestProperties extends ResolvingOMap { - - /** -* Constructor -* -* @param varResolver The request variable resolver session. -* @param inner The inner properties defined on the resource context. -*/ - public RequestProperties(VarResolverSession varResolver, RestMethodProperties inner) { - super(varResolver); - inner(inner); - } -} diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java index 0220546..da7881e 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestMethodContext.java @@ -597,8 +597,6 @@ public class RestMethodContext extends BeanContext implements Comparable 0 || m.flags().length > 0) { - properties = new RestMethodProperties(properties); - for (Property p1 : m.properties()) - properties.put(p1.name(), p1.value()); - for (String p1 : m.flags()) - properties.put(p1, true); - } - } catch (RestServletException e)
[juneau] branch master updated: Remove deprecated code.
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 7d8169e Remove deprecated code. 7d8169e is described below commit 7d8169e30dd9f4f43c7b5cc89cd7a6d253c2bd8a Author: JamesBognar AuthorDate: Tue Oct 13 15:05:08 2020 -0400 Remove deprecated code. --- .../apache/juneau/rest/BasicRestInfoProvider.java |9 - .../org/apache/juneau/rest/RestContextBuilder.java | 12 - .../java/org/apache/juneau/rest/RestException.java |3 +- .../java/org/apache/juneau/rest/RestServlet.java |4 - .../org/apache/juneau/rest/SwaggerGenerator.java | 60 - .../juneau/rest/annotation/RestResource.java | 1331 .../rest/annotation/RestResourceConfigApply.java | 315 - 7 files changed, 1 insertion(+), 1733 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java index 7e7581b..c671f24 100644 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java +++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestInfoProvider.java @@ -65,17 +65,8 @@ public class BasicRestInfoProvider implements RestInfoProvider { title, description; - @SuppressWarnings("deprecation") Builder(RestContext context) { ClassInfo ci = ClassInfo.of(context.getResource()).resolved(); - for (RestResource r : ci.getAnnotations(RestResource.class)) { - if (! r.siteName().isEmpty()) - siteName = r.siteName(); - if (r.title().length > 0) - title = joinnl(r.title()); - if (r.description().length > 0) - description = joinnl(r.description()); - } for (Rest r : ci.getAnnotations(Rest.class)) { if (! r.siteName().isEmpty()) siteName = r.siteName(); 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 61e7b4e..1417acf 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 @@ -110,7 +110,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon Config config; VarResolverBuilder varResolverBuilder; - @SuppressWarnings("deprecation") RestContextBuilder(ServletConfig servletConfig, Class resourceClass, RestContext parentContext) throws ServletException { this.inner = servletConfig; this.resourceClass = resourceClass; @@ -140,14 +139,10 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon VarResolver vr = varResolverBuilder.build(); - List> restResourceAnnotationsParentFirst = rci.getAnnotationInfos(RestResource.class); List> restAnnotationsParentFirst = rci.getAnnotationInfos(Rest.class); // Find our config file. It's the last non-empty @RestResource(config). String configPath = ""; - for (AnnotationInfo r : restResourceAnnotationsParentFirst) - if (! r.getAnnotation().config().isEmpty()) - configPath = r.getAnnotation().config(); for (AnnotationInfo r : restAnnotationsParentFirst) if (! r.getAnnotation().config().isEmpty()) configPath = r.getAnnotation().config(); @@ -180,13 +175,6 @@ public class RestContextBuilder extends BeanContextBuilder implements ServletCon // Load stuff from parent-to-child order. // This allows child settings to overwrite parent settings. - for (AnnotationInfo e : restResourceAnnotationsParentFirst) { - RestResource r = e.getAnnotation(); - for (Property p : r.properties()) - set(vr.resolve(p.name()), vr.resolve(p.value())); -
[juneau] branch master updated: Remove deprecated code.
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 11704e8 Remove deprecated code. 11704e8 is described below commit 11704e83fe498e17664461fd6c1fc77091dd699c Author: JamesBognar AuthorDate: Tue Oct 13 15:00:42 2020 -0400 Remove deprecated code. --- .../org/apache/juneau/rest/HtmlDocBuilder.java | 535 --- .../java/org/apache/juneau/rest/RestResponse.java | 48 -- .../org/apache/juneau/rest/annotation/HtmlDoc.java | 586 - .../apache/juneau/rest/annotation/RestMethod.java | 18 - .../rest/annotation/RestMethodAnnotation.java | 7 - .../rest/annotation/RestMethodConfigApply.java | 12 - .../juneau/rest/annotation/RestResource.java | 49 -- .../rest/annotation/RestResourceConfigApply.java | 11 - 8 files changed, 1266 deletions(-) diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HtmlDocBuilder.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HtmlDocBuilder.java deleted file mode 100644 index 12afa36..000 --- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/HtmlDocBuilder.java +++ /dev/null @@ -1,535 +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 static org.apache.juneau.html.HtmlDocSerializer.*; -import static org.apache.juneau.internal.StringUtils.*; - -import java.util.regex.*; - -import org.apache.juneau.*; -import org.apache.juneau.collections.*; -import org.apache.juneau.html.*; -import org.apache.juneau.html.annotation.*; -import org.apache.juneau.rest.annotation.*; -import org.apache.juneau.utils.*; - -/** - * Programmatic interface for setting properties used by the HtmlDoc serializer. - * - * - * Deprecated - Use {@link HtmlDocConfig} - * - * - * - * Basically just a convenience wrapper around the servlet or method level properties for setting properties defined - * by the {@link HtmlDocSerializer} class. - * - * - * This class is instantiated through the following methods: - * - * {@link RestResponse#getHtmlDocBuilder()} - Set values programmatically during a REST request. - * - * - * - * {@doc RestHtmlDocAnnotation} - * - */ -@Deprecated -public class HtmlDocBuilder { - - private final PropertyStoreBuilder builder; - - /** -* Constructor. -* -* @param builder The builder object. -*/ - public HtmlDocBuilder(PropertyStoreBuilder builder) { - this.builder = builder; - } - - /** -* Processes the contents of an {@link HtmlDoc} tag. -* -* @param hd The annotation to process. -*/ - public void process(HtmlDoc hd) { - if (hd.header().length > 0) - header((Object[])hd.header()); - if (hd.nav().length > 0) - nav((Object[])hd.nav()); - if (hd.aside().length > 0) - aside((Object[])hd.aside()); - if (hd.footer().length > 0) - footer((Object[])hd.footer()); - if (hd.style().length > 0) - style((Object[])hd.style()); - if (hd.script().length > 0) -