callback
callback

Reputation: 4122

Tomcat does not read link as parameter

I am using Jersey/java to create a web service that runs on tomca7. When I pass a URL as a parameter in the @PathParam it does not display anything, but when it is a regular string it works fine. Here is a modified demo of what I am doing..

For example if I put:

localhost/app/.../broaders/test

it will display: test

But if i put:

localhost/app/.../broaders/http%3A%2F%2Ftematres.befdata.biow.uni-leipzig.de%2Fvocab%2F%3Ftema%3D254

or even just

localhost/app/..../broaders/http%3A2F2F

it does not display anything.

@GET
@Path("broaders/{k}")
@produces(MediaType.APPLICATION_JSON)
@public String getBroader(@PathParam("k") String k){
    return k;
 }

I added the -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true to Catalina.proprieties but without luck.

Upvotes: 0

Views: 191

Answers (2)

JavierV
JavierV

Reputation: 396

Maybe you should pass the url as a parameter. Now, with the allow_encoded_slash you are generating urls that aren't broaders/XXXX but broaders/XXX/YYY/ZZZ so they don't match your regexp.

Upvotes: 1

user1907906
user1907906

Reputation:

A @PathParam does not include / by default.

Try a regular expression for the @PathParam.

@Path("broaders/{k:.+}")

Upvotes: 0

Related Questions