Search This Blog

Monday 27 January 2014

Semaphores in Java

What exactly is a semaphore ?
To use the wiki definition:
In computer science, particularly in operating systems, a semaphore is a variable 
or abstract data type that is used for controlling access, by multiple processes, 
to a common resource in a parallel programming or a multi-user environment.

Monday 20 January 2014

Mapping a Filter directly to a Servlet

I guess we have all used filters in our web projects. The common approach that I have followed is specifying the URL patterns to be intercepted by the filter.
<filter>
    <filter-name>someFilter</filter-name>
    <filter-class>com.filter.SomeFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>someFilter</filter-name>
    <url-pattern>*.do</url-pattern>
</filter-mapping>
All urls having the .do extension will now pass through the filter. There is also one more way to specify the filter pattern.

Monday 13 January 2014

Which Log message belongs to which user ?

I created a very simple web application. In it any calls to URLs ending in ".do" reach the below servlet :

Thursday 9 January 2014

Handlers and Interceptors in CXF - Are they related ?

I have been trying out some things in CXF (and also feeling pretty good about it :P ) The other day I needed to modify the message of more than one web service in a common manner. I achieved the same using a CXF interceptor. However another team member did the same task using Handlers. Interestingly Handler is more a part of the JAX-WS vocabulary than Interceptor. So I decided to look at this option too.

Thursday 2 January 2014

Writing Logs to the Database

With loggers we have something called as an Appender. Simply defined an appender is a component responsible  for taking a log request, building the log message in a suitable format and sending it to the output device.