Java Code Examples for com.google.gwt.http.client.URL#decodeQueryString()

The following examples show how to use com.google.gwt.http.client.URL#decodeQueryString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewTokenFormatter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public List<PlaceRequest> toPlaceRequestHierarchy(String historyToken) throws TokenFormatException {
	historyToken = URL.decodeQueryString(historyToken);

	int split = historyToken.indexOf(hierarchySeparator);
	if (split == 0) {
		throw new TokenFormatException("Place history token is missing.");
	} else {
		List<PlaceRequest> result = new ArrayList<PlaceRequest>();
		if (split == -1) {
			result.add(unescapedToPlaceRequest(historyToken)); // History token consists of a single place token
		} else {
			String[] placeTokens = historyToken.split(hierarchySeparator);
			for (String placeToken : placeTokens) {
				if (placeToken.isEmpty()) {
					throw new TokenFormatException("Bad parameter: Successive place tokens require a single '" + hierarchySeparator + "' between them.");
				}
				result.add(unescapedToPlaceRequest(placeToken));
			}
		}
		return result;
	}
}
 
Example 2
Source File: GWTFileUploadResponse.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * GWTFileUploadResponse
 *
 * @param text json encoded parameters.
 */
public GWTFileUploadResponse(String text) {
	text = text.substring(text.indexOf("{"));
	text = text.substring(0, text.lastIndexOf("}") + 1);
	JSONValue responseValue = JSONParser.parseStrict(text);
	JSONObject response = responseValue.isObject();

	// Deserialize information
	hasAutomation = response.get("hasAutomation").isBoolean().booleanValue();
	path = URL.decodeQueryString(response.get("path").isString().stringValue());
	error = response.get("error").isString().stringValue();
	showWizardCategories = response.get("showWizardCategories").isBoolean().booleanValue();
	showWizardKeywords = response.get("showWizardKeywords").isBoolean().booleanValue();
	digitalSignature = response.get("digitalSignature").isBoolean().booleanValue();

	// Getting property groups
	JSONArray groupsArray = response.get("groupsList").isArray();

	if (groupsArray != null) {
		for (int i = 0; i <= groupsArray.size() - 1; i++) {
			groupsList.add(groupsArray.get(i).isString().stringValue());
		}
	}

	// Getting workflows
	JSONArray workflowArray = response.get("workflowList").isArray();

	if (workflowArray != null) {
		for (int i = 0; i <= workflowArray.size() - 1; i++) {
			workflowList.add(workflowArray.get(i).isString().stringValue());
		}
	}
}
 
Example 3
Source File: NewTokenFormatter.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private String paramValueUnescape(String value) {
	value = URL.decodeQueryString(value);
	
	StringBuffer sbuf = new StringBuffer();
	int len = value.length();

	char escapeChar = escapeCharacter.charAt(0);

	char hierarchyNum = ESCAPED_HIERARCHY_SEPARATOR.charAt(1);
	char paramNum = ESCAPED_PARAM_SEPARATOR.charAt(1);
	char valueNum = ESCAPED_VALUE_SEPARATOR.charAt(1);
	char escapeNum = ESCAPED_ESCAPE_CHAR.charAt(1);

	for (int i = 0; i < len; i++) {
		char ch = value.charAt(i);

		if (ch == escapeChar) {
			i++;
			char ch2 = value.charAt(i);
			if (ch2 == hierarchyNum) {
				sbuf.append(hierarchySeparator);
			} else if (ch2 == paramNum) {
				sbuf.append(paramSeparator);
			} else if (ch2 == valueNum) {
				sbuf.append(valueSeparator);
			} else if (ch2 == escapeNum) {
				sbuf.append('\\');
			}
		} else {
			sbuf.append(ch);
		}
	} 	

	return sbuf.toString();
}
 
Example 4
Source File: UrlCodecImpl.java    From requestor with Apache License 2.0 4 votes vote down vote up
@Override
public String decodeQueryString(String encodedURLComponent) {
    return URL.decodeQueryString(encodedURLComponent);
}