RESTEasy as a servlet filter

Posted by on May 21, 2013 in technology | 1 comment

So I’ve been (slowly) working on converting my budgeting app from Python/Django to Java. I really like Django, but this web app doesn’t really fit in the Django paradigm the way I initially thought. Oh well, it’s a good opportunity to do more programming.

Anyway, as I have been doing the migration I decided to use RESTEasy to do the URL mapping. I’m a big fan of pretty URLs for any site, and RESTEasy makes the whole process nice and easy (or so I thought).

I decided that the nice way to go was with a completely annotation based system (CDI with annotations and RESTEasy Path annotations). Unfortunately the RESTEasy documentation doesn’t do a good job of documenting how to run with both a servlet filter, and annotations (you’ll see their example web.xml snippet has the servlet filter with a JAX-RS Application class). The documentation does say that you can add a configuration switch to have RESTEasy scan for annotations, but it lists them as context-params for the servlet based approach.

After trying a number of different combinations without any luck, I went the debugging route. Slapping the RESTEasy source in my Eclipse project, I ran through the code to find where the configuration switches were loaded with the servlet filter. Luckily it didn’t take too long to find that context-params can be translated to init-params inside the filter element. This resulted in the following:

<filter>
 <filter-name>Resteasy</filter-name>
 <filter-class>org.jboss.resteasy.plugins.server.servlet.FilterDispatcher</filter-class>
 <init-param>
 <param-name>resteasy.scan</param-name>
 <param-value>true</param-value>
 </init-param>
</filter>

<filter-mapping>
 <filter-name>Resteasy</filter-name>
 <url-pattern>/*</url-pattern>
</filter-mapping>
Read More

the death of blogs

Posted by on Feb 4, 2010 in technology, thoughts | 1 comment

Kristie and I were talking about this recently, and we are both in agreement.  Blogs, at least in our circle of friends, are going the way of the dinosaurs.  Now, I’m not talking about the blog format in general.  There are plenty of sites using the blog format that are headed in the opposite direction.  I’m talking specifically about personal blogs.

I’m just as guilty as anyone; my last post was almost 3 months ago and it was for a class.

The culprit: micro-blogging.  Twitter and Facebook updates are the new blog.  It makes sense though.  Who wants to spend their time writing out posts when they can just as easily (and more often more easily) make a tiny update.

Just a thought…

Read More

code producing code

Posted by on Nov 14, 2009 in coop course | 1 comment

This week at work I learned about ICEfaces, as well as my managers dislike of it.  I’m not sure what it is that I dislike about writing code that in turn writes code, but that is definitely the case with ICEfaces.  There’s just something that feels inefficient about some program interpreting my code and then generating more code from that.  I know that is what a compiler does, but that’s the whole purpose of compilers.  That is not the case for many code producing mechanisms.

Regardless of how I feel about such a thing, it was nice to get some more insight in to what is actually being used in the corporate world.  Most of my web development experience has been in PHP and with apache.  In fact, I didn’t even realize that many people even used Java for web development.  I just assumed that most web development was done in either PHP or .NET.

Read More

testing 1,2,3

Posted by on Nov 7, 2009 in coop course | 0 comments

I now understand why writing functional tests or unit test for code is so important.  I have taken a course that included some test-driven development and assignments that required unit tests.  Intellectually I have understood the value of these tests, but I never really saw the full benefits of writing tests (although I’m sure I still don’t fully understand).

This week at work one of my big tasks was to write tests for a library that had been written previously and is now being used in a system my team is developing.  In writing these tests, I have been able to learn several things about the library:

  1. How the code works, and what it is supposed to do
  2. The database that the code was written for is not the same one we are using
  3. The library was missing several key functions

If I hadn’t written test for this library, I would still have been in the dark about how it was doing what it was doing (even though I had written a web service that called all the library functions).  I definitely wouldn’t have realized that it was missing features, and I definitely wouldn’t have known why it wouldn’t have worked with our current database.  So, I saved myself and my team plenty of head scratching by writing tests.  Who would have thought test would save time?

Read More

deadlines

Posted by on Oct 31, 2009 in coop course | 0 comments

The past two weeks I have been working on project with a due date of ASAP.  More recently I have discovered that there are people waiting on me who won’t be too happy if I don’t meet my deadline.  Even though I have had plenty of deadlines at school, this one is different somehow.

Regardless of why it is different, I am definitely feeling the pressure.  It’s very interesting to see how I deal with this kind of different pressure.  In some ways it has been hard since I definitely feel like there is not enough time to complete this project by the deadline.  I know that the deadline isn’t completely a hard deadline, but I still want to get it done as quickly as possible.

It makes me realize that having a good manager can really make things go well.  My manager has been very helpful in answering my questions and helping me deal with the timelines/expectations of those affected by my project.  I’m very glad that I have been able to observe this kind of interaction, it seems to be a great experience.

Read More

back and forth

Posted by on Oct 25, 2009 in coop course | 0 comments

Over the course of my internship I have had to switch gears between different projects.  Sometimes new things would come up and I would need to focus my attention there.  Sometimes it was just because I had multiple projects on my list and the one I was just working on was waiting for someone else before I could continue.

Regardless of why I had to switch projects, I have noticed that if it has been a while since I last worked on the project I am switching to I often have to spend time re-orienting myself to the project.  This has been even more true with my freelancing in the years past (especially when it could be over a year before I come back to something).

I know it will be hard to force myself into a new system, but I really think that I need to start keeping notes about what I am doing on a project on a daily basis.  This is really so much easier said than done.  Code commenting can sometimes feel useless, so I can’t even imagine what it will seem like when I am writing a description of what I have just done.

Read More