<div dir="ltr"><span style="color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">We&#39;ve pushed a version of AeroGear Controller with support for request parameters</span><span style="color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"> (</span><a href="https://issues.jboss.org/browse/AEROGEAR-671" style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;color:rgb(65,131,196);text-decoration:initial">AEROGEAR-671</a>)<span style="color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"> </span><span style="color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">to</span><span style="color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"> </span><a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/" style="font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;color:rgb(65,131,196);text-decoration:initial">openshift</a><span style="color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">.</span><div>
<div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">This demo has the following new route added to it:</p><div class="" style="border:none;padding:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span class="">route</span><span class="" style="font-weight:bold">()</span>
      <span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">from</span><span class="" style="font-weight:bold">(</span><span class="" style="color:rgb(221,17,68)">&quot;/cars&quot;</span><span class="" style="font-weight:bold">)</span>
      <span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">on</span><span class="" style="font-weight:bold">(</span><span class="">RequestMethod</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">GET</span><span class="" style="font-weight:bold">)</span>
      <span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">produces</span><span class="" style="font-weight:bold">(</span><span class="">MediaType</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">JSON</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">toString</span><span class="" style="font-weight:bold">(),</span> <span class="" style="color:rgb(221,17,68)">&quot;application/custom&quot;</span><span class="" style="font-weight:bold">)</span>
      <span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">to</span><span class="" style="font-weight:bold">(</span><span class="">Home</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">class</span><span class="" style="font-weight:bold">).</span><span class="" style="color:rgb(0,128,128)">get</span><span class="" style="font-weight:bold">(</span><span class="">param</span><span class="" style="font-weight:bold">(</span><span class="" style="color:rgb(221,17,68)">&quot;color&quot;</span><span class="" style="font-weight:bold">,</span> <span class="" style="color:rgb(221,17,68)">&quot;pink&quot;</span><span class="" style="font-weight:bold">),</span> <span class="">param</span><span class="" style="font-weight:bold">(</span><span class="" style="color:rgb(221,17,68)">&quot;brand&quot;</span><span class="" style="font-weight:bold">,</span> <span class="" style="color:rgb(221,17,68)">&quot;mini&quot;</span><span class="" style="font-weight:bold">));</span>
</pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">The target method for the above route is named <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">get</code> and takes two parameters, <em>color</em>, and <em>brand</em>. Both parameters are option and if not specified the default values will be used (pink is the default value for <em>color</em>, and<em>mini</em> is the default value for brand).</p>
<p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Home.class has a new method named <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">get</code>:</p>
<div class="" style="border:none;padding:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span class="" style="font-weight:bold">public</span> <span class="">Car</span> <span class="" style="color:rgb(153,0,0);font-weight:bold">get</span><span class="" style="font-weight:bold">(</span><span class="">String</span> <span class="">color</span><span class="" style="font-weight:bold">,</span> <span class="">String</span> <span class="">brand</span><span class="" style="font-weight:bold">)</span> <span class="" style="font-weight:bold">{</span>
      <span class="" style="font-weight:bold">return</span> <span class="" style="font-weight:bold">new</span> <span class="" style="color:rgb(153,0,0);font-weight:bold">Car</span><span class="" style="font-weight:bold">(</span><span class="">color</span><span class="" style="font-weight:bold">,</span> <span class="">brand</span><span class="" style="font-weight:bold">);</span>
<span class="" style="font-weight:bold">}</span>
</pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">You can try these out using the examples below:</p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
Example of specifying both query parameters:</p><div class="" style="border:none;padding:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
curl -i --header <span class="" style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span class="" style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/cars?color=Red&amp;brand=Ferrari">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/cars?color=Red&amp;brand=Ferrari</a>&quot;</span>
</pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Example of specifying one query parameter:</p><div class="" style="border:none;padding:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
curl -i --header <span class="" style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span class="" style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/cars?color=Red">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/cars?color=Red</a>&quot;</span>
</pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Example of specifying no query parameters:</p><div class="" style="border:none;padding:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
curl -i --header <span class="" style="color:rgb(221,17,68)">&quot;Accept: application/json&quot;</span> <span class="" style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/cars">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/cars</a>&quot;</span>
</pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Example of returning a custom media type:</p><div class="" style="border:none;padding:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">
<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
curl -i --header <span class="" style="color:rgb(221,17,68)">&quot;Accept: application/custom&quot;</span> <span class="" style="color:rgb(221,17,68)">&quot;<a href="http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/cars?color=Gray">http://controllerdemo-danbev.rhcloud.com/aerogear-controller-demo/cars?color=Gray</a>&quot;</span>
</pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">A custom media type is an example of a custom responder in AeroGear Controller. In this case it only returns a string but could really do anything needed with the object returned from the target method.</p>
<div class="" style="border:none;padding:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span class="" style="font-weight:bold">public</span> <span class="" style="font-weight:bold">class</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">CustomMediaTypeResponder</span> <span class="" style="font-weight:bold">extends</span> <span class="">AbstractRestResponder</span> <span class="" style="font-weight:bold">{</span>

    <span class="" style="font-weight:bold">public</span> <span class="" style="font-weight:bold">static</span> <span class="" style="font-weight:bold">final</span> <span class="">String</span> <span class="">MEDIA_TYPE</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(221,17,68)">&quot;application/custom&quot;</span><span class="" style="font-weight:bold">;</span>

    <span class="" style="font-weight:bold">public</span> <span class="" style="color:rgb(153,0,0);font-weight:bold">CustomMediaTypeResponder</span><span class="" style="font-weight:bold">()</span> <span class="" style="font-weight:bold">{</span>
        <span class="" style="font-weight:bold">super</span><span class="" style="font-weight:bold">(</span><span class="">MEDIA_TYPE</span><span class="" style="font-weight:bold">);</span>
    <span class="" style="font-weight:bold">}</span>

    <span class="" style="font-weight:bold">public</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">void</span> <span class="" style="color:rgb(153,0,0);font-weight:bold">writeResponse</span><span class="" style="font-weight:bold">(</span><span class="">Object</span> <span class="">entity</span><span class="" style="font-weight:bold">,</span> <span class="">RouteContext</span> <span class="">routeContext</span><span class="" style="font-weight:bold">)</span> 
        <span class="" style="font-weight:bold">throws</span> <span class="">Exception</span> <span class="" style="font-weight:bold">{</span>
        <span class="">routeContext</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">getResponse</span><span class="" style="font-weight:bold">().</span><span class="" style="color:rgb(0,128,128)">getWriter</span><span class="" style="font-weight:bold">().</span><span class="" style="color:rgb(0,128,128)">write</span><span class="" style="font-weight:bold">(</span><span class="" style="color:rgb(221,17,68)">&quot;CustomMediaTypeResponder returned: &quot;</span> <span class="" style="font-weight:bold">+</span> <span class="">entity</span><span class="" style="font-weight:bold">);</span>
    <span class="" style="font-weight:bold">}</span>

    <span class="">@Override</span>
    <span class="" style="font-weight:bold">public</span> <span class="">String</span> <span class="" style="color:rgb(153,0,0);font-weight:bold">mediaType</span><span class="" style="font-weight:bold">()</span> <span class="" style="font-weight:bold">{</span>
        <span class="" style="font-weight:bold">return</span> <span class="">MEDIA_TYPE</span><span class="" style="font-weight:bold">;</span>
    <span class="" style="font-weight:bold">}</span>

<span class="" style="font-weight:bold">}</span>
</pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Please try this out, and if you find any issue let us know, or simply create jira bug reports.</p>
<p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Thanks,</p><p style="margin-top:15px;margin-right:0px;margin-left:0px;color:rgb(0,0,0);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-bottom:0px!important">
/Dan</p></div></div></div>