mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +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.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider;
|
import net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider;
|
||||||
import org.glyptodon.guacamole.GuacamoleException;
|
import org.glyptodon.guacamole.GuacamoleException;
|
||||||
import org.glyptodon.guacamole.GuacamoleServerException;
|
import org.glyptodon.guacamole.GuacamoleServerException;
|
||||||
@@ -278,6 +279,19 @@ public class ExtensionModule extends ServletModule {
|
|||||||
for (Class<AuthenticationProvider> authenticationProvider : authenticationProviders)
|
for (Class<AuthenticationProvider> authenticationProvider : authenticationProviders)
|
||||||
bindAuthenticationProvider(authenticationProvider);
|
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
|
// Log successful loading of extension by name
|
||||||
logger.info("Extension \"{}\" loaded.", extension.getName());
|
logger.info("Extension \"{}\" loaded.", extension.getName());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user