juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Bognar <jamesbog...@apache.org>
Subject Improved @RestResource properties annotation.
Date Mon, 05 Jun 2017 20:30:52 GMT
One of the current limitations of the @RestResource(properties) annotation
is that you can only specify String values.  But several serializer/parser
properties are classes.  You can specify a class string, but if the class
was loaded in a different classloader from the servlet container,
Class.forName(String) does not work.

Here's an example of what we currently have:
@RestResource(
properties={
@Property(name=HTML_uriAnchorText, value=PROPERTY_NAME),
@Property(name=REST_allowMethodParam, value="*"),
@Property(name=BEAN_debug, value="true"),
@Property(name=BEAN_sortProperties, value="true"),
@Property(name=HTML_addBeanTypeProperties, value="true"),
@Property(name=BEAN_beanDictionary, value="org.foo.MyBeanDictionary")
}
)

Instead, perhaps we can define them like so broken down into strings,
booleans, and classes?
@RestResource(
properties=@Properties(
strings={
@Property(name=HTML_uriAnchorText, value=PROPERTY_NAME),
@Property(name=REST_allowMethodParam, value="*")
},
flags={
BEAN_debug,
BEAN_sortProperties,
HTML_addBeanTypeProperties,
},
classes={
@ClassProperty(name=BEAN_dictionary, value=MyBeanDictionary.class)
}
)
)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message