Class ServletCall

java.lang.Object
org.bonitasoft.engine.api.internal.servlet.ServletCall
Direct Known Subclasses:
HttpAPIServletCall

public abstract class ServletCall extends Object
Author:
Severin Moussel
  • Field Details

    • parameters

      protected Map<String,String> parameters
      The parameters of the URL.
      Result of the parsing of the query string : "?a=b&c=d&..."
  • Constructor Details

    • ServletCall

      protected ServletCall(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws org.apache.commons.fileupload.FileUploadException, IOException
      Default constructor.
      Parameters:
      request - The request made to access this servletCall.
      response - The response to return.
      Throws:
      IOException
      org.apache.commons.fileupload.FileUploadException
  • Method Details

    • getBinaryParameters

      public List<byte[]> getBinaryParameters()
      Returns:
      the binaryParameters
    • serialize

      public byte[] serialize(Object obj) throws IOException
      Throws:
      IOException
    • deserialize

      public Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
      Throws:
      IOException
      ClassNotFoundException
    • getHttpSession

      public javax.servlet.http.HttpSession getHttpSession()
      Get the current call's HttpSession
      Returns:
      This method returns the session from the current call.
    • getQueryString

      public String getQueryString()
      See Also:
      • HttpServletRequest.getQueryString()
    • getRequestURL

      public final String getRequestURL()
      Reconstruct the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
      Returns:
      This method returns the reconstructed URL
    • getInputStream

      public final String getInputStream()
      Read the input stream and set it in a String
    • countParameters

      public final int countParameters()
      Count the number of parameters passed in the URL
      Returns:
      This method returns the number of parameters in the URL
    • getParameterAsList

      public final List<String> getParameterAsList(String name)
      Get a parameter values by its name
      Parameters:
      name - The name of the parameter (case sensitive)
      Returns:
      This method returns the values of a parameter as a list of String or null if the parameter isn't defined
    • getParameterAsList

      public final List<String> getParameterAsList(String name, String defaultValue)
      Get a parameter values by its name
      Parameters:
      name - The name of the parameter (case sensitive)
      defaultValue - The value to return if the parameter isn't define
      Returns:
      This method returns the values of a parameter as a list of String
    • getParameter

      public final String getParameter(String name)
      Get a parameter first value by its name
      Parameters:
      name - The name of the parameter (case sensitive)
      Returns:
      This method returns the first value of a parameter as a String or null if the parameter isn't define
    • getParameter

      public final String getParameter(String name, String defaultValue)
      Get a parameter first value by its name
      Parameters:
      name - The name of the parameter (case sensitive)
      defaultValue - The value to return if the parameter isn't define
      Returns:
      This method returns the first value of a parameter as a String
    • head

      protected final void head(String name, String value)
      Write into the output header.
      Parameters:
      name - The name of the header to write.
      value - The value of the header to write.
    • output

      protected final void output(File file)
      Output a file
      Parameters:
      file - The file to output
    • output

      protected void output(InputStream stream, String filename)
      Output a stream as a file
      Parameters:
      stream - The stream to output
      filename - The name of the file to retrieve with the stream.
    • output

      protected void output(InputStream stream)
      Output a stream as a file
      Parameters:
      stream - The stream to output
    • error

      protected void error(String message, int errorCode)
    • output

      protected final void output(String string)
      Write into the output
      Parameters:
      string - The string to output
    • output

      protected final void output(Object object)
      Write into the output
      Parameters:
      object - An object that will be transform into JSon
    • getResponseContentType

      protected String getResponseContentType()
    • doGet

      public abstract void doGet()
      Entry point for GET and SEARCH
    • doPost

      public abstract void doPost()
      Entry point for CREATE
    • doPut

      public abstract void doPut()
      Entry point for UPDATE
    • doDelete

      public abstract void doDelete()
      Entry point for DELETE