@ProviderType
public interface RequestParameter
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.Modifier and Type | Method and Description |
---|---|
byte[] |
get()
Returns the contents of the parameter as an array of bytes.
|
@Nullable java.lang.String |
getContentType()
Returns the content type passed by the browser or
null if
not defined. |
@Nullable java.lang.String |
getFileName()
Returns the original filename in the client's filesystem, as provided by
the browser (or other client software).
|
@Nullable java.io.InputStream |
getInputStream()
Returns an InputStream that can be used to retrieve the contents of the
file.
|
@NotNull java.lang.String |
getName() |
long |
getSize()
Returns the size in bytes of the parameter.
|
@NotNull java.lang.String |
getString()
Returns the contents of the parameter as a String, using the default
character encoding.
|
@NotNull java.lang.String |
getString(@NotNull java.lang.String encoding)
Returns the contents of the parameter as a String, using the specified
encoding.
|
boolean |
isFormField()
Determines whether or not this instance represents a simple form field or
an uploaded file.
|
@NotNull @NotNull java.lang.String getName()
RequestParameter
boolean isFormField()
true
if the instance represents a simple form
field; false
if it represents an uploaded file.@Nullable @Nullable java.lang.String getContentType()
null
if
not defined.null
if
not defined.long getSize()
byte[] get()
@Nullable @Nullable java.io.InputStream getInputStream() throws java.io.IOException
Each call to this method returns a new InputStream
to the
request parameter data. Make sure to close the stream to prevent
leaking resources.
java.io.IOException
- if an error occurs.@Nullable @Nullable java.lang.String getFileName()
@NotNull @NotNull java.lang.String getString()
get()
to retrieve the
contents of the item.@NotNull @NotNull java.lang.String getString(@NotNull @NotNull java.lang.String encoding) throws java.io.UnsupportedEncodingException
get()
to retrieve the contents
of the item.encoding
- The character encoding to use.java.io.UnsupportedEncodingException
- if the requested character encoding
is not available.Copyright © 2018 The Apache Software Foundation. All rights reserved.