Archive

Archive for the ‘How Tos’ Category

Jfokus 2013: Responsive web design

Last week I attended Jfokus 2013 with my Kentor-collegue, Lotten Holm Goya. Just as last year it was inspiring, fun and rewarding. Some of my favorite talks were Design Patterns in modern JVM Languages by Venkat Subramaniam, An app is not enough by Joakim Kemeny and the keynote by Dan North. In this post I will talk about Responsive Web Design presented in the “An app is not enough” talk by Joakim Kemeny. At the end I will also link to a working example I made to test these principles.

Read more…

OpenEJB

openejbAn open source, embedded, lightweight, easy to configure EJB Container and EJB Server. Using OpenEJB turned out to be the salvation when developing EJB applications. Even if your requirement is not to start with the test first approach you still need to run your EJB class and can’t wait until to deploy. And deployment is not so fast as well unless you use special tools like JRebel or so on. You can find more information on web about OpenEJB and if there is something better than that. But when you have decided to use OpenEJB then you could face some problems which I took few hours for me to fix. Anyway let’s slide through the problems. Read more…

Validation using the builder pattern

I currently have a little crush in the builder pattern. This pattern and variations of it can solve common programming issues in a pretty straightforward way. I will give you an example of how you can use it in a validation context. A use case could be when you want to be able to perform different operations on the validation result. And you want a clean separation between the actual validation logic and the result of the validation. An advantage is that it is much less error prone e.g how to use the objects compared to letting a single class have all responsibility. Further it also makes it possible to have different “validation result objects” for the same validation logic, if needed.
Read more…

Hibernate and JPA guidelines [part 3]

This is the last post of three with Hibernate/JPA guidelines. This post consists more of some tips and trix rather then general guidelines. As I wrote in previous posts each topic is divided into three parts; problem, suggestion and value. All topics evolves from a identified problem and then makes a suggestion for dealing with the problem and a value for what benefits you get from using the suggestion.

Read more…

Hibernate and JPA guidelines [part 2]

This is the second post with Hibernate/JPA guidelines. As I wrote in the previous post each topic is divided into three parts; problem, suggestion and value. All topics evolves from a identified problem and then makes a suggestion for dealing with the problem and a value for what benefits you get from using the suggestion.
Read more…

Hibernate and JPA guidelines [part 1]

I recently had a cooperation with some colleagues from the Oracle team, putting together a document with some guidelines and tips for working with Hibernate/JPA and Oracle from a performance point of view. I decided to take some of these general guidelines and tips for Hibernate/JPA to do a three part serie with blogposts here on our blog. Each topic is divided into three parts; problem, suggestion and value. Each topic evolves from a identified problem and then makes a suggestion for dealing with the problem and a value for what benefits you get from using the suggestion. Anyone working with Hibernate or JPA should take some of these guidelines and tips under consideration. They are not just for improving performance. Some are more general best practices to ensure quality, easier coding and performance.

Read more…

RPC/Encoded webservice

When you need to consume a webservice and that service is using a deprecated rpc/encoded binding style, then you are faced with a problem that there is no real good solution to. In short, the problem is that all the JAX-WS implementations from a couple of years back have ommitted their support for this configuration. “The WS-I Basic Profile limits binding styles to either Document/literal or RPC/literal, and JAX-WS was designed to honor this limitation” I can think of a couple of options to work around this problem. Read more…

Publish JAX-WS services at runtime

One smooth way of testing your webservices is to use the lightweight HTTP server embedded into the JDK. This way you don’t have to deploy your services in a (tedious) JEE container, or servlet container for that matter. You can signifcantly improve your turnaround time between coding and deploying. Turns out all that is required is one line of code (at best).

import javax.xml.ws.Endpoint;
//..
{     
    Endpoint.publish("http://deploy/path/", new WebServiceImplementor());
}

Where the URI is the path to the location where you want your endpoint deployed and the second argument is your JAX-WS annotated endpoint implementation object. By the way, you will need at least Java SE 6.

Maven – Basics and plugins

This article targets building multi module project (with some basics) and showcasing different plugins. Before getting started let’s go through some Maven basics.  Maven serves similar purpose to Ant but in a different manner. The configurations are defined in a POM (Project Object Model) file which is an XML file. In this file dependencies are defined, build-order is set,  plugins are configured etc.  Below is the typical structure of the Maven project. Read more…

Representing a service both as RESTful and SOAP based using Apache CXF

2012-07-10 4 comments

Apache CXF is an open-source Web Services framework supporting both JAX-WS and JAX-RS. This means that we could create a service and offer it both as RESTful Web Service and traditional SOAP based Web Service. With CXF when you get the WSDL file (we will see how) or WADL (REST equivalent of WSDL) you can pass the link to the ones who are to write a client application and they can use it to configure the plugin and the required code is generated. With Maven things become even simpler. Read more…

Follow

Get every new post delivered to your Inbox.

Join 228 other followers