Tag: jersey

Mariano Gonzalez on Wednesday, January 21, 2015

Give your old school API some love

2

If you’re an assiduous reader of this blog, then you probably already heard about our vision around APIs, our Anypoint API Manager solution and all our RAML based stories. Those are our recommended way of approaching REST APIs and if you haven’t already, we all highly recommend you to take a look at them. However, we’re about connecting everything, everywhere. Thus we recognize that there are a lot of APIs out there built in plain old Java code and a migration process is not something you can do overnight. If you own such an API, this post is about us wanting to help you too. Anypoint Platform includes a Jersey module to allow embedding Jersey-based APIs into the runtime, reusing the Java code powering your API but still gaining access to all the other features of the platform. In Mule 3.6 we upgraded our supported Jersey version from 1.6 to v2.11 to give you access to the latest and greatest that Jersey has to offer.

How many web sites/web services have you wished you could just interact with over the command line? Sometimes, you just want to type commands in your shell. I can name at least 3 of our products which I’ve wished I could do that with: iON, MMC, and Tcat.

There are some challenges though. Bash/BAT file scripts don’t provide facilities to interact with web services. Then, if you go with a cross platform language, you have to write cross platform scripts and provide a way to distribute it.

We thought we’d make this easier, so we wrote Mule Jockey, a tool to turn annotated groovy scripts into a cross platform distribution of shell scripts.

It’s really easy. First, write your command. For example:

Many Mule users create RESTful services but they are not always clear on the way to authenticate and apply authorization to a RESTful Web Service. I have seen questions about this topic so I decided to write a tutorial that covers a common use case. We’re going to use Jersey, Spring Security and LDAP and of course Mule to pull  it all together.  I will show you how to do the following:

  1. Expose REST resource using Jersey
  2. Secure the REST resource using HTTP Basic Authentication
  3. Authenticate and authorize users against an LDAP Directory
  4. Apply authorisation based on users groups to this REST resource