org.appng.forms

## Interface Request

- All Superinterfaces:
    RequestContainer
  All Known Implementing Classes:
    RequestBean

      public interface Request
      extends RequestContainer

  Extends the informations provided by a `RequestContainer` and allows processing a `HttpServletRequest` by calling `process(HttpServletRequest)`.
  Author:
    Matthias Müller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `REQUEST_PARSED` request-attribute to store a parsed `HttpServletRequest` in

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addParameter(String name, String value)` Adds the given parameter to this `Request`, but only if such a parameter not already exists.
    `void` | `addParameters(Map<String,String> parameters)` Adds the given parameters to this `Request`, but only for those parameters not already existsing.
    `void` | `addParameters(String name, List<String> values)` Adds the given parameters to this `Request`, but only if such a parameter not already exists.
    `List<String>` | `getAcceptedTypes(String uploadName)` Returns the accepted file-extensions/content-types for the input field with the given name.
    `String` | `getEncoding()` Return the encoding for this request
    `javax.servlet.http.HttpServletRequest` | `getHttpServletRequest()` Returns the previously processed `HttpServletRequest`
    `boolean` | `isGet()` Returns `true` if this is a HTPP GET request.
    `boolean` | `isMultiPart()` Returns `true` if this is a multipart request.
    `boolean` | `isPost()` Returns `true` if this is a HTPP POST request.
    `boolean` | `isValid()` Checks whether this is a valid `Request`, i.e.
    `void` | `process(javax.servlet.http.HttpServletRequest httpServletRequest)` Processes the given `HttpServletRequest`.
    `void` | `setAcceptedTypes(String uploadName, String... types)` Sets the accepted mime-types or filetype-extensions for the given field
    `void` | `setEncoding(String encoding)` Sets the encoding for this request
    `void` | `setMaxSize(long maxSize)` Sets the maximum size for a `FormUpload` within this `Request`.
    `void` | `setMaxSize(long maxSize, boolean strict)` Sets the maximum size for a `FormUpload` within this `Request`, and additionally defines if violations should be handled strict.
    `void` | `setTempDir(File tempDir)` Sets the (absolute) temporary directory for storing `FormUpload`s.

    - ### Methods inherited from interface org.appng.forms.RequestContainer

      `getFormUploads, getFormUploads, getHost, getParameter, getParameterList, getParameterNames, getParameters, getParametersList, hasParameter`

- - ### Field Detail

    - #### REQUEST_PARSED

          static final String REQUEST_PARSED

      request-attribute to store a parsed `HttpServletRequest` in

  - ### Method Detail

    - #### process

          void process(javax.servlet.http.HttpServletRequest httpServletRequest)

      Processes the given `HttpServletRequest`. Must only be called once per `HttpServletRequest`.
      Parameters:
        `httpServletRequest` - the `HttpServletRequest` to process

    - #### getHttpServletRequest

          javax.servlet.http.HttpServletRequest getHttpServletRequest()

      Returns the previously processed `HttpServletRequest`
      Returns:
        the `HttpServletRequest`

    - #### getEncoding

          String getEncoding()

      Return the encoding for this request
      Returns:
        the encoding

    - #### setEncoding

          void setEncoding(String encoding)

      Sets the encoding for this request
      Parameters:
        `encoding` - the encoding

    - #### isMultiPart

          boolean isMultiPart()

      Returns `true` if this is a multipart request.
      Returns:
        `true` if this is a multipart request, `false` otherwise

    - #### isPost

          boolean isPost()

      Returns `true` if this is a HTPP POST request.
      Returns:
        `true` if this is a HTPP POST request, `false` otherwise

    - #### isGet

          boolean isGet()

      Returns `true` if this is a HTPP GET request.
      Returns:
        `true` if this is a HTPP GET request, `false` otherwise

    - #### isValid

          boolean isValid()

      Checks whether this is a valid `Request`, i.e. no `Exception` occurred during `process(HttpServletRequest)`.
      Returns:
        `true` if this `Request` is valid, `false` otherwise

    - #### setTempDir

          void setTempDir(File tempDir)

      Sets the (absolute) temporary directory for storing `FormUpload`s. Note that, if not set or not existent, the directory specified by the `System` propertey `java.io.tmpdir` is used.
      Parameters:
        `tempDir` - the directory for storing `FormUpload`s

    - #### setMaxSize

          void setMaxSize(long maxSize)

      Sets the maximum size for a `FormUpload` within this `Request`.
      Parameters:
        `maxSize` - the maximum size of a `FormUpload`
      See Also:
        `FormUpload.getMaxSize()`

    - #### setMaxSize

          void setMaxSize(long maxSize,
                          boolean strict)

      Sets the maximum size for a `FormUpload` within this `Request`, and additionally defines if violations should be handled strict.
      Parameters:
        `maxSize` - the maximum size of a `FormUpload`
        `strict` - if set to `true`, and a `FormUpload` exceeds the given size, the whole `Request` will be marked as invalid.
      See Also:
        `isValid()`

    - #### setAcceptedTypes

          void setAcceptedTypes(String uploadName,
                                String... types)

      Sets the accepted mime-types or filetype-extensions for the given field
      Parameters:
        `uploadName` - the name of the input-field (type="file")
        `types` - the accepted mimetypes (e.g. image/jpeg, image/png) or file extensions (e.g jgp,png), those can be used in combination

    - #### getAcceptedTypes

          List<String> getAcceptedTypes(String uploadName)

      Returns the accepted file-extensions/content-types for the input field with the given name.
      Parameters:
        `uploadName` - the name of the input field
      Returns:
        a list of accepted tyes
      See Also:
        `FormUpload.getAcceptedTypes()`

    - #### addParameters

          void addParameters(Map<String,String> parameters)

      Adds the given parameters to this `Request`, but only for those parameters not already existsing. This prevents overwriting a parameter which is already present in the original `HttpServletRequest`. The given `Map` uses the parameter name as the key and the parameter value as the value.
      Parameters:
        `parameters` - the parameters to add
      See Also:
        `addParameter(String, String)`, `RequestContainer.getParameter(String)`

    - #### addParameter

          void addParameter(String name,
                            String value)

      Adds the given parameter to this `Request`, but only if such a parameter not already exists. This prevents overwriting a parameter which is already present in the original `HttpServletRequest`.
      Parameters:
        `name` - the parameter name
        `value` - the parameter value

    - #### addParameters

          void addParameters(String name,
                             List<String> values)

      Adds the given parameters to this `Request`, but only if such a parameter not already exists. This prevents overwriting a parameter which is already present in the original `HttpServletRequest`.
      Parameters:
        `name` - the parameter name
        `values` - the parameter values

Copyright © 2011–2023 aiticon GmbH. All rights reserved.