public Response getStaticResource()

in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/admin/AdminBean.java [126:151]


	public Response getStaticResource(String file) throws IOException {
		if (file.matches("^[-_.a-zA-Z0-9]+$")) {
			String type = "application/octet-stream";
			if (file.endsWith(".html"))
				type = "text/html";
			else if (file.endsWith(".js"))
				type = "text/javascript";
			else if (file.endsWith(".jpg"))
				type = "image/jpeg";
			else if (file.endsWith(".gif"))
				type = "image/gif";
			else if (file.endsWith(".png"))
				type = "image/png";
			else if (file.endsWith(".svg"))
				type = "image/svg+xml";
			else if (file.endsWith(".css"))
				type = "text/css";
			try {
				return Response.ok(getResource(resourceRoot + file), type)
						.build();
			} catch (IOException e) {
				// ignore; we just treat as 404
			}
		}
		return Response.status(NOT_FOUND).entity("no such resource").build();
	}