To find out if a uri matches a url pattern in jsp config. If so, then the uri is a JSP page. This is used primarily for jspc. @param uri The path to check @return true if the path denotes a JSP page
(String uri)
| 365 | * @return <code>true</code> if the path denotes a JSP page |
| 366 | */ |
| 367 | public boolean isJspPage(String uri) { |
| 368 | |
| 369 | init(); |
| 370 | if (jspProperties == null) { |
| 371 | return false; |
| 372 | } |
| 373 | |
| 374 | String uriPath = null; |
| 375 | int index = uri.lastIndexOf('/'); |
| 376 | if (index >= 0) { |
| 377 | uriPath = uri.substring(0, index + 1); |
| 378 | } |
| 379 | String uriExtension = null; |
| 380 | index = uri.lastIndexOf('.'); |
| 381 | if (index >= 0) { |
| 382 | uriExtension = uri.substring(index + 1); |
| 383 | } |
| 384 | |
| 385 | for (JspPropertyGroup jpg : jspProperties) { |
| 386 | |
| 387 | String extension = jpg.getExtension(); |
| 388 | String path = jpg.getPath(); |
| 389 | |
| 390 | if (extension == null) { |
| 391 | if (uri.equals(path)) { |
| 392 | // There is an exact match |
| 393 | return true; |
| 394 | } |
| 395 | } else { |
| 396 | if ((path == null || path.equals(uriPath)) && |
| 397 | (extension.equals("*") || extension.equals(uriExtension))) { |
| 398 | // Matches *, *.ext, /p/*, or /p/*.ext |
| 399 | return true; |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | return false; |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * Represents a JSP property group with a path, extension, and associated JSP property. |
no test coverage detected