Created
April 8, 2012 10:24
-
-
Save JonCook/2336443 to your computer and use it in GitHub Desktop.
HTTP Response Version Provider Implementation Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.ws.rs.core.Response; | |
import org.apache.cxf.jaxrs.ext.ResponseHandler; | |
import org.apache.cxf.jaxrs.model.OperationResourceInfo; | |
import org.apache.cxf.message.Message; | |
public class HttpResponseVersionProvider implements ResponseHandler { | |
public static final String VERSION_HEADER = "X-API-Version"; | |
private String version; | |
public HttpResponseVersionProvider(String version) { | |
this.version = version; | |
} | |
@Override | |
public Response handleResponse(Message message, OperationResourceInfo info, Response response) { | |
return Response.fromResponse(response).header(VERSION_HEADER, version).build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment