<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6444606119859742662</id><updated>2011-07-31T02:06:51.314-07:00</updated><category term='rest'/><category term='unidata'/><category term='java'/><category term='SecurityContext'/><category term='spring'/><category term='drools'/><category term='restful'/><category term='jersey'/><category term='school'/><category term='unidata-rest'/><category term='http'/><category term='work'/><category term='uniobjects'/><title type='text'>Implementation Is Harder Than Conception</title><subtitle type='html'>Coding can be like making babies. Conception only takes a minute, but implementation takes forever.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bigcabeza.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://bigcabeza.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Matthew Sowders</name><uri>http://www.blogger.com/profile/15276833862513276534</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6444606119859742662.post-5119108998757358800</id><published>2009-12-30T17:29:00.000-08:00</published><updated>2009-12-30T17:56:31.366-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drools'/><category scheme='http://www.blogger.com/atom/ns#' term='work'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='school'/><title type='text'>A Little Too Ambitious</title><content type='html'>I have not blogged in a while because of finals and work.  I may have been a little too ambitious with this whole blogging thing while I'm going to school full time and working overtime. I am going to try to keep on trucking though.&lt;br /&gt;&lt;br /&gt;I think I did really well my first semester of graduate school. I received an 'A' in Software Architecture, and 'A' in Multiparadigmatic Programming, and a 'B+' in Computational Geometry. I learned a lot this semester. Multiparadigmatic programming had to be my favorite. We learned about functional programming with &lt;a href="http://en.wikipedia.org/wiki/Scheme_%28programming_language%29"&gt;scheme&lt;/a&gt;, and process-oriented programming in &lt;a href="http://pop-users.org/wiki/occam-pi"&gt;occam&lt;/a&gt;.  We also did presentations on a language we had never programmed in before. I did my presentation on &lt;a href="http://en.wikipedia.org/wiki/Objective-C"&gt;Objective-C&lt;/a&gt; , though I did not care for it much.  The presentations definitely got me interested in &lt;a href="http://en.wikipedia.org/wiki/Erlang_%28programming_language%29"&gt;erlang&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Go_%28programming_language%29"&gt;go&lt;/a&gt;, and &lt;a href="http://en.wikipedia.org/wiki/Scala_%28programming_language%29"&gt;scala&lt;/a&gt;. I enjoy these newer languages that have concurrency built into the language.&lt;br /&gt;&lt;br /&gt;Work has set me to a &lt;a href="http://www.springframework.org"&gt;Spring MVC&lt;/a&gt; project that also involves &lt;a href="http://www.jboss.org/drools"&gt;Drools&lt;/a&gt;, and I have been putting in a lot of hours. I am psyched that I get to work on all these awesome technologies that I have wanted to work with. I convinced the powers that be, to use this as a pilot project to start centralizing business logic in the Guvnor Business Rules Management System. As I progress, I will try to post some Spring and Drools/Guvnor gotchas.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6444606119859742662-5119108998757358800?l=bigcabeza.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigcabeza.blogspot.com/feeds/5119108998757358800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigcabeza.blogspot.com/2009/12/little-too-ambitious.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default/5119108998757358800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default/5119108998757358800'/><link rel='alternate' type='text/html' href='http://bigcabeza.blogspot.com/2009/12/little-too-ambitious.html' title='A Little Too Ambitious'/><author><name>Matthew Sowders</name><uri>http://www.blogger.com/profile/15276833862513276534</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6444606119859742662.post-1585271990892991001</id><published>2009-11-09T22:40:00.000-08:00</published><updated>2009-11-09T23:15:00.266-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='restful'/><category scheme='http://www.blogger.com/atom/ns#' term='rest'/><category scheme='http://www.blogger.com/atom/ns#' term='unidata'/><category scheme='http://www.blogger.com/atom/ns#' term='unidata-rest'/><category scheme='http://www.blogger.com/atom/ns#' term='jersey'/><category scheme='http://www.blogger.com/atom/ns#' term='SecurityContext'/><title type='text'>Authentication in Jersey</title><content type='html'>I recently added authentication to &lt;a href="http://code.google.com/p/unidata-rest"&gt;unidata-rest&lt;/a&gt; by walking through the examples provided by &lt;a href="http://weblogs.java.net/blog/mhadley/archive/2008/03/authentication.html"&gt;Marc Hadley&lt;/a&gt;, and I thought I would share my experience. If you have never had to implement authentication in &lt;a href="https://jersey.dev.java.net/"&gt;Jersey&lt;/a&gt; before, I hope this will help. I have shortened it for brevity, but you can check it out if you like.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;@Path("{account}")&lt;br /&gt;public class AccountResource  {&lt;br /&gt;  private static final String USER_ROLE = "UNIDATA_REST_USER";&lt;br /&gt;&lt;br /&gt;  @GET&lt;br /&gt;  @Produces("application/atom+xml")&lt;br /&gt;  public Response getAtomFeed(&lt;br /&gt;          @Context SecurityContext sc,&lt;br /&gt;          @DefaultValue("")&lt;br /&gt;          @PathParam("account") String account) {&lt;br /&gt;      Response response;&lt;br /&gt;      if(!sc.isUserInRole(USER_ROLE)){&lt;br /&gt;          throw new WebApplicationException(Response.Status.FORBIDDEN);&lt;br /&gt;      }&lt;br /&gt;      ...&lt;br /&gt;      return response;&lt;br /&gt;  }&lt;br /&gt;  ...&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Ok, this is where things get a little confusing. In the web.xml file you need to define a security-constraint where you define the resources you would like to secure as well as their associated roles. You also need to define a login-config and a security role.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&amp;gt;&lt;br /&gt;  &amp;lt;context-param&amp;gt;&lt;br /&gt;      &amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;&lt;br /&gt;      &amp;lt;param-value&amp;gt;classpath:applicationContext.xml&amp;lt;/param-value&amp;gt;&lt;br /&gt;  &amp;lt;/context-param&amp;gt;&lt;br /&gt;  &amp;lt;listener&amp;gt;&lt;br /&gt;      &amp;lt;listener-class&amp;gt;org.springframework.web.context.ContextLoaderListener&amp;lt;/listener-class&amp;gt;&lt;br /&gt;  &amp;lt;/listener&amp;gt;&lt;br /&gt;  &amp;lt;listener&amp;gt;&lt;br /&gt;      &amp;lt;listener-class&amp;gt;org.springframework.web.context.request.RequestContextListener&amp;lt;/listener-class&amp;gt;&lt;br /&gt;  &amp;lt;/listener&amp;gt;&lt;br /&gt;  &amp;lt;servlet&amp;gt;&lt;br /&gt;      &amp;lt;servlet-name&amp;gt;ServletAdaptor&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;      &amp;lt;servlet-class&amp;gt;com.sun.jersey.spi.spring.container.servlet.SpringServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;      &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;  &amp;lt;/servlet&amp;gt;&lt;br /&gt;  &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;      &amp;lt;servlet-name&amp;gt;ServletAdaptor&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;      &amp;lt;url-pattern&amp;gt;/resources/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;  &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;  &amp;lt;security-constraint&amp;gt;&lt;br /&gt;      &amp;lt;display-name&amp;gt;UniDataResources&amp;lt;/display-name&amp;gt;&lt;br /&gt;      &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;          &amp;lt;web-resource-name&amp;gt;UniDataResources&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;          &amp;lt;description&amp;gt;UniData RESTful Resources&amp;lt;/description&amp;gt;&lt;br /&gt;          &amp;lt;url-pattern&amp;gt;/resources/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;          &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;          &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;          &amp;lt;http-method&amp;gt;HEAD&amp;lt;/http-method&amp;gt;&lt;br /&gt;          &amp;lt;http-method&amp;gt;PUT&amp;lt;/http-method&amp;gt;&lt;br /&gt;          &amp;lt;http-method&amp;gt;OPTIONS&amp;lt;/http-method&amp;gt;&lt;br /&gt;          &amp;lt;http-method&amp;gt;TRACE&amp;lt;/http-method&amp;gt;&lt;br /&gt;          &amp;lt;http-method&amp;gt;DELETE&amp;lt;/http-method&amp;gt;&lt;br /&gt;      &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;      &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;          &amp;lt;description&amp;gt;Have to be a UNIDATA_REST_USER&amp;lt;/description&amp;gt;&lt;br /&gt;          &amp;lt;role-name&amp;gt;UNIDATA_REST_USER&amp;lt;/role-name&amp;gt;&lt;br /&gt;      &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;  &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;  &amp;lt;login-config&amp;gt;&lt;br /&gt;      &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;      &amp;lt;realm-name&amp;gt;file&amp;lt;/realm-name&amp;gt;&lt;br /&gt;  &amp;lt;/login-config&amp;gt;&lt;br /&gt;  &amp;lt;security-role&amp;gt;&lt;br /&gt;      &amp;lt;description/&amp;gt;&lt;br /&gt;      &amp;lt;role-name&amp;gt;UNIDATA_REST_USER&amp;lt;/role-name&amp;gt;&lt;br /&gt;  &amp;lt;/security-role&amp;gt;&lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I am using GlassFish, but I am sure there is a similar step for most app servers.&lt;br /&gt;Now for the default configuration, I just used the file realm to keep things simple and added a user in there called "restuser" and assigned the UNIDATA_REST_USER group to it. In order to map from the role-name to a group you need to define a mapping.  I added a sun-web.xml&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd"&amp;gt;&lt;br /&gt;&amp;lt;sun-web-app error-url=""&amp;gt;&lt;br /&gt;&amp;lt;security-role-mapping&amp;gt;&lt;br /&gt;  &amp;lt;role-name&amp;gt;UNIDATA_REST_USER&amp;lt;/role-name&amp;gt;&lt;br /&gt;  &amp;lt;group-name&amp;gt;UNIDATA_REST_USER&amp;lt;/group-name&amp;gt;&lt;br /&gt;&amp;lt;/security-role-mapping&amp;gt;&lt;br /&gt;&amp;lt;class-loader delegate="true"/&amp;gt;&lt;br /&gt;&amp;lt;jsp-config&amp;gt;&lt;br /&gt;  &amp;lt;property name="keepgenerated" value="true"&amp;gt;&lt;br /&gt;    &amp;lt;description&amp;gt;Keep a copy of the generated servlet class' java code.&amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;/property&amp;gt;&lt;br /&gt;&amp;lt;/jsp-config&amp;gt;&lt;br /&gt;&amp;lt;/sun-web-app&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I think eventually I would like to refactor the security check into an AOP Aspect, as well as have different roles for GET, PUT, POST, and DELETE. In my next post, I'll talk about using &lt;a href="https://rome.dev.java.net/"&gt;Rome&lt;/a&gt; to connect to this service.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6444606119859742662-1585271990892991001?l=bigcabeza.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigcabeza.blogspot.com/feeds/1585271990892991001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigcabeza.blogspot.com/2009/11/authentication-in-jersey.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default/1585271990892991001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default/1585271990892991001'/><link rel='alternate' type='text/html' href='http://bigcabeza.blogspot.com/2009/11/authentication-in-jersey.html' title='Authentication in Jersey'/><author><name>Matthew Sowders</name><uri>http://www.blogger.com/profile/15276833862513276534</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6444606119859742662.post-5953946746816835677</id><published>2009-11-07T07:33:00.000-08:00</published><updated>2009-11-07T08:07:12.949-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='restful'/><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='rest'/><category scheme='http://www.blogger.com/atom/ns#' term='unidata'/><category scheme='http://www.blogger.com/atom/ns#' term='uniobjects'/><category scheme='http://www.blogger.com/atom/ns#' term='spring'/><category scheme='http://www.blogger.com/atom/ns#' term='jersey'/><title type='text'>UniData REST</title><content type='html'>I am currently working on a generic &lt;a href="http://en.wikipedia.org/wiki/Representational_State_Transfer"&gt;RESTful&lt;/a&gt; web service for &lt;a href="http://www.rocketsoftware.com/u2/"&gt;UniData&lt;/a&gt;. For those unfamiliar with UniData, let me explain. UniData is a &lt;a href="http://en.wikipedia.org/wiki/MultiValue"&gt;multivalued database&lt;/a&gt;. For a programmer, that means everything you know about SQL, relational calculus, normal forms, referential integrity, data type integrity, ORM and pretty much any cool new modern technology goes right out the window. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, the system does have a Java API, which you can use to query and get XML back. My idea is to abstract away the more gruesome details of this API and expose the data in a uniform manner through HTTP.  When querying a collection, you get an Atom feed back with each entity containing a link to the actual resource.  The project is implemented using Java, &lt;a href="http://code.google.com/p/unidata-rest/"&gt;Jersey&lt;/a&gt;, &lt;a href="http://www.springsource.org/"&gt;Spring&lt;/a&gt;, and the &lt;a href="http://www.rocketsoftware.com/u2/middleware/index.html#uniobjects-j"&gt;UniObjects&lt;/a&gt; for Java API. I have only implemented GET so far, but I am working on PUT, POST, and DELETE.  If you are interested, I have open sourced the code through google code the project name is &lt;a href="http://code.google.com/p/unidata-rest/"&gt;unidata-rest&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6444606119859742662-5953946746816835677?l=bigcabeza.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigcabeza.blogspot.com/feeds/5953946746816835677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigcabeza.blogspot.com/2009/11/unidata-rest.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default/5953946746816835677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default/5953946746816835677'/><link rel='alternate' type='text/html' href='http://bigcabeza.blogspot.com/2009/11/unidata-rest.html' title='UniData REST'/><author><name>Matthew Sowders</name><uri>http://www.blogger.com/profile/15276833862513276534</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6444606119859742662.post-5786485919427117246</id><published>2009-11-05T23:37:00.000-08:00</published><updated>2009-11-05T23:43:00.324-08:00</updated><title type='text'>NOP</title><content type='html'>I want to make a conscience effort to be part of the software development community, and I believe the best way to utilize what I have learned is to post what I have learned -&gt; make a fool of myself -&gt; learn -&gt; repeat.  Please be gentle, it's my first time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6444606119859742662-5786485919427117246?l=bigcabeza.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bigcabeza.blogspot.com/feeds/5786485919427117246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bigcabeza.blogspot.com/2009/11/nop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default/5786485919427117246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6444606119859742662/posts/default/5786485919427117246'/><link rel='alternate' type='text/html' href='http://bigcabeza.blogspot.com/2009/11/nop.html' title='NOP'/><author><name>Matthew Sowders</name><uri>http://www.blogger.com/profile/15276833862513276534</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
