Github user necouchman commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/194#discussion_r143099381
  
    --- Diff: 
guacamole/src/main/java/org/apache/guacamole/rest/connection/ConnectionResource.java
 ---
    @@ -193,4 +207,52 @@ public ConnectionResource(@Assisted UserContext 
userContext,
     
         }
     
    +    /**
    +     * Returns a resource which provides a read-only copy of the prompts 
for
    +     * a particular connection, which need to be filled in by the user 
before
    +     * the connection can be completed.
    +     *
    +     * @return
    +     *     A read-only resource with the prompts that the user needs to 
fill
    +     *     in before a connection can be completed.
    +     *
    +     * @throws GuacamoleException
    +     *     If the prompt entries associated with this connection cannot be
    +     *     retrieved.
    +     */
    +    @GET
    +    @Path("prompts")
    +    public List<PromptEntry> getPrompts() throws GuacamoleException {
    +
    +        List<PromptEntry> promptEntries = new ArrayList<PromptEntry>();
    +
    +        // Get the connection configuration parameters and then filter for 
prompts.
    +        Map <?, String> parameters = 
connection.getConfiguration().getParameters();
    +        Map <String, List<String>> prompts = 
TokenFilter.getPrompts(parameters);
    +
    +        // Get protocol information for the configured protocol.
    +        Collection<Form> myForms = 
environment.getProtocol(connection.getConfiguration().getProtocol()).getConnectionForms();
    +
    +        // Loop through each prompt and find the matching Field object for 
the
    +        // parameter.
    +        for (Map.Entry<String, List<String>> entry : prompts.entrySet()) {
    --- End diff --
    
    This is a lot of code for a rest endpoint, not sure this shouldn't be 
reorganized and put somewhere else??


---

Reply via email to