Returns the path component of the URI as an array of strings, split on the forward slash Similar to the #getQueryPath call, this returns only the path without the protocol, host, port or query string params. E.g. "/path/starts/here" will return an array of {"path", "starts", "here"} Note
()
| 293 | * @throws NullPointerException if the URI is null |
| 294 | */ |
| 295 | public String[] explodePath() { |
| 296 | final String path = getQueryPath(); |
| 297 | if (path.isEmpty()) { |
| 298 | throw new BadRequestException("Query path is empty"); |
| 299 | } |
| 300 | if (path.charAt(0) != '/') { |
| 301 | throw new BadRequestException("Query path doesn't start with a slash"); |
| 302 | } |
| 303 | // split may be a tad slower than other methods, but since the URIs are |
| 304 | // usually pretty short and not every request will make this call, we |
| 305 | // probably don't need any premature optimization |
| 306 | return path.substring(1).split("/"); |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * Parses the query string to determine the base route for handing a query |
no test coverage detected