Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Wednesday, December 3, 2008

Spring, Filters and Configuration easier than you think.

So I needed to add a filter for some cool stuff in my application.

First off I needed to get my filter to play nicely with Spring, so I needed to do the following in my web.xml

<filter>
<filter-name>myCoolNewFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>myCoolNewFilterSpringBean</param-value>
</init-param>
</filter>

So then I go ahead and open up my applicationContext.xml file and wire up the bean like normal

<bean name="myCoolNewFilterSpringBean" class="com.mycompany.filter.MyCoolNewFilter" />

Notice that the bean name in the app context matches the param-value in the filter config: myCoolNewFilterSpringBean

Then instead of trying to do URL patterns for the config of the filter I just tried the following:

<filter-mapping>
<filter-name>myCoolNewFilterSpringBean</filter-name>
<servlet-name>dispatcher</servlet-name>
</filter-mapping>

Which maps this filter to all filter all calls being directed to my dispatcher servlet! No nasty or convoluted URL patterns... Just easily readable servlet names!

Friday, July 20, 2007

Ruby On Rails

So last night I finally took the plunge into the world of Ruby on Rails. While I have yet to start writing any code, I did get MySQL, Ruby, and Rails installed. Now I am looking for a good editor for the darn files. I use Eclipse for my Java development and am pretty sure that there are some Ruby plugins for it, but it was late and I needed to go to bed.

Any how, I finally started this adventure since an old friend of mine runs Pirates Press, which is a record pressing company, and he is going to need someone to help enhance and maintain his site. So, I am sure that I will be posting about my adventures with Ruby On Rails.

I guess I need to visit Amazon and get a book on it... That might be the best thing for now.