mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Add getQueryParameters() function.
This commit is contained in:
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.nio.charset.UnsupportedCharsetException;
|
import java.nio.charset.UnsupportedCharsetException;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -132,15 +133,15 @@ public class Credentials implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the contents of the given parameter, if present. Unlike
|
* Returns a map of all query parameters in the request, if any. Unlike
|
||||||
* getParameter() of HttpServletRequest, this function is safe to call
|
* getParameter() of HttpServletRequest, this function is safe to call
|
||||||
* when POST data is still required (such as during tunnel requests or
|
* when POST data is still required (such as during tunnel requests or
|
||||||
* when the UserContext is being updated).
|
* when the UserContext is being updated).
|
||||||
*
|
*
|
||||||
* @param parameter The name of the parameter to read.
|
* @return An unmodifiable map of all query parameters in the request,
|
||||||
* @return The value of the parameter, or null if no such parameter exists.
|
* where each key corresponds to a given parameter name.
|
||||||
*/
|
*/
|
||||||
public String getQueryParameter(String parameter) {
|
public Map<String, String> getQueryParameters() {
|
||||||
|
|
||||||
// Parse parameters, if not yet parsed
|
// Parse parameters, if not yet parsed
|
||||||
if (queryParameters == null) {
|
if (queryParameters == null) {
|
||||||
@@ -197,9 +198,22 @@ public class Credentials implements Serializable {
|
|||||||
|
|
||||||
} // end if parameters cached
|
} // end if parameters cached
|
||||||
|
|
||||||
// Return parsed parameter, if any
|
// Return unmodifiable map of all parameters
|
||||||
return queryParameters.get(parameter);
|
return Collections.unmodifiableMap(queryParameters);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the contents of the given parameter, if present. Unlike
|
||||||
|
* getParameter() of HttpServletRequest, this function is safe to call
|
||||||
|
* when POST data is still required (such as during tunnel requests or
|
||||||
|
* when the UserContext is being updated).
|
||||||
|
*
|
||||||
|
* @param parameter The name of the parameter to read.
|
||||||
|
* @return The value of the parameter, or null if no such parameter exists.
|
||||||
|
*/
|
||||||
|
public String getQueryParameter(String parameter) {
|
||||||
|
return getQueryParameters().get(parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user