# Class Parameters

java.lang.Object
org.apache.tomcat.util.http.Parameters

public final class Parameters extends Object
Utility class for parsing and managing HTTP parameters.

## Constructor Summary

Constructors
Constructor
Description
`Parameters()`
Construct a new `Parameters` instance with default settings.

## Method Summary

Modifier and Type
Method
Description
`void`
`addParameter(String key, String value)`
Add a parameter with the given key and value.
`Charset`
`getCharset()`
Returns the character set used for decoding body parameters.
`String`
`getParameter(String name)`
Returns the first value of the parameter with the given name.
`Enumeration<String>`
`getParameterNames()`
Returns the names of all parameters.
`String[]`
`getParameterValues(String name)`
Returns the values of the parameter with the given name.
`void`
`handleQueryParameters()`
Process the query string into parameters
`void`
`processParameters(byte[] bytes, int start, int len)`
Process the given byte array as a set of URL-encoded parameters using the current character set.
`void`
`processParameters(MessageBytes data, Charset charset)`
Process the given MessageBytes as a set of URL-encoded parameters using the specified character set.
`void`
`recycle()`
Reset this object so it can be reused for a new request.
`void`
`setCharset(Charset charset)`
Set the character set used for decoding body parameters.
`void`
`setLimit(int limit)`
Set the maximum number of parameters allowed.
`void`
`setQuery(MessageBytes queryMB)`
Set the query string to be parsed into parameters.
`void`
`setQueryStringCharset(Charset queryStringCharset)`
Set the character set used for decoding query string parameters.
`void`
`setURLDecoder(UDecoder u)`
Set the URL decoder to use for decoding parameter names and values.
`int`
`size()`
Returns the number of parameters that have been parsed.
`String`
`toString()`
Debug purpose

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### Parameters

public Parameters()
Construct a new `Parameters` instance with default settings.

## Method Details

### setQuery

public void setQuery(MessageBytes queryMB)
Set the query string to be parsed into parameters.

Parameters:
  `queryMB` - The query string as a MessageBytes object

### setLimit

public void setLimit(int limit)
Set the maximum number of parameters allowed.

Parameters:
  `limit` - The maximum number of parameters, or -1 for no limit

### getCharset

public Charset getCharset()
Returns the character set used for decoding body parameters.

Returns:
  the character set

### setCharset

public void setCharset(Charset charset)
Set the character set used for decoding body parameters.

Parameters:
  `charset` - The character set, or null to use the default (ISO-8859-1)

### setQueryStringCharset

public void setQueryStringCharset(Charset queryStringCharset)
Set the character set used for decoding query string parameters.

Parameters:
  `queryStringCharset` - The character set, or null to use the default (UTF-8)

### size

public int size()
Returns the number of parameters that have been parsed.

Returns:
  the number of parameters

### recycle

public void recycle()
Reset this object so it can be reused for a new request.

### getParameterValues

public String[] getParameterValues(String name)
Returns the values of the parameter with the given name.

Parameters:
  `name` - The name of the parameter
Returns:
  The values of the parameter, or null if the parameter does not exist

### getParameterNames

public Enumeration<String> getParameterNames()
Returns the names of all parameters.

Returns:
  An enumeration of parameter names

### getParameter

public String getParameter(String name)
Returns the first value of the parameter with the given name.

Parameters:
  `name` - The name of the parameter
Returns:
  The first value of the parameter, or null if the parameter does not exist

### handleQueryParameters

public void handleQueryParameters()
Process the query string into parameters

### addParameter

public void addParameter(String key, String value) throws IllegalStateException
Add a parameter with the given key and value.

Parameters:
  `key` - The parameter name
  `value` - The parameter value
Throws:
  `IllegalStateException` - If the parameter count limit has been reached

### setURLDecoder

public void setURLDecoder(UDecoder u)
Set the URL decoder to use for decoding parameter names and values.

Parameters:
  `u` - The URL decoder

### processParameters

public void processParameters(byte[] bytes, int start, int len)
Process the given byte array as a set of URL-encoded parameters using the current character set.

Parameters:
  `bytes` - The byte array containing the parameters
  `start` - The start index in the byte array
  `len` - The length of the parameter data in the byte array

### processParameters

public void processParameters(MessageBytes data, Charset charset)
Process the given MessageBytes as a set of URL-encoded parameters using the specified character set.

Parameters:
  `data` - The MessageBytes containing the parameters
  `charset` - The character set to use for decoding

### toString

public String toString()
Debug purpose

Overrides:
  `toString` in class `Object`