On Sat, Dec 7, 2019 at 10:12 PM Ben Davis <[email protected]> wrote: > I'm attempting to add a REST endpoint to my extension. As a starting > point, I wanted to see if I could get a simple GET request working, but I'm > running into trouble. > > I copied the quickconnect extension as reference point. My UserContext > class implements the getResource() method: > > @Override >> public Object getResource() throws GuacamoleException { >> return new WorkspaceREST(this.connectionDirectory); >> } > > > The REST class looks like this: > > @Produces(MediaType.APPLICATION_JSON) >> public class WorkspaceREST { >> private final WorkspaceDirectory directory; >> >> public WorkspaceREST(WorkspaceDirectory directory) { >> this.directory = directory; >> } >> >> @GET >> @Path("test") >> public Map<String, String> test() { >> logger.info("REST test"); >> return Collections.singletonMap("success", "true"); >> } >> } > > > My authenticationProvider's identifier is "boldidea-workspaces", so I > tried the following url (after logging in and inspecting my token): > > /guacamole/api/session/ext/boldidea-workspaces/test?token=XXXXX > > I get a 500 response, with the tomcat logs showing the following error: > > com.sun.jersey.api.NotFoundException: null for uri: >> http://localhost:8080/guacamole/api/session/ext/boldidea-workspaces/test/?token=XXXXX > > > It seems like I've run into this before, but cannot remember what the cause was. A couple of suggestions, though: - Make sure that you're running the same Guacamole Client version as the extension. So, if you've checked out the git code and are using that to build the extension, but are installing Guacamole 1.0.0 from the web site, you may run into issues. Or, if your pom.xml for your extension is pulling the 1.0.0 Guacamole dependencies, but you're deploying a later version of Guacamole client built from git, that may cause issues. - Enable debugging in the web application, as described here: http://guacamole.apache.org/doc/gug/configuring-guacamole.html#webapp-logging. Then watch the logs, again, then next time you try to hit that REST endpoint and see what comes up.
-Nick
