Class Upload

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.maplander.backend.controller.servlet.Upload
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Upload extends javax.servlet.http.HttpServlet
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doDelete(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
    deletes a file in doDelete servlet.
    protected void
    doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
    upload a file in doPost servlet.

    Methods inherited from class javax.servlet.http.HttpServlet

    doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service

    Methods inherited from class javax.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Upload

      public Upload()
  • Method Details

    • doPost

      protected void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
      upload a file in doPost servlet. It needs an file Part; fileName, path and isImage passed in HttpServletRequest as query params. Default fileName is file-timestamp. Default path is default. Default isImage is false.
      Overrides:
      doPost in class javax.servlet.http.HttpServlet
      Parameters:
      req - contains a Part; fileName, path and isImage as query params.
      resp - returns in writer an EntityResponse with FileCS. Status are: HttpStatusCode.OK, HttpStatusCode.BAD_REQUEST, HttpStatusCode.INTERNAL_SERVER_ERROR
      Throws:
      javax.servlet.ServletException - ServletException
      IOException - IOException
    • doDelete

      protected void doDelete(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
      deletes a file in doDelete servlet. It needs a blobName passed in HttpServletRequest as a query param.
      Overrides:
      doDelete in class javax.servlet.http.HttpServlet
      Parameters:
      req - contains blobName.
      resp - returns in writer an DefaultResponse. Status are: HttpStatusCode.OK, HttpStatusCode.BAD_REQUEST, HttpStatusCode.NOT_EXISTS
      Throws:
      javax.servlet.ServletException - ServletException
      IOException - IOException