Package org.apache.sling.api.request
Interface RequestParameter
- All Known Implementing Classes:
- ContainerRequestParameter,- MultipartRequestParameter
@ProviderType
public interface RequestParameter
The 
RequestParameter class represents a single parameter sent
 with the client request. Instances of this class are returned by the
 SlingHttpServletRequest.getRequestParameter(String),
 SlingHttpServletRequest.getRequestParameters(String) and
 SlingHttpServletRequest.getRequestParameterMap() method.- 
Method SummaryModifier and TypeMethodDescriptionbyte[]get()Returns the contents of the parameter as an array of bytes.@Nullable StringReturns the content type passed by the browser ornullif not defined.@Nullable StringReturns the original filename in the client's filesystem, as provided by the browser (or other client software).@Nullable InputStreamReturns an InputStream that can be used to retrieve the contents of the file.@NotNull StringgetName()longgetSize()Returns the size in bytes of the parameter.@NotNull StringReturns the contents of the parameter as a String, using the default character encoding.@NotNull StringReturns the contents of the parameter as a String, using the specified encoding.booleanDetermines whether or not this instance represents a simple form field or an uploaded file.
- 
Method Details- 
getName- Returns:
- the name of this RequestParameter
- Since:
- 2.4 (Sling API Bundle 2.6)
 
- 
isFormFieldboolean isFormField()Determines whether or not this instance represents a simple form field or an uploaded file.- Returns:
- trueif the instance represents a simple form field;- falseif it represents an uploaded file.
 
- 
getContentTypeReturns the content type passed by the browser ornullif not defined.- Returns:
- The content type passed by the browser or nullif not defined.
 
- 
getSizelong getSize()Returns the size in bytes of the parameter.- Returns:
- The size in bytes of the parameter.
 
- 
getbyte[] get()Returns the contents of the parameter as an array of bytes.- Returns:
- The contents of the parameter as an array of bytes.
 
- 
getInputStreamReturns an InputStream that can be used to retrieve the contents of the file.Each call to this method returns a new InputStreamto the request parameter data. Make sure to close the stream to prevent leaking resources.- Returns:
- An InputStream that can be used to retrieve the contents of the file.
- Throws:
- IOException- if an error occurs.
 
- 
getFileNameReturns the original filename in the client's filesystem, as provided by the browser (or other client software). In most cases, this will be the base file name, without path information. However, some clients, such as the Opera browser, do include path information.- Returns:
- The original filename in the client's filesystem.
 
- 
getStringReturns the contents of the parameter as a String, using the default character encoding. This method usesget()to retrieve the contents of the item.- Returns:
- The contents of the parameter, as a string.
 
- 
getString@NotNull @NotNull String getString(@NotNull @NotNull String encoding) throws UnsupportedEncodingException Returns the contents of the parameter as a String, using the specified encoding. This method uses linkget()to retrieve the contents of the item.- Parameters:
- encoding- The character encoding to use.
- Returns:
- The contents of the parameter, as a string.
- Throws:
- UnsupportedEncodingException- if the requested character encoding is not available.
 
 
-