Java EE: Logging User Interaction the Aspect-Oriented Way using Interceptors

Using dependency injection and aspect-oriented mechanisms like interceptors allow us to separate cross-cutting-concerns in our Java enterprise application, to control global aspects of our application and to avoid boilerplate code. In the following short tutorial we’re going to create an aspect-oriented logger to protocol the initiating user, class and method called and the parameters passed to the method and finally we’re adding this interceptor to a sample RESTful web-service by adding a simple annotation. ...

May 26, 2014 · 6 min · 1275 words · Micha Kops

Maven Tomcat Plugin: Adding Authentication to an Embedded Tomcat

The Tomcat Maven Plugin not only allows us to deploy our mavenized application to an existing Tomcat server but also to run our web application with an embedded instance from our project’s directory. Recently I needed to add basic authentication to such an instance and wanted to share the steps necessary here Prerequisites We just need Maven and a JDK … Java Development Kit >= 6 Maven 3 Project Setup I am using the webapp archetype here We’re adding the following configuration for the Tomcat plugin to your pom.xml – my final descriptor is this one pom.xml...

October 12, 2011 · 3 min · 616 words · Micha Kops