You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by Slack <no...@slack.com> on 2017/05/31 12:17:24 UTC

[Slack] Notifications from the ASF team for May 31st, 2017 at 8:17 AM

Hi Dev Juneau,

You have a new direct message from the ASF team
(https://the-asf.slack.com/x-182454733285-189775207728/).

---

@digestai
View in the archives:
https://the-asf.slack.com/x-182454733285-189775207728/archives/D5CC0L8FN/p1496232103133183

Digest.AI (8:01 AM, May 31st)
Hi Dev, 
*Here’s your digest for May 31st 2017*
There are 52 messages yesterday, and the most active user is jamesbognar

*#dev-juneau*
 @jamesbognar: The HTTP spec allows it.  For example, one common way of
representing lists is duplication of keys…e.g.
&key=val1&key=val2&key=val3.  But some sort of RuntimeException in this
case is a good idea.
 @sblackmon: Brings up an interesting point, when binding a rest proxy
where you expect the upstream to fail on certain conditions, whether
there's a means to configure the client to check that conditionals are /
are not met
 I suppose that logic could go in a request I tercweptor
 Request interceptor interface is not great for that use case though.
Can be tricky to get at the params, then only have httpcomponents
objects to work with, and method signature is void so any abort would
have to be an HttpException
 @jamesbognar: I’m able to reproduce the first issue…
```
	@Remoteable(path="/testRequestBeanProxy")
	public static interface RequestBeanProxy {

		@RemoteMethod(httpMethod="GET", path="/test1")
		String queryIfNE1(@RequestBean RequestBean1 rb);

		public static interface RequestBean1 {
			@QueryIfNE(value="a", serializer=DummyPartSerializer.class)
			ListString getA();
		}

		public static class RequestBean1Impl implements RequestBean1 {
			@Override
			@BeanProperty(name="b")
			public ListString getA() {
				return new AListString().append("foo").append("bar");
			}
		}
	}
```
The problem is that it’s being interpreted as two different bean
properties:  “a” and “b”.  So we’re serializing the parameters
twice.
 @jamesbognar: I’m not able reproduce _when @RequestBean is a class
with @BeanProperty and @QueryNE on each getter, no interface involved
aside from Serializable - remote proxy works, sort of, but with each
execution i’m getting some number of java.lang.RuntimeException:
org.apache.juneau.BeanRuntimeException:
org.apache.streams.twitter.api.UsersLookupRequest: Class is not a bean. 
Reason=‘null’_

Here’s my code…
```
		@RemoteMethod(httpMethod="GET", path="/test3")
		String queryIfNE3(@RequestBean RequestBean2 rb);

		public static class RequestBean2 {
			@BeanProperty
			@QueryIfNE(value="a", serializer=DummyPartSerializer.class)
			public ListString getX() {
				return new AListString().append("foo").append("bar");
			}
			@BeanProperty
			@QueryIfNE(value="b", serializer=DummyPartSerializer.class)
			public ListString getY() {
				return new AListString().append("foo").append("bar");
			}
		}
```
 Can I see what UsersLookupRequest looks like?
 @jamesbognar: I’ll try to reproduce the problem using your class. 
Thanks!
 On a side note, I wonder if we should rename @BeanProperty(name) to
@BeanProperty(value) to match Jackson.  It looks cleaner that way.
 Or include both name and value and make them synonymous.
 @jamesbognar: yea
 Perhaps both should have both ‘name’ and ‘value’, and you can
just choose the one you want.
 So @BeanProperty(“foo”) and @BeanProperty(name=“foo”) would
mean the same thing.
 @jamesbognar: I was able to reproduce the “Class is not a bean”
exception.  It was a race condition.  I have a fix for it.
 The fix for the duplicate parameters will take more work.  I need to
change the way I find bean property method annotations.  It’s a hassle
because annotations on methods are not inherited, so I have to search
the class hierarchy for the “same” method on parent classes.
 Also note that if you plan on using the proxy class in a multithreaded
environment, you’ll need to call the pooled() method on the
RestClientBuilder class.  Otherwise, you’ll see “Connection still
allocated” exceptions thrown from within HttpClient.

 One side note…..with Juneau, you can define fluent-style setters, so
there’s no need for the separate setX() and withX() methods in the
UsersLookupRequest class.

 @sblackmon: Id hope we can make it fully parallel, up to a max # of
concurrent threads in the pool. Makes more sense for streams use case to
have a singleton accessor class and many concurrent connections
 A lot of time at scale is spent with http set up year down and waiting
for external service
 @jamesbognar: Another quick note….if you’re using the @BeanProperty
annotation on methods, there are no naming restrictions.  Anything with
one parameter is considered a setter, and anything with zero parameters
is considered a getter.  It allows you to define fluent-style setters
such as the following example from AtomFeedResource…

```
			feed 				feed("tag:juneau.sample.com,2013:1", "Juneau ATOM specification",
"2013-05-08T12:29:29Z")
				.subtitle(text("html").text("A emlot/em of effort went into making
this effortless"))
				.links(
					link("alternate", "text/html",
"http://www.sample.com/").hreflang("en"),
					link("self", "application/atom+xml",
"http://www.sample.com/feed.atom")
				)
				.rights("Copyright (c) 2016, Apache Foundation")
				.generator(
					generator("Juneau").uri("http://juneau.apache.org/").version("1.0")
				)
				.entries(
					entry("tag:juneau.sample.com,2013:1.2345", "Juneau ATOM
specification snapshot", "2013-05-08T12:29:29Z")
					.links(
						link("alternate", "text/html",
"http://www.sample.com/2012/05/08/juneau.atom"),
						link("enclosure", "audio/mpeg",
"http://www.sample.com/audio/juneau_podcast.mp3").length(1337)
					)
					.published("2013-05-08T12:29:29Z")
					.authors(
						person("James Bognar").uri(new
URI("http://www.sample.com/")).email("jamesbognar@apache.org")
					)
					.contributors(
						person("Barry M. Caceres")
					)
					.content(
						content("xhtml")
						.lang("en")
						.base("http://www.apache.org/")
						.text("divp[Update: Juneau supports ATOM.]/p/div")
					)
				);
```



*Links shared by your team today:*



* * *

You can snooze these notifications for
an hour:
https://the-asf.slack.com/unsub/U5CDCMK8D-c818330244-notify-mute-1h
eight hours:
https://the-asf.slack.com/unsub/U5CDCMK8D-d9d9f0c003-notify-mute-8h
a day:
https://the-asf.slack.com/unsub/U5CDCMK8D-8578835cf0-notify-mute-1d
three days:
https://the-asf.slack.com/unsub/U5CDCMK8D-06e193824b-notify-mute-3d
or the next week:
https://the-asf.slack.com/unsub/U5CDCMK8D-db36f45174-notify-mute-7d.

You can also turn email notifications off:
https://the-asf.slack.com/unsub/U5CDCMK8D-02b9390bdb-notify.

For more detailed preferences, see your account page:
https://the-asf.slack.com/account.