Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #10731 wrong context attribute name javax.servlet instead of jakarta.servlet #10735

Merged
merged 5 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.io.File;
import java.net.URI;

import jakarta.servlet.ServletContext;
import org.eclipse.jetty.webapp.WebAppContext;

/**
Expand All @@ -26,7 +27,7 @@ public class JspConfig
{
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",
".*/jetty-jakarta-servlet-api-[^/]*\\.jar$|.*jakarta.servlet.jsp.jstl-[^/]*\\.jar|.*taglibs-standard.*\\.jar");
context.setWar(baseUri.toASCIIString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public String getContentDispositionFilename()
* @param in Request input stream
* @param contentType Content-Type header
* @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)
{
Expand All @@ -378,7 +378,7 @@ public MultiPartFormInputStream(InputStream in, String contentType, MultipartCon
* @param in Request input stream
* @param contentType Content-Type header
* @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).
*/
public MultiPartFormInputStream(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir, int maxParts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public String getContentDispositionFilename()
* @param in Request input stream
* @param contentType Content-Type header
* @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)
{
Expand All @@ -386,7 +386,7 @@ public MultiPartInputStreamParser(InputStream in, String contentType, MultipartC
* @param in Request input stream
* @param contentType Content-Type header
* @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).
*/
public MultiPartInputStreamParser(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir, int maxParts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2424,12 +2424,12 @@ private MultiParts newMultiParts(MultipartConfigElement config, int maxParts) th
{
case RFC7578:
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:
default:
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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void init(FilterConfig config) throws ServletException
{
_context = config.getServletContext();

_tmpdir = (File)_context.getAttribute("jakarta.servlet.context.tempdir");
_tmpdir = (File)_context.getAttribute(ServletContext.TEMPDIR);

String realPath = _context.getRealPath("/");
if (realPath == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ public void setContextWhiteList(String... contextWhiteList)

/**
* 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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void cloneConfigure(WebAppContext template, WebAppContext context) throws
* exit depends on value of persistTempDirectory.
* </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 &amp;&amp; exists &amp;&amp; writeable, then use it. Set delete on exit depends on
* value of persistTempDirectory.
* </li>
Expand Down