background preloader

REST

Facebook Twitter

CORS

CXF. REST Tip: Deep etags give you more benefits. ETags, or entity-tags, are an important part of HTTP, being a critical part of caching, and also used in "conditional" requests.

REST Tip: Deep etags give you more benefits.

So what is an etag? Entity tag The ETag response-header field value, an entity tag, provides for an "opaque" cache validator. That's not very helpful, is it? The easiest way to think of an etag is as an MD5 or SHA1 hash of all the bytes in a representation. FasterXML/jackson-core. HATEOAS 101: An Opinionated Introduction. REST Tip: Deep etags give you more benefits.

Client Side Caching

How to GET a Cup of Coffee. HATEOAS by Example « Zienit. Hypermedia as the Engine of Application State (HATEOAS) is a very useful concept in the RESTful architectural style.

HATEOAS by Example « Zienit

The best way to show the benefits of HATEOAS is by giving an example. In this post I’ll be using the Jersey JAX-RS framework to build three RESTFul services. By mixing XForms into the equation, these services form a complete (yet tiny) web application. The example can be deployed on GlassFish. The RESTFul resources and their representations There are three resources that make up my example. The first resource is a list of customers and will be represented as pure XML data.

In this example, there is a link to the next chunk of customers (at lines 23-25), but there is no link to the previous chunk, because there is none. The second resource is a single customer. The third resource is a XHTML+XForms form through which a list of customers can be edited (for simplicities sake, “editing” here means browsing forwards and backwards through the list.

JAXB classes Test data. Hateoas — Scott Banwart's Blog. Presentation: From REST to HATEOAS. This week in REST. What is statelessness in REST ? - In my post Fomenting unREST : Is RESTfulness a semantics game ?

What is statelessness in REST ? -

Why does REST require statelessness ? , I had commented on some of my thoughts on dealing with some of the constraints prescribed by REST one of them being statelessness. Some of those thoughts continued to churn in my mind, and I had a few helpful interactions along the way which led me to what I believe to be the "Aha moment" on statelessness in REST. That doesn't mean I'm necessarily right, feel free to comment on my thoughts in case you believe any differently or have a nuanced opinion.

Background Per section 3.4.3 of Roy Fielding's dissertation The client-stateless-server style derives from client-server with the additional constraint that no session state is allowed on the server component. The same thought is further commented upon in section 5.1.3. The potential confusion areas Given the clear prohibition of storing client state on server, there are some typical idioms which do get challenged as REST unfriendly. eg. Java - RESTful Authentication via Spring. OAuth Explained and What It Is Good For. Twitter recently announced OAuth support and that eventually they will be deprecating HTTP Basic Authentication in favor of OAuth.

OAuth Explained and What It Is Good For

Knowing this, I figured it was about time to get familiar with OAuth and update the Twitter gem to use it. Let me start by explaining my history with OAuth. I have none. There that was fast. I didn’t read the specifications or any articles on OAuth. For the code examples below, I’ll be using the OAuth gem. Sudo gem install oauth Tokens and Secrets At first, the hardest thing to figure out was all the tokens and secrets. The consumer token and secret are provided for you by the OAuth provider, when you register an application with them. Consumer = OAuth::Consumer.new( 'consumer token', 'consumer secret', {:site => ' ) Before I go on, let me explain the end goal.

Request Token In order to get the access token, you have to create a request token, keep track of it, and then redirect the user to the provider to authorize your application. Basic and Digest authentication for a RESTful Service with Spring Security 3.1. Last Update: 14.04.2013 (3rd update) Table of Contents 1.

Basic and Digest authentication for a RESTful Service with Spring Security 3.1

Overview. Blog Archive » Testing RESTful Web Services made easy using the REST-assured Framework. There are many frameworks out there to facilitate testing RESTful webservices but there is one framework I’d like to acquaint you with 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.

Prerequisites We’re going to need a JDK and Maven .. nothing more … The REST Service to be tested I have added a demo web application that exposes a RESTful service (Jersey used here) and allows us to run our tests against it. Check out the tutorial sources (see chapter “ Tutorial Sources Download “) and run Or simply download the following war file from my Bitbucket repository and deploy it to a valid web container like Tomcat, Jetty etc..

Examples.