Embedding Jetty or Tomcat in your Java Application

Recently I needed to control an embedded web container from a Java application and I wanted to see how this could be achieved using an embedded instance of either Tomcat or Jetty here. In the following short examples I would like to show how to embed both servers in an application in no time using Gradle or Maven as build tool. Dependencies We just need to add the web container libraries to our project here .. I’ve added the build config for Gradle and Maven here… ...

July 9, 2013 · 4 min · 782 words · Micha Kops

Create Mobile Websites using Java Server Faces and PrimeFaces Mobile

The more smartphones and tablets are sold the bigger the need for a mobile version of a modern website. PrimeFaces Mobile helps us developers here and allows us to quickly create mobile websites that display well on an iPhone, Android, Palm, Blackberry, Windows Mobile and others. In the following tutorial we’re going to create a web application that is using Java Server Faces 2.1, PrimeFaces 3.1 and PrimeFaces Mobile 1.0 and runs on a simple web container like Tomcat or Jetty. ...

January 8, 2012 · 5 min · 990 words · Micha Kops

Testing RESTful Web Services made easy using the REST-assured Framework

Figure 1. REST-assured Integration Test Tutorial Logo There are many frameworks out there to facilitate testing RESTful webservices but there is one framework I’d like to acquaint you with is my favourite framework named REST-assured. REST-assured offers a bunch of nice features like a DSL-like syntax, XPath-Validation, Specification Reuse, easy file uploads and those features we’re going to explore in the following article. With a few lines of code and Jersey I have written a RESTful web service that allows us to explore the features of the REST-assured framework and to run tests against this service. ...

October 23, 2011 · 9 min · 1742 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

Java Server Faces/JSF 2 Tutorial – Step 1: Project setup, Maven and the first Facelet

In this short tutorial we are going to build a Java Server Faces Web-Application using JSF2.0, Facelets, Maven and Hibernate as ORM Mapper. The goals for this first step are: Setting up the project structure using Maven, defining a frame template/decorator and a registration facelet, creating a managed bean and mapping it’s values to the facelet, adding some basic validation, displaying validation errors and finally adding a navigation structure. In step2 of this tutorial we are going to add persistence using Hibernate, add some security, create a custom UI component and add some AJAX. ...

June 5, 2010 · 9 min · 1841 words · Micha Kops