mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-587: Serve static resources within /app/ext/[namespace]/[declared/path/to/resource].
This commit is contained in:
@@ -30,6 +30,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleServerException;
|
||||
@@ -278,6 +279,19 @@ public class ExtensionModule extends ServletModule {
|
||||
for (Class<AuthenticationProvider> authenticationProvider : authenticationProviders)
|
||||
bindAuthenticationProvider(authenticationProvider);
|
||||
|
||||
// Add all static resources under namespace-derived prefix
|
||||
String staticResourcePrefix = "/app/ext/" + extension.getNamespace() + "/";
|
||||
for (Map.Entry<String, Resource> staticResource : extension.getStaticResources().entrySet()) {
|
||||
|
||||
// Get path and resource from path/resource pair
|
||||
String path = staticResource.getKey();
|
||||
Resource resource = staticResource.getValue();
|
||||
|
||||
// Serve within namespace-derived path
|
||||
serve(staticResourcePrefix + path).with(new ResourceServlet(resource));
|
||||
|
||||
}
|
||||
|
||||
// Log successful loading of extension by name
|
||||
logger.info("Extension \"{}\" loaded.", extension.getName());
|
||||
|
||||
|
Reference in New Issue
Block a user