The getRawQuery() function is a part of URI class. The function getRawQuery() returns the raw Query of a specified URI.This function returns the exact value of Query without decoding the sequence of escaped octets if any.
Function Signature:
public String getRawQuery()
Syntax:
uri.getRawQuery()
Parameter: This function does not require any parameter
Return Type: The function returns String Type
Below programs illustrates the use of getRawQuery() function:
Example 1: Given a URI we will get the raw Query using the getRawQuery() function.
Output:
URI = https://www.geeksforgeeks.org/java/url-getprotocol-method-in-java-with-examples/
Raw Query=title=protocol
Example 2: Now we will not provide any query and use the function to get the query and see the results.
Output:
URI = https://www.geeksforgeeks.org/java/url-getprotocol-method-in-java-with-examples/
Raw Query=null
Example 3: The value returned by getQuery() and getRawQuery() is same except that all sequences of escaped octets are decoded. The getRawPath() returns the exact value of the string as provided by the user but the getQuery() function decodes the sequence of escaped octets if any.