eclipse-ee4j / eclipse-ee4j/jersey

Path containing spaces must be encoded in the WADL

Open
#2,556 3 comments 0 reactions 0 assignees View on GitHub
Component: core Priority: Minor Type: Bug wadl
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

If you have a REST resource with a @Path annotation containing spaces e.g., @Path("Say Hello"), the WADL does not encode the spaces.
Quoting from the JAXRS 2.0 spec,

The value of the annotation is automatically encoded, e.g. the following two lines are equivalent:
1 @Path("widget list/{id}")
2 @Path("widget%20list/{id}")

The WADL should show the encoded value or handle encoding. Currently, if we pick the space-included URL from the WADL and feed it into SOAPUI or other REST testing tools, we get 404 Not Found Error.
If user manually adds the encoding character like Say%20Hello, it works.

Example service:

```
@Path("project1")
public class GenericResource {
public GenericResource() {
}

@GET
@Produces("text/plain")
@Path("Say Hello")
public String getData() {
return "Hello";
}
}
```

Snippet of WADL for above service:

```








:
:
```
#### Environment
Windows 7
#### Affected Versions
[2.4.1]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.