/** * Creates a new app. * * @param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest The request instance * @param \AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse The response instance * * @return void * @see \AppserverIo\Psr\Servlet\Http\HttpServlet::doPost() * * @SWG\Post( * path="/applications.do", * tags={"applications"}, * summary="Create's a new application", * consumes={"multipart/form-data"}, * @SWG\Parameter( * name="containerId", * in="formData", * description="The ID of the container to deploy the PHAR archive to", * required=true, * type="string" * ), * @SWG\Parameter( * name="file", * in="formData", * description="The PHAR archive containing the application", * required=true, * type="file" * ), * @SWG\Response( * response=200, * description="a ""success"" message" * ), * @SWG\Response( * response=500, * description="Internal Server Error" * ) * ) */ public function doPost(HttpServletRequestInterface $servletRequest, HttpServletResponseInterface $servletResponse) { // query whether we've found an container ID and the PHAR archive if ($servletRequest->hasParameter(RequestKeys::CONTAINER_ID) && ($pharArchive = $servletRequest->getPart(ApplicationServlet::UPLOADED_PHAR_FILE))) { // save file to appserver's upload tmp folder with a temporary name $pharArchive->init(); $pharArchive->write($pharArchive->getFilename()); // upload the file $this->getApplicationProcessor()->upload($servletRequest->getParameter(RequestKeys::CONTAINER_ID), $pharArchive->getFilename()); } else { $this->addError(ErrorOverviewData::factoryForPointer(500, 'Missing container ID or corrupt PHAR archive')); } }
/** * Dummy function used to add Swagger annotations, because real login will be handled * by the magic p_security_check.do servlet. * * @param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest The request instance * @param \AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse The response instance * * @return void * @see \AppserverIo\Psr\Servlet\Http\HttpServlet::doPost() * * @SWG\Post( * path="/p_security_check.do", * tags={"authentication"}, * summary="Login", * @SWG\Parameter( * name="p_username", * in="formData", * description="The username to login", * required=true, * type="string" * ), * @SWG\Parameter( * name="p_password", * in="formData", * description="The password to authenticate the user with", * required=true, * type="string" * ), * @SWG\Response( * response=200, * description="Successfull Login" * ), * @SWG\Response( * response=500, * description="Internal Server Error" * ) * ) */ public function doPost(HttpServletRequestInterface $servletRequest, HttpServletResponseInterface $servletResponse) { $this->addError(ErrorOverviewData::factoryForPointer(401, 'Authentication Required')); }