001/* 002 * Copyright 2022-2025 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.soklet; 018 019import java.nio.charset.Charset; 020 021/** 022 * Strategies for encoding/decoding query strings: {@code Content-Type: application/x-www-form-urlencoded} (supports {@code "+"} for spaces) or "strict" RFC 3986 (percent-decoding only). 023 * 024 * @author <a href="https://www.revetkn.com">Mark Allen</a> 025 * @see com.soklet.Utilities#extractQueryParametersFromQuery(String, QueryFormat) 026 * @see com.soklet.Utilities#extractQueryParametersFromQuery(String, QueryFormat, Charset) 027 * @see com.soklet.Utilities#extractQueryParametersFromUrl(String, QueryFormat) 028 * @see com.soklet.Utilities#extractQueryParametersFromUrl(String, QueryFormat, Charset) 029 */ 030public enum QueryFormat { 031 /** 032 * Follow RFC 1866 (the {@code application/x-www-form-urlencoded} content type), where keys and values are percent-encoded but prefer {@code "+"} for spaces. 033 * <p> 034 * Note that {@code "%20"} values are still decoded as spaces, but any {@code "+"} values are decoded as spaces first. 035 */ 036 X_WWW_FORM_URLENCODED, 037 /** 038 * Follow RFC 3986, where keys and values are percent-encoded and {@code "+"} values are never decoded as spaces. 039 */ 040 RFC_3986_STRICT 041}