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

Merge 11 to 12 Issue #10731 wrong context attribute name javax.servlet instead of jakarta.servlet (#10735) and Address build/test failure against bad entities. (#10742) #10745

Merged
merged 3 commits into from
Oct 17, 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 @@ -20,6 +20,7 @@

import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.junit.jupiter.api.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

Expand All @@ -35,7 +36,16 @@ public void testXmlParser() throws Exception
{
// we want to parse a simple XML, no dtds, no xsds.
// just do it, without validation
XmlParser parser = new XmlParser(false);
XmlParser parser = new XmlParser(false)
{
@Override
protected InputSource resolveEntity(String pid, String sid)
{
InputSource inputSource = super.resolveEntity(pid, sid);
assertNotNull(inputSource, "You are using entities in your XML that don't match your redirectEntity mappings: pid=" + pid + ", sid=" + sid);
return inputSource;
}
};
URL url = XmlParserTest.class.getResource("configureSimple.xml");
assertNotNull(url);
XmlParser.Node testDoc = parser.parse(url.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.net.URI;
import java.nio.file.Path;

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

/**
Expand All @@ -27,7 +28,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 @@ -111,7 +111,7 @@ public void deconfigure(WebAppContext context) throws Exception
* exit depends on value of persistTempDirectory.
* </li>
* <li>
* Iff jakarta.servlet.context.tempdir context attribute is set for
* If {@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
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.ee9.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",
System.getProperty("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern"));
context.setWar(baseUri.toASCIIString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public String getContentDispositionFilename()
* @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}
*/
public MultiPartFormInputStream(InputStream in, String contentType, MultipartConfigElement config, File contextTmpDir)
{
Expand All @@ -397,7 +397,8 @@ 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 @@ -1997,7 +1997,7 @@ private void setNonComplianceViolationsOnRequest()
private MultiPartFormInputStream newMultiParts(MultipartConfigElement config, int maxParts) throws IOException
{
return new MultiPartFormInputStream(getInputStream(), getContentType(), config,
(_context != null ? (File)_context.getAttribute("jakarta.servlet.context.tempdir") : null), maxParts);
(_context != null ? (File)_context.getAttribute(ServletContext.TEMPDIR) : null), maxParts);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,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 @@ -113,7 +113,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