Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2015-02-04 00:16:42 +0000
committerRoberto E. Escobar2015-02-04 00:22:40 +0000
commit9d5f1e4df00f89ab175f20229b978f050215150e (patch)
tree1fd1a97a0f8682cee0b31733e4033a6614ab023d /plugins/org.eclipse.osee.jaxrs.server
parent789697c37537421c60cf158949301a63f19cb811 (diff)
downloadorg.eclipse.osee-9d5f1e4df00f89ab175f20229b978f050215150e.tar.gz
org.eclipse.osee-9d5f1e4df00f89ab175f20229b978f050215150e.tar.xz
org.eclipse.osee-9d5f1e4df00f89ab175f20229b978f050215150e.zip
bug: Fix JaxRsStaticResource file extension resolution
Diffstat (limited to 'plugins/org.eclipse.osee.jaxrs.server')
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/JaxRsStaticResourceRequestFilter.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/JaxRsStaticResourceRequestFilter.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/JaxRsStaticResourceRequestFilter.java
index f0c77c3ff39..ff2c743571f 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/JaxRsStaticResourceRequestFilter.java
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/JaxRsStaticResourceRequestFilter.java
@@ -107,13 +107,23 @@ public class JaxRsStaticResourceRequestFilter implements ContainerRequestFilter
}
private boolean hasExtension(String path) {
- String extension = Lib.getExtension(path);
+ String extension = null;
+ if (Strings.isValid(path)) {
+ int index = path.lastIndexOf("/");
+ String toProcess = path;
+ if (index > 0 && index + 1 < path.length()) {
+ toProcess = path.substring(index + 1);
+ }
+ extension = Lib.getExtension(toProcess);
+ }
return Strings.isValid(extension);
}
private String addExtension(String path, MediaType mediaType) {
String extension = mediaType.getSubtype();
- if (extension.contains("+")) {
+ if ("plain".equals(extension)) {
+ extension = "txt";
+ } else if (extension.contains("+")) {
int index = extension.lastIndexOf("+");
if (index > 0 && index + 1 < extension.length()) {
extension = extension.substring(index + 1);

Back to the top