* Issue #10731 wrong context attribute name javax.servlet instead of jakarta.servlet Signed-off-by: Olivier Lamy <olamy@apache.org> * Update jetty-server/src/main/java/org/eclipse/jetty/server/MultiPartFormInputStream.java Co-authored-by: Simone Bordet <simone.bordet@gmail.com> * Update jetty-server/src/main/java/org/eclipse/jetty/server/Request.java Co-authored-by: Simone Bordet <simone.bordet@gmail.com> * fix javadoc Signed-off-by: Olivier Lamy <olamy@apache.org> * more usage of constant Signed-off-by: Olivier Lamy <olamy@apache.org> --------- Signed-off-by: Olivier Lamy <olamy@apache.org> Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
38a57e16e5
commit
3507e17c86
|
@ -16,6 +16,7 @@ package org.eclipse.jetty.jstl;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
import jakarta.servlet.ServletContext;
|
||||||
import org.eclipse.jetty.webapp.WebAppContext;
|
import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +27,7 @@ public class JspConfig
|
||||||
{
|
{
|
||||||
public static void init(WebAppContext context, URI baseUri, File scratchDir)
|
public static void init(WebAppContext context, URI baseUri, File scratchDir)
|
||||||
{
|
{
|
||||||
context.setAttribute("jakarta.servlet.context.tempdir", scratchDir);
|
context.setAttribute(ServletContext.TEMPDIR, scratchDir);
|
||||||
context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
|
context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
|
||||||
".*/jetty-jakarta-servlet-api-[^/]*\\.jar$|.*jakarta.servlet.jsp.jstl-[^/]*\\.jar|.*taglibs-standard.*\\.jar");
|
".*/jetty-jakarta-servlet-api-[^/]*\\.jar$|.*jakarta.servlet.jsp.jstl-[^/]*\\.jar|.*taglibs-standard.*\\.jar");
|
||||||
context.setWar(baseUri.toASCIIString());
|
context.setWar(baseUri.toASCIIString());
|
||||||
|
|
|
@ -367,7 +367,7 @@ public class MultiPartFormInputStream
|
||||||
* @param in Request input stream
|
* @param in Request input stream
|
||||||
* @param contentType Content-Type header
|
* @param contentType Content-Type header
|
||||||
* @param config MultipartConfigElement
|
* @param config MultipartConfigElement
|
||||||
* @param contextTmpDir jakarta.servlet.context.tempdir
|
* @param contextTmpDir {@value jakarta.servlet.ServletContext#TEMPDIR}
|
||||||
*/
|
*/
|
||||||
public MultiPartFormInputStream(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir)
|
public MultiPartFormInputStream(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir)
|
||||||
{
|
{
|
||||||
|
@ -378,7 +378,7 @@ public class MultiPartFormInputStream
|
||||||
* @param in Request input stream
|
* @param in Request input stream
|
||||||
* @param contentType Content-Type header
|
* @param contentType Content-Type header
|
||||||
* @param config MultipartConfigElement
|
* @param config MultipartConfigElement
|
||||||
* @param contextTmpDir javax.servlet.context.tempdir
|
* @param contextTmpDir {@value jakarta.servlet.ServletContext#TEMPDIR}
|
||||||
* @param maxParts the maximum number of parts that can be parsed from the multipart content (0 for no parts allowed, -1 for unlimited parts).
|
* @param maxParts the maximum number of parts that can be parsed from the multipart content (0 for no parts allowed, -1 for unlimited parts).
|
||||||
*/
|
*/
|
||||||
public MultiPartFormInputStream(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir, int maxParts)
|
public MultiPartFormInputStream(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir, int maxParts)
|
||||||
|
|
|
@ -375,7 +375,7 @@ public class MultiPartInputStreamParser
|
||||||
* @param in Request input stream
|
* @param in Request input stream
|
||||||
* @param contentType Content-Type header
|
* @param contentType Content-Type header
|
||||||
* @param config MultipartConfigElement
|
* @param config MultipartConfigElement
|
||||||
* @param contextTmpDir jakarta.servlet.context.tempdir
|
* @param contextTmpDir {@value jakarta.servlet.ServletContext#TEMPDIR}
|
||||||
*/
|
*/
|
||||||
public MultiPartInputStreamParser(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir)
|
public MultiPartInputStreamParser(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir)
|
||||||
{
|
{
|
||||||
|
@ -386,7 +386,7 @@ public class MultiPartInputStreamParser
|
||||||
* @param in Request input stream
|
* @param in Request input stream
|
||||||
* @param contentType Content-Type header
|
* @param contentType Content-Type header
|
||||||
* @param config MultipartConfigElement
|
* @param config MultipartConfigElement
|
||||||
* @param contextTmpDir javax.servlet.context.tempdir
|
* @param contextTmpDir {@value jakarta.servlet.ServletContext#TEMPDIR}
|
||||||
* @param maxParts the maximum number of parts that can be parsed from the multipart content (0 for no parts allowed, -1 for unlimited parts).
|
* @param maxParts the maximum number of parts that can be parsed from the multipart content (0 for no parts allowed, -1 for unlimited parts).
|
||||||
*/
|
*/
|
||||||
public MultiPartInputStreamParser(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir, int maxParts)
|
public MultiPartInputStreamParser(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir, int maxParts)
|
||||||
|
|
|
@ -2424,12 +2424,12 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
case RFC7578:
|
case RFC7578:
|
||||||
return new MultiParts.MultiPartsHttpParser(getInputStream(), getContentType(), config,
|
return new MultiParts.MultiPartsHttpParser(getInputStream(), getContentType(), config,
|
||||||
(_context != null ? (File)_context.getAttribute("javax.servlet.context.tempdir") : null), this, maxParts);
|
(_context != null ? (File)_context.getAttribute(ServletContext.TEMPDIR) : null), this, maxParts);
|
||||||
|
|
||||||
case LEGACY:
|
case LEGACY:
|
||||||
default:
|
default:
|
||||||
return new MultiParts.MultiPartsUtilParser(getInputStream(), getContentType(), config,
|
return new MultiParts.MultiPartsUtilParser(getInputStream(), getContentType(), config,
|
||||||
(_context != null ? (File)_context.getAttribute("javax.servlet.context.tempdir") : null), this, maxParts);
|
(_context != null ? (File)_context.getAttribute(ServletContext.TEMPDIR) : null), this, maxParts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class PutFilter implements Filter
|
||||||
{
|
{
|
||||||
_context = config.getServletContext();
|
_context = config.getServletContext();
|
||||||
|
|
||||||
_tmpdir = (File)_context.getAttribute("jakarta.servlet.context.tempdir");
|
_tmpdir = (File)_context.getAttribute(ServletContext.TEMPDIR);
|
||||||
|
|
||||||
String realPath = _context.getRealPath("/");
|
String realPath = _context.getRealPath("/");
|
||||||
if (realPath == null)
|
if (realPath == null)
|
||||||
|
|
|
@ -1151,7 +1151,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set temporary directory for context.
|
* Set temporary directory for context.
|
||||||
* The jakarta.servlet.context.tempdir attribute is also set.
|
* The {@value jakarta.servlet.ServletContext#TEMPDIR} attribute is also set.
|
||||||
*
|
*
|
||||||
* @param dir Writable temporary directory.
|
* @param dir Writable temporary directory.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class WebInfConfiguration extends AbstractConfiguration
|
||||||
* exit depends on value of persistTempDirectory.
|
* exit depends on value of persistTempDirectory.
|
||||||
* </li>
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* Iff jakarta.servlet.context.tempdir context attribute is set for
|
* Iff {@value jakarta.servlet.ServletContext#TEMPDIR} context attribute is set for
|
||||||
* this webapp && exists && writeable, then use it. Set delete on exit depends on
|
* this webapp && exists && writeable, then use it. Set delete on exit depends on
|
||||||
* value of persistTempDirectory.
|
* value of persistTempDirectory.
|
||||||
* </li>
|
* </li>
|
||||||
|
|
Loading…
Reference in New Issue