From 76c9c42b17e4774003a545df56342beac2201a7e Mon Sep 17 00:00:00 2001 From: Edmundo LOPEZ BOBEDA Date: Sat, 4 Jun 2016 18:29:14 -0400 Subject: [PATCH] Make work with JAX-RS Made some modifications to support JAX-RS web services. In particular, a route only needs to match the beginning of an endpoint address to work. This allows to pass parameters in the path to the JAX-RS webservices. Also now we send the URI in the message to the webservice. --- .../app/org/apache/cxf/transport/play/CxfController.scala | 1 + .../org/apache/cxf/transport/play/PlayTransportFactory.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/project-code/app/org/apache/cxf/transport/play/CxfController.scala b/project-code/app/org/apache/cxf/transport/play/CxfController.scala index 3d28342..db0f5cd 100644 --- a/project-code/app/org/apache/cxf/transport/play/CxfController.scala +++ b/project-code/app/org/apache/cxf/transport/play/CxfController.scala @@ -34,6 +34,7 @@ class CxfController extends Controller { val msg: Message = new MessageImpl msg.put(Message.HTTP_REQUEST_METHOD, request.method) msg.put(Message.REQUEST_URL, request.path) + msg.put(Message.REQUEST_URI, request.uri) msg.put(Message.QUERY_STRING, request.rawQueryString) msg.put(Message.PROTOCOL_HEADERS, headersAsJava) msg.put(Message.CONTENT_TYPE, request.headers.get(Message.CONTENT_TYPE) getOrElse null) diff --git a/project-code/app/org/apache/cxf/transport/play/PlayTransportFactory.java b/project-code/app/org/apache/cxf/transport/play/PlayTransportFactory.java index 65fd67e..eeac041 100644 --- a/project-code/app/org/apache/cxf/transport/play/PlayTransportFactory.java +++ b/project-code/app/org/apache/cxf/transport/play/PlayTransportFactory.java @@ -81,6 +81,11 @@ protected PlayDestination getDestination(EndpointInfo ei, EndpointReferenceType } public PlayDestination getDestination(String endpointAddress) { + for (java.util.Map.Entry e: destinations.entrySet()) { + if (endpointAddress.startsWith(e.getKey())) { + return e.getValue(); + } + } return destinations.get(endpointAddress); }