Srikanth
Srikanth

Reputation: 31

URL Rewriting in Apache CXF JAX/RS call

How to make a jax/rs call with path params having slashes embedded in it?

@DELETE
@Path("/extended/universal/{CID}")
@Produces( { XML, JSON })
public Response deleteCID( @PathParam("CID") String cId ) throws Exception
{
}

Here, {CID} contains a string sometimes as - urn:cid:URI:http://example.com:80001/index.html

I am running out of ideas, Intercepting and redirecting to an altered URL is not an option. Please do let me know if Apache CXF provides any guidelines for such an issue.

Thanks, Srikanth

Upvotes: 3

Views: 1162

Answers (1)

Donal Fellows
Donal Fellows

Reputation: 137787

By default, the path components don't capture slashes. You can override this by explicitly providing a regular expression that says what a fragment should match. In your case, use a path like this:

@Path("/extended/universal/{CID:.+}")

That's assuming you don't want to match an empty CID. If you do, change the + to a *.

Upvotes: 1

Related Questions