Java Servlet url-pattern - Exclude Me

Recently I was investigating one of the many Java web frameworks, and came across an old frustration. First though, I should give some background.

The Java Servlet specification provides for the ability for developers to map various URLs to specific Servlets (request handlers). You can map '*.do' to your Struts request dispatcher to enable the framework to handle all the requests for pages that should be served by the framework. Basic wild cards are supported, but only positive matching, no excludes.

One of the basic tenants I have adopted is that the URLs in an applications should be technology agnostic. If I can look at your website and tell what technology you are using, that is 'bad'. Of course, I didn't come up with this wisdom on my own, it is mostly guided by the W3C Cool URLs Article. So if your app has cgi-bin, .pl, .jsp, .asp, or .aspx files, etc, I consider that bad form. Of course, I can setup my Java application with all the pages named .aspx, but I find it much better to keep it generic to begin with.

One of the main issues I face when I use a web framework is how to integrate the main request dispatcher without manually mapping every valid URL. What I would like is the ability to map everything EXCEPT certain URLs.

For example, I'd like to map /* to my dispatcher, with the exception of *.html, *.gif, *.jpg, *.css, and *.js. This allows me to have all the dynamic requests served by the dispatcher, while the static content is served normally. In a production environment, I can accomplish this using Apache to only pass through the URLs I define to Tomcat (Apache does have the 'except' logic in it's mapping).

Another common example is applying Servlet Filters. Using Servlet Filters you can apply security or any type of logic to a large set of requests. Maybe I would like to secure all the pages in my site except for / and /login. Today I map the filter to all the URLs, and then in code define any URLs that should be excluded. However, in doing this I've mixed my configuration between my web.xml file and my source code.

The ability to define a Regular Expression, or more complex rules (match 'a' except 'b') would give much greater flexibility.

A few Google searches have yielded some mildly interesting work-arounds but, nothing that I really find satisfyingly. Let me know if you have any better solutions.

UPDATE: Thanks for the many work-arounds in the comments. There is another option as well, see my new post for details.

Joining the online revolution

I've been a bit of a skeptic when it came to embracing hosted services. I could setup and run my own email server, web server, etc. and didn't see the need or justification to pay someone else to do it. In fact, I actually wrote my own Java Email Server.

However, as I look back of the last couple of months, I've moved to a much greater dependence online services.

I moved my email and web servers from my own hosted box to a hosting provider. The services offered are so cost effective that it isn't worth the time or hassle of worrying about maintaining it. But hosting was just the beginning.

In addition to moving to hosted services, I've also moved to online applications. I was a big user of SharpReader, a RSS reader written in C# (hence the name). I looked at Bloglines a long time ago, as well as Google Reader when it first came out. Neither seemed that impressive, and being able to browse my feeds offline seemed appealing. However, when Google Reader recently came out with an upgraded version I switched. One key is the keyboard shortcuts (which bloglines has as well now). Another big reason I like it is the ability to view each post individually, something that I didn't see how to do on Bloglines (at least when I looked initially).

Additionally, I also moved my email from Thunderbird to Google Mail. I still maintain my email address (@ericdaugherty.com), but the emails all get forwarded to my gmail account, and emails sent appear to come from my @ericdaugherty.com account. The searching and labeling (tagging) have reduced my need (and time) to organize my emails into folders, which is liberating (although a bit of a leap of faith initially). And the spam filtering is great (although I have had one false positive, which is worrying).

Overall, I'm extremely happy with the new arrangements. I think when you boil it down, there are really two reasons it works for me.

1. Keyboard Shortcuts. I can navigate gmail and Google Reader entirely from the keyboard.
2. Ubiquitous network access. WiFi is nearly everywhere, and where there is no WiFi, I can use my cell phone as a modem. This works great on Metra, allowing me to read email and rss anywhere.

An honorable mention goes to the gmail interface on the Treo, which provides better access than the POP client I used for my old email. There is also an Google Reader site optimized for the Treo, although I don't find myself using that very often.

A second honorable mention goes to Google Desktop, and the integration of my gmail search with my desktop search (something I had with Thunderbird).

I've even played with Google's Docs & Spreadsheets application. For a lot of simple uses, it is good enough to use over Excel and Word. It is certainly slower, although having access to it anywhere is nice. The one use I really found useful was sharing the document with a colleague and both editing it simultaneously, something that is not easily reproducible in Excel. It isn't a Office killer yet, but the potential is there.

All in all, I'm very happy with this arrangement, and will be much more willing to look at hosted solutions for other applications.

Tag Clouds

Tag Clouds are a 'new' way to display information. Specifically, it is a visual way to depict the occurrences or popularity of a specific word. Apparently this started with Flickr, although it is now common, especially among Web 2.0 companies.

I really dislike tag clouds. OK, they aren't really offensive, but I'm a numbers guy, and I'd much rather see the information displayed in a table or graph than as a tag cloud. I don't find it really accurate or useful.

Like any good fad, they are now being applied to everything you can think of. For example, a tag cloud of presidential speeches.

Google Calendar

My wife and I both have reasonably busy schedules, but we never had a way to keep track of each other's schedules. We've both carried PDAs for a long time and maintained our schedules electronically, but we still didn't have an easy way to view or edit each other's schedule.

As part of a larger shift (which is the subject of a future post), I moved both of our calenders to Google Calender. We still use our PDAs (Palm/Treo), but we use Companion Link's synchronization tool to keep them in sync with the Google Calendar. Using Google Calendar we can view each other's schedules, and easily copy appointments from one to another.

Google Calendar also allows you to view other public calendar's on your calendar as well. I use the US Public Holiday's calendar, the Illini basketball schedule (although this year I wish I didn't), and the Chicago Bear's schedule (much more fun to watch this year). You can turn on or off any calendar, so it doesn't clutter up your views.

I don't sync the other calender's with my Treo, so it is maintained as my clean primary schedule.

It has been a great solution for us, and while it isn't perfect, is a very good low maintenance approach.

LinkedIn Can Work

I've been a LinkedIn user for a while now, and I like to look around and see who people know, but it never had a big payoff. However, that all changed recently.

I was going through my address book and checking to see if I had linked to all my known contacts. I came across Aaron, who I worked with several years ago but no longer had a valid email address. I did a quick search and found out that he was in my network. I had my contact 'forward' the request on to him, and we got back in touch.

It is easy to lose track of people, and often hard to get back on touch.

One interesting side node to this. One of the bigger uses for LinkedIn is for recruiters to create huge networks and use it to identify resources. This is useful, but some people may feel that it is an abuse of the system. They don't REALLY know all their contacts well, they are just people they talked to at some point. However, people like this are useful to the system. When I reached out to Aaron, one of the links between us was a recruiter. People like this help 'grease the skids'.

Anyway, if nothing else the experience justified my further upkeep of my network.

iTunesExport 1.0.4 Released

I released a new version of my iTunesExport utility.

iTunesExport exports your iTunes playslists as .m3u files, allowing you to setup playlists in iTunes and use them with other software or devices.

This release fixes issues with playlists that include \ / or : characters.

http://www.ericdaugherty.com/dev/itunesexport

HD-DVD and Blue Ray both Cracked

My previous post points out the frustration I have with lengths companies go to to 'protect' their content. They add DRM to disks and encryption to interconnects. In order to truly secure the content, you have to protect it at every level.

The problem is, it isn't possible.

The news that HD-DVD has been broken came out just before Christmas. Not, it appears that Blue Ray has been broken as well.

So the industry has now spent a ton of money to create a new standard (HDCP) to protect content, only to have the content cracked in a different place in the chain (right off the disc).

So now I can't distribute high quality content within my own home, but Johnny down the street can sell bootlegged copies of HD-DVD and Blue Ray discs.

Maybe if they had invested hiring better writers than foisting a horrible DRM scheme (HDCP) on us, they'd make more money.

HDMI is Evil (DVI is too)

What is HDMI?

See
Wikipedia for a full definition, but it is essentially a way to plug your high definition video sources into your display device. Decoded: plug your HD-DVD to your TV.

Is it Better?

HDMI touts several advantages over the existing alternative, Component Video. It is digital instead of analog, carries audio as well as video, and does it all in a single cable. These all sound great, but are they really true?

Digital v. Analog - Both Component and HDMI are capable of carrying signals up to 1080p. There are no obvious performance differences, and an unscientific analysis from people who have tested both have produced mixed results. The bottom line, no clear advantage.

Easier - No doubt, HDMI is easier to plug in than Component cables and digital audio cables. Of course, most people do this once a year at most, so I'm not sure this should carry much weight.

Disadvantages

Not only are HDMI's advantages minimal, but it has some purely technical disadvantages as well.

Short Runs - HDMI's max length is generally stated to be about 50', although this can only be achieved with high quality cables. This is great if you are plugging your DVD player into your TV in the same entertainment center, but when you start talking about home theaters with projectors or hooking up your second TV, there are major issues. Component cables can be run much longer (100' or more). (I'm a fan of Blue Jean Cable, and you can see their thoughts about why HDMI is broken)

Incompatibility - There are many reports about sources and display devices having computability problems. One 'feature' of HDMI is that is uses HDCP to protect the content. This means that the two sources exchange keys and then use those keys to encrypt all data transmitted. When this works fine it is seamless. However, many people have reported issues with the signal dropping, causing them to have to 'reboot' their source and/or display.

But EVIL?

This issue really hit home for me recently as I started investigating a way to do 'whole house' distribution of my High Definition DVR. I currently do whole house distribution of Standard Definition signals using an RF Modulator (topic for a future post). However, as I now have a second High Definition television, I'd like to be able to watch my DVR'ed shows on either TV.

What I've found is that while there are a ton of ways to distribute component video signals using Cat5 cable, there is no way to convert HDMI or DVI sources to Component. Additionally, there are no ways to distribute HDMI over long distances.

The issue lies with Digital Rights Management (DRM). It is illegal (in the US at least) to sell equipment that will convert HDMI or DVI signals to component (or any other analog) signal. This is part of what is known as 'closing the analog hole'.

So What?

So why does this matter? After all, most sources can output their signal on either Component or HDMI right? Well, sort of. My existing source (High Def DirecTivo) will output its signal in full definition on any output. However, many new devices will not allow the full signal on Component cables.

Upconverting DVDs - Most (all?) current Upconverting DVD players will only output full High Def (1080i) on the HDMI inputs. The Component outputs will only output up to 480p. See the OPPO DV 970HD as an example. I have found some that have work arounds, etc, but by and large the component outputs are already locked out.

XBox 360 - While it does appear that you can output High Def on the component output (it does not even have HDMI), there are a few catches. Basically, it won't upconvert DVDs on the Component output (only on the VGA output), and it will downconvert HD-DVD to 1080i (from 1080p) on component, although full 1080p will be available on VGA. This seems odd as the VGA output should be unprotected.

Regardless, the bottom line is that studios and manufacturers are locking down and limiting the capabilities of the Component outputs, and while there are some work arounds today, these will continue to be harder to find and implement.

In the future, it may become impossible to distribute High Definition signals to multiple TVs in your home.