mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-23 23:41:52 +08:00
feat: support jetty shell generate
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author ReaJason
|
||||
* @since 2024/12/7
|
||||
*/
|
||||
public class TestServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class UploadServlet extends HttpServlet {
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
Part file = request.getPart("file");
|
||||
String fileName = getFileName(file);
|
||||
String uploadPath = getServletContext().getRealPath(UPLOAD_DIRECTORY) + fileName;
|
||||
String uploadPath = getServletContext().getRealPath(UPLOAD_DIRECTORY) + File.separator + fileName;
|
||||
InputStream inputStream = file.getInputStream();
|
||||
File uploadFile = new File(uploadPath);
|
||||
IOUtils.copy(inputStream, Files.newOutputStream(uploadFile.toPath()));
|
||||
|
||||
@@ -10,6 +10,15 @@
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>test</servlet-name>
|
||||
<servlet-class>TestServlet</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>test</servlet-name>
|
||||
<url-pattern>/test</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- 用于 JSP 文件上传-->
|
||||
<servlet>
|
||||
<servlet-name>upload</servlet-name>
|
||||
|
||||
Reference in New Issue
Block a user