forked from piranhacloud/piranha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes piranhacloud#4470 - Add logging to FileUploadManager for debugg…
…ing purposes (piranhacloud#4485)
- Loading branch information
Showing
1 changed file
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,10 +50,10 @@ | |
* The ApacheMultiPartManager. | ||
* | ||
* <p> | ||
The FileUploadMultiPartManager implements the MultiPartManager API that delivers | ||
file upload functionality to a web application by delegating to Apache | ||
Commons File Upload. | ||
</p> | ||
* The FileUploadMultiPartManager implements the MultiPartManager API that | ||
* delivers file upload functionality to a web application by delegating to | ||
* Apache Commons File Upload. | ||
* </p> | ||
* | ||
* @author Manfred Riem ([email protected]) | ||
*/ | ||
|
@@ -73,9 +73,14 @@ public FileUploadMultiPartManager() { | |
@SuppressWarnings("unchecked") | ||
@Override | ||
public Collection<Part> getParts(WebApplication webApplication, WebApplicationRequest request) throws ServletException { | ||
LOGGER.log(TRACE, "Getting parts for request: {0}", request); | ||
|
||
if (LOGGER.isLoggable(TRACE)) { | ||
LOGGER.log(TRACE, "Getting parts for request: {0}", request); | ||
} | ||
|
||
if (!JakartaServletFileUpload.isMultipartContent(request)) { | ||
if (LOGGER.isLoggable(TRACE)) { | ||
LOGGER.log(TRACE, "Request: {0} is not a multipart/form-date request"); | ||
} | ||
throw new ServletException("Not a multipart/form-data request"); | ||
} | ||
|
||
|
@@ -98,15 +103,26 @@ public Collection<Part> getParts(WebApplication webApplication, WebApplicationRe | |
|
||
@Override | ||
public Part getPart(WebApplication webApplication, WebApplicationRequest request, String name) throws ServletException { | ||
LOGGER.log(TRACE, "Getting part: {0} for request: {1}", name, request); | ||
if (LOGGER.isLoggable(TRACE)) { | ||
LOGGER.log(TRACE, "Getting part: {0} for request: {1}", name, request); | ||
} | ||
if (!JakartaServletFileUpload.isMultipartContent(request)) { | ||
if (LOGGER.isLoggable(TRACE)) { | ||
LOGGER.log(TRACE, "Request: {0} is not a multipart/form-date request"); | ||
} | ||
throw new ServletException("Not a multipart/form-data request"); | ||
} | ||
for (Part part : getParts(webApplication, request)) { | ||
if (part.getName().equals(name)) { | ||
if (LOGGER.isLoggable(TRACE)) { | ||
LOGGER.log(TRACE, "Found part: {0}", part.getName()); | ||
} | ||
return part; | ||
} | ||
} | ||
if (LOGGER.isLoggable(TRACE)) { | ||
LOGGER.log(TRACE, "Unable to find part: {0}", name); | ||
} | ||
return null; | ||
} | ||
|
||
|