001package com.esri.arcgis.enterprise.interceptor;
002
003import jakarta.servlet.ServletException;
004import jakarta.servlet.ServletInputStream;
005import jakarta.servlet.http.Part;
006
007import java.io.BufferedReader;
008import java.io.IOException;
009import java.util.Collection;
010import java.util.Enumeration;
011import java.util.Map;
012
013public interface IInterceptorRequest {
014
015    /**
016     * Returns the value of the specified request header as a String
017     *
018     * @param name - a String specifying the header name
019     * @return a String containing the value of the requested header, or null if the request does not have a header of that name
020     */
021    String getHeader(String name);
022
023    /**
024     * Returns all the values of the specified request header as an Enumeration of String objects.
025     *
026     * @param name - a String specifying the header name
027     * @return an Enumeration containing the values of the requested header. If the request does not have any headers of that name return an empty enumeration
028     */
029    Enumeration<String> getHeaders(String name);
030
031    /**
032     * Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
033     *
034     * @return a String specifying the name of the method with which this request was made
035     */
036    String getMethod();
037
038    /**
039     * Gets all the Part components of this request
040     *
041     * @return Collection of the Part components of this request
042     * @throws IOException      if an I/O error occurred during the retrieval of the Part components of this request
043     * @throws ServletException if this request is not of type multipart/form-data
044     */
045    Collection<Part> getParts() throws IOException, ServletException;
046
047    /**
048     * Gets the Part with the given name.
049     *
050     * @param name - the name of the requested Part
051     * @return The Part with the given name
052     * @throws IOException      if an I/O error occurred during the retrieval of the requested Part
053     * @throws ServletException if this request is not of type multipart/form-data
054     */
055    Part getPart(String name) throws IOException, ServletException;
056
057    /**
058     * Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request
059     *
060     * @return a String containing the part of the URL from the protocol name up to the query string
061     */
062    String getRequestURI();
063
064    /**
065     * Retrieves the body of the request as binary data using a ServletInputStream.
066     *
067     * @return a ServletInputStream object containing the body of the request
068     */
069    ServletInputStream getInputStream() throws IOException;
070
071    /**
072     * Retrieves the body of the request as binary data using a BufferedReader.
073     *
074     * @return a BufferedReader object containing the body of the request
075     */
076    BufferedReader getReader() throws IOException;
077
078    /**
079     * Returns a java.util.Map of the parameters of this request.
080     *
081     * @return an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.
082     */
083    Map<String, String[]> getParameterMap();
084
085    /**
086     * Returns the value of a request parameter as a String, or null if the parameter does not exist
087     *
088     * @param name - a String specifying the name of the parameter
089     * @return a String representing the single value of the parameter
090     */
091    String getParameter(String name);
092
093    /**
094     * Returns an array of String objects containing all the values the given request parameter has, or null if the parameter does not exist.
095     *
096     * @param name - a String containing the name of the parameter whose value is requested
097     * @return an array of String objects containing the parameter's values
098     */
099    String[] getParameterValues(String name);
100
101    /**
102     * Returns an Enumeration of String objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration.
103     *
104     * @return an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters
105     */
106    Enumeration<String> getParameterNames();
107
108    /**
109     * Method to fetch character encoding
110     * @return A String that indicates the character encoding
111     */
112    String getCharacterEncoding();
113
114    /**
115     *  Method to get length of the content in the request
116     * @return An int value of the length of request contents
117     */
118    int getContentLength();
119
120    /**
121     *  Method to get length of the content in the request
122     * @return Long value of the length of request contents
123     */
124    long getContentLengthLong();
125
126    /**
127     *  Method to fetch content-type of the request
128     * @return String that indicates the type of the request contents
129     */
130    String getContentType();
131}