Congratulations!

[Valid RSS] This is a valid RSS feed.

Recommendations

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Source: http://tobysamples.wordpress.com/feed/

  1. <?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
  2. xmlns:content="http://purl.org/rss/1.0/modules/content/"
  3. xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  4. xmlns:dc="http://purl.org/dc/elements/1.1/"
  5. xmlns:atom="http://www.w3.org/2005/Atom"
  6. xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  7. xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  8. xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
  9. >
  10.  
  11. <channel>
  12. <title>Next Generation XPages</title>
  13. <atom:link href="https://tobysamples.wordpress.com/feed/" rel="self" type="application/rss+xml" />
  14. <link>https://tobysamples.wordpress.com</link>
  15. <description>Taking the XPages community by Storm</description>
  16. <lastBuildDate>Tue, 14 Nov 2017 12:10:41 +0000</lastBuildDate>
  17. <language>en</language>
  18. <sy:updatePeriod>hourly</sy:updatePeriod>
  19. <sy:updateFrequency>1</sy:updateFrequency>
  20. <generator>http://wordpress.com/</generator>
  21. <cloud domain='tobysamples.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
  22. <image>
  23. <url>https://s2.wp.com/i/buttonw-com.png</url>
  24. <title>Next Generation XPages</title>
  25. <link>https://tobysamples.wordpress.com</link>
  26. </image>
  27. <atom:link rel="search" type="application/opensearchdescription+xml" href="https://tobysamples.wordpress.com/osd.xml" title="Next Generation XPages" />
  28. <atom:link rel='hub' href='https://tobysamples.wordpress.com/?pushpress=hub'/>
  29. <item>
  30. <title>Node.js with Domino a Tutorial</title>
  31. <link>https://tobysamples.wordpress.com/2016/02/11/node-js-with-domino-a-tutorial/</link>
  32. <comments>https://tobysamples.wordpress.com/2016/02/11/node-js-with-domino-a-tutorial/#respond</comments>
  33. <pubDate>Thu, 11 Feb 2016 14:06:54 +0000</pubDate>
  34. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  35. <category><![CDATA[Uncategorized]]></category>
  36.  
  37. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=127</guid>
  38. <description><![CDATA[In my last blog I mentioned that I have been working with Node.js for a little while and wanted to share some of my education on the blog.  I thought a good way to do that would be to take an already existing tutorial application written for the MEAN stack(Mongo, Express, Angular, Node) and make it [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=127&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  39. <content:encoded><![CDATA[<p>In my last blog I mentioned that I have been working with Node.js for a little while and wanted to share some of my education on the blog.  I thought a good way to do that would be to take an already existing tutorial application written for the MEAN stack(Mongo, Express, Angular, Node) and make it work with a Domino Database.</p>
  40. <p>We are going to be looking at this</p>
  41. <p><a href="https://scotch.io/tutorials/creating-a-single-page-todo-app-with-node-and-angular" rel="nofollow">https://scotch.io/tutorials/creating-a-single-page-todo-app-with-node-and-angular</a></p>
  42. <p>This is a great little tutorial that helps you write the obligatory todo app using node and Angular.  If you have little to no experience with Node or Angular, I highly recommend going through this tutorial.  But we are going to look at a couple parts of it and with very few modifications bind it to a Domino Database for its data instead of Mongo DB.</p>
  43. <p>The first step in this process is to install Node,  I won&#8217;t go through the instructions as they are platform specific and are mentioned in detail in many places on the web.</p>
  44. <p>Next we need to get the app in question, you can do that either by building out the tutorial or cloning down the git repository for the tutorial here:</p>
  45. <p>git clone <a href="https://github.com/scotch-io/node-todo.git" rel="nofollow">https://github.com/scotch-io/node-todo.git</a></p>
  46. <p>This will put the app in the node-todo folder.</p>
  47. <p>The next step is to connect it to a MongoDB which again you can get installation instructions all over the place.  Another option is to use a cloud hosted instance of Mongo.</p>
  48. <p>The last step is to modify the config/database.js with your mongodb URL.</p>
  49. <p>Once this is done you should be able to use the command line and in the node-todo folder call node server and your app will be up and running on port 3000.</p>
  50. <p>I know I went over a lot very quickly in this post, but the goal is to get to creating a new component to bind this app to Domino.  If you have any questions about how any of this works or are having problems going through the tutorial, let me know and I&#8217;ll see if I can lend a hand.</p>
  51. <p>In the next post I&#8217;ll describe a few of the working components so we have a good grasp of how they will interact with your Domino Database.</p>
  52. <p>&nbsp;</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/127/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=127&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  53. <wfw:commentRss>https://tobysamples.wordpress.com/2016/02/11/node-js-with-domino-a-tutorial/feed/</wfw:commentRss>
  54. <slash:comments>0</slash:comments>
  55. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  56. <media:title type="html">tsamples23</media:title>
  57. </media:content>
  58. </item>
  59. <item>
  60. <title>All the things&#8230;.</title>
  61. <link>https://tobysamples.wordpress.com/2016/02/09/all-the-things/</link>
  62. <comments>https://tobysamples.wordpress.com/2016/02/09/all-the-things/#respond</comments>
  63. <pubDate>Tue, 09 Feb 2016 13:48:30 +0000</pubDate>
  64. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  65. <category><![CDATA[Uncategorized]]></category>
  66.  
  67. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=119</guid>
  68. <description><![CDATA[I have not posted in way too long, thought I would dust off the blog and write a little.  I&#8217;ve been head down focusing on many new things since I last wrote, very few however have to do with XPages directly.  That being said I want to share all the things that I have been [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=119&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  69. <content:encoded><![CDATA[<p>I have not posted in way too long, thought I would dust off the blog and write a little.  I&#8217;ve been head down focusing on many new things since I last wrote, very few however have to do with XPages directly.  That being said I want to share all the things that I have been learning through this blog.  I have plans to put together a few posts on node.js as both a transition from being a Domino Developer and many of the best practices for development using this platform.  I also have been doing quite a bit of Native IOS development with Swift.  This is an amazing language that I hope gets used in other platforms now that it is open sourced.  I&#8217;d like to share some of my thoughts on server-side dev vs client side dev.  Oh and Docker, how Docker can make your life easier as a developer and an admin and a user, pretty much anyone.  Soon I hope to share all the things&#8230;</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/119/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=119&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  70. <wfw:commentRss>https://tobysamples.wordpress.com/2016/02/09/all-the-things/feed/</wfw:commentRss>
  71. <slash:comments>0</slash:comments>
  72. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  73. <media:title type="html">tsamples23</media:title>
  74. </media:content>
  75. </item>
  76. <item>
  77. <title>XPages on Bluemix is Live!</title>
  78. <link>https://tobysamples.wordpress.com/2015/07/10/xpages-on-bluemix-is-live/</link>
  79. <comments>https://tobysamples.wordpress.com/2015/07/10/xpages-on-bluemix-is-live/#comments</comments>
  80. <pubDate>Fri, 10 Jul 2015 11:06:06 +0000</pubDate>
  81. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  82. <category><![CDATA[Uncategorized]]></category>
  83.  
  84. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=113</guid>
  85. <description><![CDATA[Its Live!  This morning after a long wait the XSP Buildpack and Domino Datasource became available on IBM Bluemix.  I&#8217;m so excited for this opportunity to use Domino on IBMs new PAAS.  I have many questions about how it is setup and how thing work.  I&#8217;m curious about how to deal with OSGI plugins and [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=113&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  86. <content:encoded><![CDATA[<p>Its Live!  This morning after a long wait the XSP Buildpack and Domino Datasource became available on IBM Bluemix.  I&#8217;m so excited for this opportunity to use Domino on IBMs new PAAS.  I have many questions about how it is setup and how thing work.  I&#8217;m curious about how to deal with OSGI plugins and code outside of an NSF. I&#8217;m interested to find out how we can change the policy settings for the Security Manager on the JVM.  I have lots of questions but for now happy playing!</p>
  87. <p><strong>UPDATE</strong></p>
  88. <p>It doesn&#8217;t appear that the new extension library that will contain the Designer tools has been released yet.  I&#8217;ll let you know as soon as I know.  However you should be able to update your apps using the CF Command line tools.</p>
  89. <p><a href="https://tobysamples.files.wordpress.com/2015/07/capture.jpg"><img data-attachment-id="114" data-permalink="https://tobysamples.wordpress.com/2015/07/10/xpages-on-bluemix-is-live/capture/" data-orig-file="https://tobysamples.files.wordpress.com/2015/07/capture.jpg?w=634" data-orig-size="139,196" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Toby Samples&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1436508165&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Capture" data-image-description="" data-medium-file="https://tobysamples.files.wordpress.com/2015/07/capture.jpg?w=634?w=139" data-large-file="https://tobysamples.files.wordpress.com/2015/07/capture.jpg?w=634?w=139" class="alignnone size-full wp-image-114" src="https://tobysamples.files.wordpress.com/2015/07/capture.jpg?w=634" alt="Capture"   /></a></p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/113/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=113&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  90. <wfw:commentRss>https://tobysamples.wordpress.com/2015/07/10/xpages-on-bluemix-is-live/feed/</wfw:commentRss>
  91. <slash:comments>1</slash:comments>
  92. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  93. <media:title type="html">tsamples23</media:title>
  94. </media:content>
  95.  
  96. <media:content url="http://tobysamples.files.wordpress.com/2015/07/capture.jpg" medium="image">
  97. <media:title type="html">Capture</media:title>
  98. </media:content>
  99. </item>
  100. <item>
  101. <title>JAX-RS or THE way to do REST in Domino Part 4</title>
  102. <link>https://tobysamples.wordpress.com/2015/07/09/jax-rs-or-the-way-to-do-rest-in-domino-part-4/</link>
  103. <comments>https://tobysamples.wordpress.com/2015/07/09/jax-rs-or-the-way-to-do-rest-in-domino-part-4/#comments</comments>
  104. <pubDate>Thu, 09 Jul 2015 03:29:24 +0000</pubDate>
  105. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  106. <category><![CDATA[Uncategorized]]></category>
  107.  
  108. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=111</guid>
  109. <description><![CDATA[If you&#8217;ve ever created a REST service you know one of the first problems you&#8217;ll run into is that you can only call that service from the same domain that it lives on.  Because of Cross Origin Resource Sharing security issues, The browser will not allow it unless the service includes certain HTTP headers, namely headers [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=111&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  110. <content:encoded><![CDATA[<p>If you&#8217;ve ever created a REST service you know one of the first problems you&#8217;ll run into is that you can only call that service from the same domain that it lives on.  Because of Cross Origin Resource Sharing security issues, The browser will not allow it unless the service includes certain HTTP headers, namely headers that start &#8220;Access-Control-Allow&#8221; This information is explained in great detail on the Mozilla Developer Network site <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS">here</a>.  In Domino adding these http headers to the response can be done differently based on what service you are using.  In XPages or in an NSF it can be done directly via a Phase Listener.  In DAS it can be sort of done by adding custom headers on the Domino Server Config.  It can also be done when writing a custom OSGI plugin.</p>
  111. <p>In plugins you could write to the headers for each method that is specified in your resource, but most likely you want to write out the headers for everything that comes into your service.  The best way to handle it is with a Servlet Filter.  A Servlet Filter is some code that runs before the servlet that can manipulate the request/response and it runs on every request.</p>
  112. <p>In our example we add this simple Servlet Filter</p>
  113. <pre class="brush: java; title: ; notranslate">
  114.  
  115. import java.io.*;
  116. import javax.servlet.*;
  117. import javax.servlet.http.*;
  118.  
  119. public class CORSFilter implements Filter {
  120.  
  121. public CORSFilter() { }
  122.  
  123. public void init(FilterConfig fConfig) throws ServletException { }
  124.  
  125. public void destroy() { }
  126.  
  127. public void doFilter(
  128. ServletRequest request, ServletResponse response,
  129. FilterChain chain) throws IOException, ServletException {
  130.  
  131. ((HttpServletResponse)response).addHeader(&quot;Access-Control-Allow-Origin&quot;, &quot;*&quot;);
  132. ((HttpServletResponse)response).addHeader(&quot;Access-Control-Allow-Credentials&quot;, &quot;true&quot;);
  133. ((HttpServletResponse)response).addHeader(&quot;Access-Control-Allow-Methods&quot;, &quot;POST&quot;);
  134. ((HttpServletResponse)response).addHeader(&quot;Access-Control-Allow-Headers&quot;, &quot;Content-Type&quot;);
  135. ((HttpServletResponse)response).addHeader(&quot;Access-Control-Max-Age&quot;, &quot;86400&quot;);
  136.  
  137. chain.doFilter(request, response);
  138. }
  139. }
  140.  
  141. </pre>
  142. <p>It adds to the appropriate headers to every request that comes in and then delegates the request/response to the servlet.</p>
  143. <p>The only other config change that needs to be made is to specify the filter in the web.xml</p>
  144. <pre class="brush: xml; title: ; notranslate">
  145.  
  146. &lt;filter&gt;
  147. &lt;filter-name&gt;CORSFilter&lt;/filter-name&gt;
  148. &lt;filter-class&gt;com.tobysamples.demo.wink.CORSFilter&lt;/filter-class&gt;
  149. &lt;/filter&gt;
  150. &lt;filter-mapping&gt;
  151. &lt;filter-name&gt;CORSFilter&lt;/filter-name&gt;
  152. &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  153. &lt;/filter-mapping&gt;
  154.  
  155. </pre>
  156. <p>This puts a pattern on which urls will have the filter applied.  So as you can see this technique is simple and allows for complete flexibility as to what headers are sent down to the client.  So now you can build out your Domino Service and call it from other web apps.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/111/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=111&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  157. <wfw:commentRss>https://tobysamples.wordpress.com/2015/07/09/jax-rs-or-the-way-to-do-rest-in-domino-part-4/feed/</wfw:commentRss>
  158. <slash:comments>2</slash:comments>
  159. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  160. <media:title type="html">tsamples23</media:title>
  161. </media:content>
  162. </item>
  163. <item>
  164. <title>JAX-RS or THE way to do REST in Domino Part 3.5</title>
  165. <link>https://tobysamples.wordpress.com/2015/07/01/jax-rs-or-the-way-to-do-rest-in-domino-part-3-5/</link>
  166. <comments>https://tobysamples.wordpress.com/2015/07/01/jax-rs-or-the-way-to-do-rest-in-domino-part-3-5/#respond</comments>
  167. <pubDate>Wed, 01 Jul 2015 04:30:00 +0000</pubDate>
  168. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  169. <category><![CDATA[Uncategorized]]></category>
  170.  
  171. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=102</guid>
  172. <description><![CDATA[Soooo, I know I said the last segment was my last on this, but I thought I could share one other really cool thing about using JAX-RS.  Using JAX-RS allows you as a developer to avoid not only parsing JSON but also having intermediary objects like JsonJavaObject from IBM Commons.  It does this by allowing [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=102&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  173. <content:encoded><![CDATA[<p>Soooo, I know I said the last segment was my last on this, but I thought I could share one other really cool thing about using JAX-RS.  Using JAX-RS allows you as a developer to avoid not only parsing JSON but also having intermediary objects like JsonJavaObject from IBM Commons.  It does this by allowing you to add in a mapper for both XML and JSON.  Which means you can have a model object that you develop and it will know how to translate it to and from JSON.</p>
  174. <p>The basic tip is that you have to add one more method to your Wink Application Class, getSingleton.  This method basically lets you setup the mapper and add it to the framework.</p>
  175. <p>The code to add this is as follows:</p>
  176. <pre class="brush: java; title: ; notranslate">
  177.  
  178. @Override
  179. public Set&lt;Object&gt; getSingletons() {
  180. Set&lt;Object&gt; s = new HashSet&lt;Object&gt;();
  181. ObjectMapper mapper = new ObjectMapper();
  182. AnnotationIntrospector primary = new JaxbAnnotationIntrospector();
  183. AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
  184. AnnotationIntrospector pair = new AnnotationIntrospector.Pair(primary,     secondary);
  185. mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
  186. mapper.getSerializationConfig().setAnnotationIntrospector(pair);
  187. JacksonJaxbJsonProvider jaxbProvider = new   JacksonJaxbJsonProvider();
  188. jaxbProvider.setMapper(mapper);
  189. s.add(jaxbProvider);
  190. return s;
  191.  
  192. }
  193.  
  194. </pre>
  195. <p>For this code to work, you have to have in your classpath the jackson jar file.</p>
  196. <p>Once you have added the jar file to your WebContent\Web-INF\lib\ folder</p>
  197. <p><a href="https://tobysamples.files.wordpress.com/2015/07/jackson.jpg"><img data-attachment-id="105" data-permalink="https://tobysamples.wordpress.com/2015/07/01/jax-rs-or-the-way-to-do-rest-in-domino-part-3-5/jackson/" data-orig-file="https://tobysamples.files.wordpress.com/2015/07/jackson.jpg?w=634" data-orig-size="277,120" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Toby Samples&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1435779711&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="jackson" data-image-description="" data-medium-file="https://tobysamples.files.wordpress.com/2015/07/jackson.jpg?w=634?w=277" data-large-file="https://tobysamples.files.wordpress.com/2015/07/jackson.jpg?w=634?w=277" class="alignnone size-full wp-image-105" src="https://tobysamples.files.wordpress.com/2015/07/jackson.jpg?w=634" alt="jackson" srcset="https://tobysamples.files.wordpress.com/2015/07/jackson.jpg 277w, https://tobysamples.files.wordpress.com/2015/07/jackson.jpg?w=150 150w" sizes="(max-width: 277px) 100vw, 277px"   /></a></p>
  198. <p>added it to the libaries tab in your Build Configuration</p>
  199. <p><a href="https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg"><img data-attachment-id="107" data-permalink="https://tobysamples.wordpress.com/2015/07/01/jax-rs-or-the-way-to-do-rest-in-domino-part-3-5/jackson3/" data-orig-file="https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg?w=634&#038;h=138" data-orig-size="804,175" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Toby Samples&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1435779860&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="jackson3" data-image-description="" data-medium-file="https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg?w=634&#038;h=138?w=300" data-large-file="https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg?w=634&#038;h=138?w=634" class="alignnone size-full wp-image-107" src="https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg?w=634&#038;h=138" alt="jackson3" width="634" height="138" srcset="https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg?w=634&amp;h=138 634w, https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg?w=150&amp;h=33 150w, https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg?w=300&amp;h=65 300w, https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg?w=768&amp;h=167 768w, https://tobysamples.files.wordpress.com/2015/07/jackson3.jpg 804w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
  200. <p>you also need to add it to the Classpath Section in the plugin.xml under the runtime tab.</p>
  201. <p><img data-attachment-id="106" data-permalink="https://tobysamples.wordpress.com/2015/07/01/jax-rs-or-the-way-to-do-rest-in-domino-part-3-5/jackson2/" data-orig-file="https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=634&#038;h=322" data-orig-size="1190,605" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Toby Samples&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1435779736&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="jackson2" data-image-description="" data-medium-file="https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=634&#038;h=322?w=300" data-large-file="https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=634&#038;h=322?w=634" class="alignnone size-full wp-image-106" src="https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=634&#038;h=322" alt="jackson2" width="634" height="322" srcset="https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=634&amp;h=322 634w, https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=150&amp;h=76 150w, https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=300&amp;h=153 300w, https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=768&amp;h=390 768w, https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg?w=1024&amp;h=521 1024w, https://tobysamples.files.wordpress.com/2015/07/jackson2.jpg 1190w" sizes="(max-width: 634px) 100vw, 634px" /></p>
  202. <p>Once you have that added to your class, now you can create Java classes and the framework will let you POST something like this:</p>
  203. <pre class="brush: plain; title: ; notranslate">
  204.  
  205. {&quot;fname&quot;:&quot;Joe&quot;,&quot;lname&quot;:&quot;User&quot;,&quot;email&quot;:&quot;[email protected]&quot;,&quot;phone&quot;:&quot;123.456.7841&quot;,&quot;birthdate&quot;:54544444}
  206.  
  207. </pre>
  208. <p>at this method</p>
  209. <pre class="brush: java; title: ; notranslate">
  210.  
  211. @Path(&quot;/toby&quot;)
  212. @POST
  213. @Consumes(MediaType.APPLICATION_JSON)
  214. @Produces(MediaType.APPLICATION_JSON)
  215. public MyBean postMessage(MyBean mybean) {
  216. mybean.setFname(&quot;Toby&quot;);
  217. return mybean;
  218. }
  219.  
  220. </pre>
  221. <p>The method gets the data and converts it to a MyBean object automatically then I change it and send it back to the client and it comes down as JSON all without me adding anything to handle the JSON, except for the annotations.</p>
  222. <p>It&#8217;s pretty magical really.</p>
  223. <p>Hope you get some mileage out of this info.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/102/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=102&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  224. <wfw:commentRss>https://tobysamples.wordpress.com/2015/07/01/jax-rs-or-the-way-to-do-rest-in-domino-part-3-5/feed/</wfw:commentRss>
  225. <slash:comments>0</slash:comments>
  226. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  227. <media:title type="html">tsamples23</media:title>
  228. </media:content>
  229.  
  230. <media:content url="http://tobysamples.files.wordpress.com/2015/07/jackson.jpg" medium="image">
  231. <media:title type="html">jackson</media:title>
  232. </media:content>
  233.  
  234. <media:content url="http://tobysamples.files.wordpress.com/2015/07/jackson3.jpg" medium="image">
  235. <media:title type="html">jackson3</media:title>
  236. </media:content>
  237.  
  238. <media:content url="http://tobysamples.files.wordpress.com/2015/07/jackson2.jpg" medium="image">
  239. <media:title type="html">jackson2</media:title>
  240. </media:content>
  241. </item>
  242. <item>
  243. <title>JAX-RS or THE way to do REST in Domino Part 3</title>
  244. <link>https://tobysamples.wordpress.com/2015/06/29/jax-rs-or-the-way-to-do-rest-in-domino-part-3/</link>
  245. <comments>https://tobysamples.wordpress.com/2015/06/29/jax-rs-or-the-way-to-do-rest-in-domino-part-3/#comments</comments>
  246. <pubDate>Mon, 29 Jun 2015 03:11:54 +0000</pubDate>
  247. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  248. <category><![CDATA[Uncategorized]]></category>
  249.  
  250. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=100</guid>
  251. <description><![CDATA[In the last segment of this series I pointed you to use a couple of resources from  my github as templates, but didn&#8217;t really specify how those work or how to add your own services.  I hope to finish the series today with some explanation of those resources. Web.xml The Web.xml is the configuration in [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=100&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  252. <content:encoded><![CDATA[<p>In the last segment of this series I pointed you to use a couple of resources from  my github as templates, but didn&#8217;t really specify how those work or how to add your own services.  I hope to finish the series today with some explanation of those resources.</p>
  253. <p>Web.xml</p>
  254. <p>The Web.xml is the configuration in all Java EE apps.  It basically sets up the configuration for the application.  The application I have specified has a single servlet, which is defined by the wink framework.</p>
  255. <p>org.apache.wink.server.internal.servlet.RestServlet</p>
  256. <p>This servlet looks for a class of type &#8220;<a class="header" href="%5C/Program%20Files%5C/IBM%5C/Domino%5C/osgi%5C/shared%5C/eclipse%5C/plugins%5C/org.apache.wink_1.1.2.20131004-1200%5C/lib%5C/jsr311-api-1.1.1.jar%3Cjavax">javax</a>.<a class="header" href="%5C/Program%20Files%5C/IBM%5C/Domino%5C/osgi%5C/shared%5C/eclipse%5C/plugins%5C/org.apache.wink_1.1.2.20131004-1200%5C/lib%5C/jsr311-api-1.1.1.jar%3Cjavax.ws">ws</a>.<a class="header" href="%5C/Program%20Files%5C/IBM%5C/Domino%5C/osgi%5C/shared%5C/eclipse%5C/plugins%5C/org.apache.wink_1.1.2.20131004-1200%5C/lib%5C/jsr311-api-1.1.1.jar%3Cjavax.ws.rs">rs</a>.<a class="header" href="%5C/Program%20Files%5C/IBM%5C/Domino%5C/osgi%5C/shared%5C/eclipse%5C/plugins%5C/org.apache.wink_1.1.2.20131004-1200%5C/lib%5C/jsr311-api-1.1.1.jar%3Cjavax.ws.rs.core">core</a>.Application&#8221;</p>
  257. <p>So your application will need a class that extends it.  In the web.xml its specified in the init-param</p>
  258. <p>&lt;init-param&gt;<br />
  259. &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;<br />
  260. &lt;param-value&gt;com.tobysamples.demo.wink.HelloWorldApplication&lt;/param-value&gt;<br />
  261. &lt;/init-param&gt;</p>
  262. <p>The web.xml also has a servlet mapping basically specifies what url the servlet will live at.  In the example it is &#8220;/rest*/  which basically means if the url has that pattern in it it will call the servlet and pass in the rest of the url for routing.</p>
  263. <p>HelloWorldApplication.java</p>
  264. <p>This is the aforementioned class that is referenced in the web.xml.  The only thing it really does is overrides the getClasses Method and returns back a Set of classes that contain Resources which are basically the rest services that are defined.</p>
  265. <p>HelloWorldResource.java</p>
  266. <p>This is basically the meat of the service.  It specifies two methods one for a GET request annotated by the @GET above it and one for a POST request, annotated by the @POST above it.  So in this class we specify what URL it will live at with the annotation above the class declaration</p>
  267. <p>@Path(&#8220;/helloworld&#8221;)</p>
  268. <p>JAX-RS methods need to return a &#8220;<a class="header" href="%5C/Program%20Files%5C/IBM%5C/Domino%5C/osgi%5C/shared%5C/eclipse%5C/plugins%5C/org.apache.wink_1.1.2.20131004-1200%5C/lib%5C/jsr311-api-1.1.1.jar%3Cjavax">javax</a>.<a class="header" href="%5C/Program%20Files%5C/IBM%5C/Domino%5C/osgi%5C/shared%5C/eclipse%5C/plugins%5C/org.apache.wink_1.1.2.20131004-1200%5C/lib%5C/jsr311-api-1.1.1.jar%3Cjavax.ws">ws</a>.<a class="header" href="%5C/Program%20Files%5C/IBM%5C/Domino%5C/osgi%5C/shared%5C/eclipse%5C/plugins%5C/org.apache.wink_1.1.2.20131004-1200%5C/lib%5C/jsr311-api-1.1.1.jar%3Cjavax.ws.rs">rs</a>.<a class="header" href="%5C/Program%20Files%5C/IBM%5C/Domino%5C/osgi%5C/shared%5C/eclipse%5C/plugins%5C/org.apache.wink_1.1.2.20131004-1200%5C/lib%5C/jsr311-api-1.1.1.jar%3Cjavax.ws.rs.core">core</a>.Response&#8221; object.  We are creating and returning this object in both of these methods, JAX-RS has some nifty functionality for sending back different http codes and http headers.  For instance you can see in the getMessage method I am returning back a 200 http status code with a content-type http header of application/json</p>
  269. <p>ResponseBuilder builder = Response.ok(jjo.toString(), MediaType.APPLICATION_JSON);</p>
  270. <p>JAX-RS is the standard way of doing REST services in the Java EE world, so there are all kinds of plugins and documentation/blogs out there with tips and tricks of how to use it once you have it setup.  I would recommend the <a href="https://jsr311.java.net/nonav/releases/1.0/index.html">java doc</a> and the <a href="http://docs.oracle.com/javaee/6/tutorial/doc/giepu.html">tutorial </a>from Oracle on how to get started for some beginner lessons.  I know sometimes writing a xAgent or even a plain old agent is quicker, but to ensure that your code is decoupled and will even work outside of an XPages context this is probably your best way of creating a rest service.  Even IBM realized this as this is how DAS services is built in Domino.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/100/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=100&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  271. <wfw:commentRss>https://tobysamples.wordpress.com/2015/06/29/jax-rs-or-the-way-to-do-rest-in-domino-part-3/feed/</wfw:commentRss>
  272. <slash:comments>2</slash:comments>
  273. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  274. <media:title type="html">tsamples23</media:title>
  275. </media:content>
  276. </item>
  277. <item>
  278. <title>JAX-RS or THE way to do REST in Domino Part 2</title>
  279. <link>https://tobysamples.wordpress.com/2015/06/23/jax-rs-or-the-way-to-do-rest-in-domino-part-2/</link>
  280. <comments>https://tobysamples.wordpress.com/2015/06/23/jax-rs-or-the-way-to-do-rest-in-domino-part-2/#comments</comments>
  281. <pubDate>Tue, 23 Jun 2015 07:55:45 +0000</pubDate>
  282. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  283. <category><![CDATA[Uncategorized]]></category>
  284.  
  285. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=95</guid>
  286. <description><![CDATA[In part 1 of this series you learned how to setup Eclispe to write OSGi plugins.  Next we get to create a plugin. 1.  On the menu click File -&#62; New -&#62; Plugin Project 2.  Add your Project name and use Eclipse 3.4 Click Next 3.  Make sure Generate an Activator is checked, change Execution [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=95&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  287. <content:encoded><![CDATA[<p>In part 1 of this series you learned how to setup Eclispe to write OSGi plugins.  Next we get to create a plugin.</p>
  288. <p>1.  On the menu click File -&gt; New -&gt; Plugin Project</p>
  289. <p>2.  Add your Project name and use Eclipse 3.4 Click Next</p>
  290. <p>3.  Make sure Generate an Activator is checked, change Execution Environment to JavaSE 1.6, then Click Finish</p>
  291. <p>4.  Your on the Overview Page of the Plugin, were going to start going through all the tabs on the Plugin, next click the Dependencies Plugin</p>
  292. <p>5.  you&#8217;ll already have org.eclipse.core.runtime as a required plugin.  Go ahead and add com.ibm.pvc.webcontainer and org.apache.wink</p>
  293. <p>6.  On the right side of the page add all the packages that use *org.apache.wink* and lotus.domino and javax.servlet.http, javax.servet, and javax.servlet.jsp. Next click on the Extensions tab at the bottom.</p>
  294. <p>7.  Here you will add com.ibm.pvc.webcontainer.application</p>
  295. <p>7a.  Change the contextRoot Details on the right to /myurlpath</p>
  296. <p>7b.  Right-Click on com.ibm.pvc.webcontainer.application in the left window and add a new contentLocation, change it in the right window to &#8220;WebContent&#8221;</p>
  297. <p>8.  In the package explorer add a new toplevel folder called WebContent, inside that folder add another folder called WEB-INF, and finally inside of that folder add a file called web.xml.</p>
  298. <p>9.  Go back to the plugin.xml by double clicking on it.  then click on the Build Tab.  Check WebContent and bin folders to ensure they get included in the build.</p>
  299. <p>10.  Next we can start updating the web.xml,  I have an example one in my project on my github here:</p>
  300. <p><a href="https://github.com/tsamples/jaxrsondomino/blob/master/WebContent/WEB-INF/web.xml" rel="nofollow">https://github.com/tsamples/jaxrsondomino/blob/master/WebContent/WEB-INF/web.xml</a></p>
  301. <p>The web.xml points to the JAX-RS application we haven&#8217;t created yet, so you will also need to get the 2 Java files from the project here:</p>
  302. <p><a href="https://github.com/tsamples/jaxrsondomino/tree/master/src/com/tobysamples/demo/wink" rel="nofollow">https://github.com/tsamples/jaxrsondomino/tree/master/src/com/tobysamples/demo/wink</a></p>
  303. <p>Once you have added those 2 Java files and make sure the namespace matches what the web.xml has for it, you can fix the Activator.</p>
  304. <p>In the previous Java folder there is also an Activator.  if you Overwrite the Activator you have in your project with that one, it will start up wink without any issues.  Consequently this was the strangest part of getting this working, Apparently wink needs this small bit of code in the start method of the activator to ensure that it runs in the right Thread context.  With all of that done you now should have a working Plugin, now you just need to deploy it.  Lots of ways to do this, you can use hot deploy PDE if you have it installed. or you can Right-Click and Export as a Deploy-able Plugin and Fragment, then drop the created jar in &#8220;C:\Program Files\IBM\Domino\data\domino\workspace\applications\eclipse\plugins&#8221; and restart the http task on your server.  The last and more production efficent way of deploying these is by using the updatesite.nsf.  But first you will have to create a Feature and UpdateSite project.  There are great directions to do all of the General OSGi stuff here:</p>
  305. <p><a href="http://www-10.lotus.com/ldd/ddwiki.nsf/dx/creating_an_xpages_library#Create+the+library+class" rel="nofollow">http://www-10.lotus.com/ldd/ddwiki.nsf/dx/creating_an_xpages_library#Create+the+library+class</a></p>
  306. <p>Once deployed the URL will be <a href="http://servername/myurlpath/rest/helloworld" rel="nofollow">http://servername/myurlpath/rest/helloworld</a></p>
  307. <p>If you have any questions please let me know.  I know there are a lot of steps here and sometimes things can get lost in translation.  But once you do a couple of these most of it is just muscle memory.  I hope to create a video outlying how to do this in an easier follow along manner.  If that would be useful to you please comment and let me know.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/95/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=95&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  308. <wfw:commentRss>https://tobysamples.wordpress.com/2015/06/23/jax-rs-or-the-way-to-do-rest-in-domino-part-2/feed/</wfw:commentRss>
  309. <slash:comments>7</slash:comments>
  310. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  311. <media:title type="html">tsamples23</media:title>
  312. </media:content>
  313. </item>
  314. <item>
  315. <title>JavaScript sugar of the day</title>
  316. <link>https://tobysamples.wordpress.com/2015/05/01/javascript-sugar-of-the-day/</link>
  317. <comments>https://tobysamples.wordpress.com/2015/05/01/javascript-sugar-of-the-day/#comments</comments>
  318. <pubDate>Fri, 01 May 2015 01:20:46 +0000</pubDate>
  319. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  320. <category><![CDATA[Uncategorized]]></category>
  321.  
  322. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=90</guid>
  323. <description><![CDATA[So I needed to use the slice function in the result of a getElementsByClassName() call.  Something like: var elements = document.getElementsByClassName(&#8216;MyClassName&#8217;); var copyOfElements = elements.slice(0); However this fails on the second line because slice is not a function on the elements objects.  The elements object is of type HTMLCollection, even though HTMLCollection appears very much like [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=90&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  324. <content:encoded><![CDATA[<p>So I needed to use the slice function in the result of a getElementsByClassName() call.  Something like:</p>
  325. <p>var elements = document.getElementsByClassName(&#8216;MyClassName&#8217;);</p>
  326. <p>var copyOfElements = elements.slice(0);</p>
  327. <p>However this fails on the second line because slice is not a function on the elements objects.  The elements object is of type HTMLCollection, even though HTMLCollection appears very much like an array it isn&#8217;t exactly one, however there is a solution to be able to use slice with my object.</p>
  328. <p>It comes in the form of using the call method on the Function Type.  JavaScript unlike other languages allows you to get a handle on a Function just like its any other type.  So for instance if I return &#8216;MyString&#8217;.indexOf it literally gives me the Function Object.  Now once you understand that, you can see that maybe the Function Object has methods of its own.  One of these methods is &#8216;call&#8217;  what call allows you to do is basically inject your own object for the &#8216;this&#8217; of a Function.  In my example I can use the call method to use Array&#8217;s slice method on an object of another type, very easily.  Like so:</p>
  329. <p>var elements = document.getElementsByClassName(&#8216;MyClassName&#8217;);</p>
  330. <p>var copyOfElements = [].slice.call(elements, 0);</p>
  331. <p>However be careful of doing this as obviously not all objects are equal and therefore could cause you issues down the road if the structures and methods don&#8217;t line up.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/90/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=90&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  332. <wfw:commentRss>https://tobysamples.wordpress.com/2015/05/01/javascript-sugar-of-the-day/feed/</wfw:commentRss>
  333. <slash:comments>1</slash:comments>
  334. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  335. <media:title type="html">tsamples23</media:title>
  336. </media:content>
  337. </item>
  338. <item>
  339. <title>JAX-RS or THE way to do REST in Domino Part 1</title>
  340. <link>https://tobysamples.wordpress.com/2015/04/28/jax-rs-or-the-way-to-do-rest-in-domino-part-1/</link>
  341. <comments>https://tobysamples.wordpress.com/2015/04/28/jax-rs-or-the-way-to-do-rest-in-domino-part-1/#comments</comments>
  342. <pubDate>Tue, 28 Apr 2015 03:00:50 +0000</pubDate>
  343. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  344. <category><![CDATA[Uncategorized]]></category>
  345. <category><![CDATA[IBM Domino]]></category>
  346. <category><![CDATA[Java]]></category>
  347. <category><![CDATA[JAX-RS]]></category>
  348. <category><![CDATA[REST Service]]></category>
  349.  
  350. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=77</guid>
  351. <description><![CDATA[The IBM Domino community has had servlets on its mind lately, and XAgents, and Rest Services.  These are all great advances to using IBM Domino in a modern world.  However to bring IBM Domino into a more modern age of Java Development we must go beyond just writing servlets like it was 1999.  The next [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=77&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  352. <content:encoded><![CDATA[<p>The IBM Domino community has had servlets on its mind lately, and XAgents, and Rest Services.  These are all great advances to using IBM Domino in a modern world.  However to bring IBM Domino into a more modern age of Java Development we must go beyond just writing servlets like it was 1999.  The next few blog posts will show you how to setup a REST Service that uses JAX-RS and runs on Domino.  This will require creating an OSGi plugin.  I am going to assume you have never written such and will try to explain all of the pieces that need to be done and why.</p>
  353. <p>Below are the first few steps to create the plugin.</p>
  354. <p>1.  Download Vanilla Eclipse.  Any version should work, but I would recommend getting the latest, which is Eclispe Luna SR2.  Specifically the one for Java EE Developers.  Its available here:</p>
  355. <p><a href="http://eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunasr2" rel="nofollow">http://eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunasr2</a></p>
  356. <p>After its downloaded unzip it somewhere, There isn&#8217;t an install just a bunch of files that need to be on your hard drive somewhere.</p>
  357. <p>Once that done you can go about running it by executing &#8220;eclipse.exe&#8221; There are a few welcome screens that you can skip to get to the screen that is somewhat similar to Domino Designer Workspace.</p>
  358. <p>2a.  I&#8217;m making an assumption here that you are either running a local full Domino Server or you have File Access to an install.  If you don&#8217;t have either of these, you really should consider it as it will make all of your development work a lot easier, even your normal XPages work.</p>
  359. <p>To give you a little more understanding of how OSGi works, it helps to know that you are creating a bundle (plugin) and that it will interact with other bundles all within a container.  When dealing with Java in our XPages context we tend to think of Java as either source &#8220;.java&#8221; or libraries &#8220;.jar&#8221; files.  We need to add a third category of a bundle to create a plugin that does much.  So with that said we have to create whats called a &#8220;Target Platform&#8221;  inside of eclipse.  This is a profile of what environment will your bundle run in.  For our limited example all we need to add is the directories of where the Domino Bundles live.  There is a couple of them and its really just so our new Bundle can see those.</p>
  360. <p>From the Eclipse menu go to Window-&gt; Preferences.  This will open a dialog.  On the left side of the Dialog you should see Plug-in Development</p>
  361. <p><a href="https://tobysamples.files.wordpress.com/2015/04/prefpane1.png"><img data-attachment-id="80" data-permalink="https://tobysamples.wordpress.com/2015/04/28/jax-rs-or-the-way-to-do-rest-in-domino-part-1/prefpane1/" data-orig-file="https://tobysamples.files.wordpress.com/2015/04/prefpane1.png?w=634&#038;h=697" data-orig-size="776,853" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="prefpane1" data-image-description="" data-medium-file="https://tobysamples.files.wordpress.com/2015/04/prefpane1.png?w=634&#038;h=697?w=273" data-large-file="https://tobysamples.files.wordpress.com/2015/04/prefpane1.png?w=634&#038;h=697?w=634" class="alignnone size-full wp-image-80" src="https://tobysamples.files.wordpress.com/2015/04/prefpane1.png?w=634&#038;h=697" alt="prefpane1" width="634" height="697" srcset="https://tobysamples.files.wordpress.com/2015/04/prefpane1.png?w=634&amp;h=697 634w, https://tobysamples.files.wordpress.com/2015/04/prefpane1.png?w=136&amp;h=150 136w, https://tobysamples.files.wordpress.com/2015/04/prefpane1.png?w=273&amp;h=300 273w, https://tobysamples.files.wordpress.com/2015/04/prefpane1.png?w=768&amp;h=844 768w, https://tobysamples.files.wordpress.com/2015/04/prefpane1.png 776w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
  362. <p>Expand that section and you will see a new area called &#8220;Target Platform&#8221; Click on it and you should see a single platform called &#8220;Running Platform&#8221;, we will be creating a new one, so click &#8220;Add&#8221;</p>
  363. <p><img data-attachment-id="81" data-permalink="https://tobysamples.wordpress.com/2015/04/28/jax-rs-or-the-way-to-do-rest-in-domino-part-1/prefpane2/" data-orig-file="https://tobysamples.files.wordpress.com/2015/04/prefpane2.png?w=705&#038;h=960" data-orig-size="632,861" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="prefpane2" data-image-description="" data-medium-file="https://tobysamples.files.wordpress.com/2015/04/prefpane2.png?w=705&#038;h=960?w=220" data-large-file="https://tobysamples.files.wordpress.com/2015/04/prefpane2.png?w=705&#038;h=960?w=632" class="alignnone  wp-image-81" src="https://tobysamples.files.wordpress.com/2015/04/prefpane2.png?w=705&#038;h=960" alt="prefpane2" width="705" height="960" srcset="https://tobysamples.files.wordpress.com/2015/04/prefpane2.png 632w, https://tobysamples.files.wordpress.com/2015/04/prefpane2.png?w=110&amp;h=150 110w, https://tobysamples.files.wordpress.com/2015/04/prefpane2.png?w=220&amp;h=300 220w" sizes="(max-width: 705px) 100vw, 705px" /></p>
  364. <p>From there it will prompt if you want to start from an old one or from scratch.   We will be creating one from scratch. So leave it on</p>
  365. <p>&#8220;Nothing: Start with an empty target definition&#8221;</p>
  366. <p><a href="https://tobysamples.files.wordpress.com/2015/04/targetdef1.png"><img data-attachment-id="83" data-permalink="https://tobysamples.wordpress.com/2015/04/28/jax-rs-or-the-way-to-do-rest-in-domino-part-1/targetdef1/" data-orig-file="https://tobysamples.files.wordpress.com/2015/04/targetdef1.png?w=634&#038;h=575" data-orig-size="870,789" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="targetdef1" data-image-description="" data-medium-file="https://tobysamples.files.wordpress.com/2015/04/targetdef1.png?w=634&#038;h=575?w=300" data-large-file="https://tobysamples.files.wordpress.com/2015/04/targetdef1.png?w=634&#038;h=575?w=634" class="alignnone size-full wp-image-83" src="https://tobysamples.files.wordpress.com/2015/04/targetdef1.png?w=634&#038;h=575" alt="targetdef1" width="634" height="575" srcset="https://tobysamples.files.wordpress.com/2015/04/targetdef1.png?w=634&amp;h=575 634w, https://tobysamples.files.wordpress.com/2015/04/targetdef1.png?w=150&amp;h=136 150w, https://tobysamples.files.wordpress.com/2015/04/targetdef1.png?w=300&amp;h=272 300w, https://tobysamples.files.wordpress.com/2015/04/targetdef1.png?w=768&amp;h=696 768w, https://tobysamples.files.wordpress.com/2015/04/targetdef1.png 870w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
  367. <p>In the Locations Tab you will Add 4 Directories</p>
  368. <p><a href="https://tobysamples.files.wordpress.com/2015/04/target1.png"><img data-attachment-id="82" data-permalink="https://tobysamples.wordpress.com/2015/04/28/jax-rs-or-the-way-to-do-rest-in-domino-part-1/target1/" data-orig-file="https://tobysamples.files.wordpress.com/2015/04/target1.png?w=634&#038;h=580" data-orig-size="867,793" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="target1" data-image-description="" data-medium-file="https://tobysamples.files.wordpress.com/2015/04/target1.png?w=634&#038;h=580?w=300" data-large-file="https://tobysamples.files.wordpress.com/2015/04/target1.png?w=634&#038;h=580?w=634" class="alignnone size-full wp-image-82" src="https://tobysamples.files.wordpress.com/2015/04/target1.png?w=634&#038;h=580" alt="target1" width="634" height="580" srcset="https://tobysamples.files.wordpress.com/2015/04/target1.png?w=634&amp;h=580 634w, https://tobysamples.files.wordpress.com/2015/04/target1.png?w=150&amp;h=137 150w, https://tobysamples.files.wordpress.com/2015/04/target1.png?w=300&amp;h=274 300w, https://tobysamples.files.wordpress.com/2015/04/target1.png?w=768&amp;h=702 768w, https://tobysamples.files.wordpress.com/2015/04/target1.png 867w" sizes="(max-width: 634px) 100vw, 634px" /></a></p>
  369. <p>C:\Program Files\IBM\Domino\data\domino\workspace\applications\eclipse\plugins\</p>
  370. <p>C:\Program Files\IBM\Domino\jvm\lib\ext\</p>
  371. <p>C:\Program Files\IBM\Domino\osgi\rcp\eclipse\plugins\</p>
  372. <p>C:\Program Files\IBM\Domino\osgi\shared\eclipse\plugins\</p>
  373. <p>Once you have completed these steps you now have setup Eclipse to be able to develop OSGi Bundles for Domino.  In the next part we will create the bundle and discuss each part of the plugin.xml that needs to be setup to create a JAX-RS Service.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/77/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=77&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  374. <wfw:commentRss>https://tobysamples.wordpress.com/2015/04/28/jax-rs-or-the-way-to-do-rest-in-domino-part-1/feed/</wfw:commentRss>
  375. <slash:comments>6</slash:comments>
  376. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  377. <media:title type="html">tsamples23</media:title>
  378. </media:content>
  379.  
  380. <media:content url="http://tobysamples.files.wordpress.com/2015/04/prefpane1.png" medium="image">
  381. <media:title type="html">prefpane1</media:title>
  382. </media:content>
  383.  
  384. <media:content url="http://tobysamples.files.wordpress.com/2015/04/prefpane2.png" medium="image">
  385. <media:title type="html">prefpane2</media:title>
  386. </media:content>
  387.  
  388. <media:content url="http://tobysamples.files.wordpress.com/2015/04/targetdef1.png" medium="image">
  389. <media:title type="html">targetdef1</media:title>
  390. </media:content>
  391.  
  392. <media:content url="http://tobysamples.files.wordpress.com/2015/04/target1.png" medium="image">
  393. <media:title type="html">target1</media:title>
  394. </media:content>
  395. </item>
  396. <item>
  397. <title>Maven, and an easy way to use it with XPages</title>
  398. <link>https://tobysamples.wordpress.com/2015/04/13/maven-and-an-easy-way-to-use-it-with-xpages/</link>
  399. <comments>https://tobysamples.wordpress.com/2015/04/13/maven-and-an-easy-way-to-use-it-with-xpages/#comments</comments>
  400. <pubDate>Mon, 13 Apr 2015 01:15:18 +0000</pubDate>
  401. <dc:creator><![CDATA[tsamples23]]></dc:creator>
  402. <category><![CDATA[Uncategorized]]></category>
  403.  
  404. <guid isPermaLink="false">http://tobysamples.wordpress.com/?p=73</guid>
  405. <description><![CDATA[For some time now the Domino community, with good reason, has been very focused on using Java inside of Domino, specifically with XPages.  There are some great reasons to use Java, but one of the foremost reasons is support from the Java community in both word (Stackoverflow) and deed (Third party libraries).   These third [&#8230;]<img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=73&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
  406. <content:encoded><![CDATA[<p>For some time now the Domino community, with good reason, has been very focused on using Java inside of Domino, specifically with XPages.  There are some great reasons to use Java, but one of the foremost reasons is support from the Java community in both word (Stackoverflow) and deed (Third party libraries).   These third party libraries are a huge reason to be a Java developer.  They come in all shapes and sizes but in the end it means less code that you have to write that you can trust.  I&#8217;m sure that if you have been using Java for any length of time, you have probably searched for a library to do something, found it, and went to the download page, only to be presented with some XML tags instead of a download link.  These XML Tags might look like this:</p>
  407. <p>&lt;dependency&gt;<br />
  408. &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;<br />
  409. &lt;artifactId&gt;httpclient&lt;/artifactId&gt;<br />
  410. &lt;version&gt;4.1.1&lt;/version&gt;<br />
  411. &lt;/dependency&gt;</p>
  412. <p>This is the typical structure to add a Maven dependency to your project.</p>
  413. <p>Maven is an application that can do many things as listed below, however in this case we are using Maven as a package tool so that you when you go to build your project it will download any dependencies and (here is the key) any dependencies the dependencies have.  For Instance I might add the Social Business Toolkit as a dependency to my project.  When maven runs on my project it will download the apache http client library because its a dependency for the sbt.  I don&#8217;t have to mention the apache http client anywhere, Maven looks at the projects configuration and figure out its dependencies.</p>
  414. <ul>
  415. <li>Making the build process easy</li>
  416. <li>Providing a uniform build system</li>
  417. <li>Providing quality project information</li>
  418. <li>Providing guidelines for best practices development</li>
  419. <li>Allowing transparent migration to new features</li>
  420. </ul>
  421. <p>So with Domino we are use to having dependencies as JAR files instead of as a list in an XML file.  There is a way to make Maven build all of the Dependencies you have as a single JAR file.  Basically this will allow you to work inside of your project as you always have without adding a dependency on Maven and hopefully will make your life easier.</p>
  422. <p>Its really pretty simple also.</p>
  423. <p>Maven is an install-able executable that you can get from here:</p>
  424. <p><a href="https://maven.apache.org" rel="nofollow">https://maven.apache.org</a></p>
  425. <p>Once installed on your PC, you just have to make sure the mvn.exe is in your PATH environment variable</p>
  426. <p>So every project that is to be build with Maven requires a pom.xml this file describes what dependencies the project has among other things.</p>
  427. <p>So if you add a dependency like the apache http client above, when maven builds your project it will download the appropriate version for you.</p>
  428. <p>If you use the maven-assembly-plugin it will then build put all of the jars together into a single jar that you can add to an agent or an xpages project.</p>
  429. <p>So How do you do this you might be wondering. First you need a pom.xml file inside of an empty directory.  It needs some basic information about your project, Below is the a sample</p>
  430. <p>&nbsp;</p>
  431. <p>&lt;project xmlns=&#8221;<a href="http://maven.apache.org/POM/4.0.0&#038;#8243" rel="nofollow">http://maven.apache.org/POM/4.0.0&#038;#8243</a>; xmlns:xsi=&#8221;<a href="http://www.w3.org/2001/XMLSchema-instance&#038;#8221" rel="nofollow">http://www.w3.org/2001/XMLSchema-instance&#038;#8221</a>;<br />
  432. xsi:schemaLocation=&#8221;<a href="http://maven.apache.org/POM/4.0.0" rel="nofollow">http://maven.apache.org/POM/4.0.0</a> <a href="http://maven.apache.org/xsd/maven-4.0.0.xsd&#8221;&#038;gt" rel="nofollow">http://maven.apache.org/xsd/maven-4.0.0.xsd&#8221;&#038;gt</a>;<br />
  433. &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br />
  434. &lt;groupId&gt;com.tobysamples.test&lt;/groupId&gt;<br />
  435. &lt;artifactId&gt;tsamples&lt;/artifactId&gt;<br />
  436. &lt;version&gt;0.1.0&lt;/version&gt;<br />
  437. &lt;packaging&gt;jar&lt;/packaging&gt;<br />
  438. &lt;name&gt;test&lt;/name&gt;<br />
  439. &lt;dependencies&gt;<br />
  440. &lt;dependency&gt;<br />
  441. &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;<br />
  442. &lt;artifactId&gt;httpclient&lt;/artifactId&gt;<br />
  443. &lt;version&gt;4.1.1&lt;/version&gt;<br />
  444. &lt;/dependency&gt;<br />
  445. &lt;/dependencies&gt;<br />
  446. &lt;build&gt;<br />
  447. &lt;plugins&gt;<br />
  448. &lt;plugin&gt;<br />
  449. &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;<br />
  450. &lt;executions&gt;<br />
  451. &lt;execution&gt;<br />
  452. &lt;phase&gt;package&lt;/phase&gt;<br />
  453. &lt;goals&gt;<br />
  454. &lt;goal&gt;single&lt;/goal&gt;<br />
  455. &lt;/goals&gt;<br />
  456. &lt;/execution&gt;<br />
  457. &lt;/executions&gt;<br />
  458. &lt;configuration&gt;<br />
  459. &lt;descriptorRefs&gt;<br />
  460. &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;<br />
  461. &lt;/descriptorRefs&gt;<br />
  462. &lt;/configuration&gt;<br />
  463. &lt;/plugin&gt;<br />
  464. &lt;/plugins&gt;<br />
  465. &lt;/build&gt;<br />
  466. &lt;/project&gt;</p>
  467. <p>&nbsp;</p>
  468. <p>So you can create a new pom.xml file with the above in it in an otherwise empty directory.</p>
  469. <p>Then all you have to do is change to that directory using the command line then run &#8220;mvn package&#8221;</p>
  470. <p>This will try to package all of the dependencies together as a single jar and save them in your directory.</p>
  471. <p>If you look in you will now see a Target directory that holds the jar that you can attach to your project.  Hopefully this will help some of you not get stuck in dependency hell that Java can be sometimes.</p>
  472. <p>Maven can get a little complex and is a whole new set of skills to learn, but they can and will make your life easier if you get your head wrapped around it.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tobysamples.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tobysamples.wordpress.com/73/" /></a> <img alt="" border="0" src="https://pixel.wp.com/b.gif?host=tobysamples.wordpress.com&#038;blog=47274917&#038;post=73&#038;subd=tobysamples&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
  473. <wfw:commentRss>https://tobysamples.wordpress.com/2015/04/13/maven-and-an-easy-way-to-use-it-with-xpages/feed/</wfw:commentRss>
  474. <slash:comments>1</slash:comments>
  475. <media:content url="http://1.gravatar.com/avatar/71d187e65290a055f27764549ed4cc87?s=96&#38;d=identicon&#38;r=G" medium="image">
  476. <media:title type="html">tsamples23</media:title>
  477. </media:content>
  478. </item>
  479. </channel>
  480. </rss>
  481.  

If you would like to create a banner that links to this page (i.e. this validation result), do the following:

  1. Download the "valid RSS" banner.

  2. Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)

  3. Add this HTML to your page (change the image src attribute if necessary):

If you would like to create a text link instead, here is the URL you can use:

http://www.feedvalidator.org/check.cgi?url=http%3A//tobysamples.wordpress.com/feed/

Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda