Merged branch 'jetty-9.2.x' into 'jetty-9.3.x'.
This commit is contained in:
commit
6306f06e2f
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.client;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
@ -445,7 +446,7 @@ public class HttpClientURITest extends AbstractHttpClientServerTest
|
|||
});
|
||||
|
||||
ContentResponse response = client.newRequest("localhost", connector.getLocalPort())
|
||||
.scheme(scheme.toUpperCase())
|
||||
.scheme(scheme.toUpperCase(Locale.ENGLISH))
|
||||
.timeout(5, TimeUnit.SECONDS)
|
||||
.send();
|
||||
|
||||
|
|
|
@ -18,15 +18,11 @@
|
|||
|
||||
package org.eclipse.jetty.http;
|
||||
|
||||
import static org.eclipse.jetty.http.HttpTokens.CARRIAGE_RETURN;
|
||||
import static org.eclipse.jetty.http.HttpTokens.LINE_FEED;
|
||||
import static org.eclipse.jetty.http.HttpTokens.SPACE;
|
||||
import static org.eclipse.jetty.http.HttpTokens.TAB;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.jetty.http.HttpTokens.EndOfContent;
|
||||
import org.eclipse.jetty.util.ArrayTernaryTrie;
|
||||
|
@ -38,6 +34,11 @@ import org.eclipse.jetty.util.Utf8StringBuilder;
|
|||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
import static org.eclipse.jetty.http.HttpTokens.CARRIAGE_RETURN;
|
||||
import static org.eclipse.jetty.http.HttpTokens.LINE_FEED;
|
||||
import static org.eclipse.jetty.http.HttpTokens.SPACE;
|
||||
import static org.eclipse.jetty.http.HttpTokens.TAB;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** A Parser for 1.0 and 1.1 as defined by RFC7230
|
||||
|
@ -201,8 +202,8 @@ public class HttpParser
|
|||
{
|
||||
CACHE.put(new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,type+";charset="+charset));
|
||||
CACHE.put(new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,type+"; charset="+charset));
|
||||
CACHE.put(new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,type+";charset="+charset.toUpperCase()));
|
||||
CACHE.put(new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,type+"; charset="+charset.toUpperCase()));
|
||||
CACHE.put(new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,type+";charset="+charset.toUpperCase(Locale.ENGLISH)));
|
||||
CACHE.put(new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,type+"; charset="+charset.toUpperCase(Locale.ENGLISH)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.MissingResourceException;
|
||||
|
@ -101,7 +102,7 @@ public class MimeTypes
|
|||
_base=base;
|
||||
int i=s.indexOf(";charset=");
|
||||
_charset=Charset.forName(s.substring(i+9));
|
||||
_charsetString=_charset==null?null:_charset.toString().toLowerCase();
|
||||
_charsetString=_charset.toString().toLowerCase(Locale.ENGLISH);
|
||||
_assumedCharset=false;
|
||||
_field=new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,_string);
|
||||
}
|
||||
|
@ -113,7 +114,7 @@ public class MimeTypes
|
|||
_base=this;
|
||||
_buffer=BufferUtil.toBuffer(s);
|
||||
_charset=cs;
|
||||
_charsetString=_charset==null?null:_charset.toString().toLowerCase();
|
||||
_charsetString=_charset==null?null:_charset.toString().toLowerCase(Locale.ENGLISH);
|
||||
_assumedCharset=true;
|
||||
_field=new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,_string);
|
||||
}
|
||||
|
|
|
@ -18,16 +18,10 @@
|
|||
|
||||
package org.eclipse.jetty.http;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
|
@ -35,9 +29,13 @@ import org.hamcrest.Matchers;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class HttpFieldsTest
|
||||
{
|
||||
@Test
|
||||
|
@ -69,7 +67,6 @@ public class HttpFieldsTest
|
|||
assertEquals(true, e.hasMoreElements());
|
||||
assertEquals(e.nextElement(), "value:0");
|
||||
assertEquals(false, e.hasMoreElements());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -174,11 +171,11 @@ public class HttpFieldsTest
|
|||
BufferUtil.flipToFill(buffer);
|
||||
HttpGenerator.putTo(header,buffer);
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
String out = BufferUtil.toString(buffer).toLowerCase();
|
||||
String out = BufferUtil.toString(buffer).toLowerCase(Locale.ENGLISH);
|
||||
|
||||
Assert.assertThat(out,Matchers.containsString((HttpHeader.CONNECTION+": "+HttpHeaderValue.KEEP_ALIVE).toLowerCase()));
|
||||
Assert.assertThat(out,Matchers.containsString((HttpHeader.TRANSFER_ENCODING+": "+HttpHeaderValue.CHUNKED).toLowerCase()));
|
||||
Assert.assertThat(out,Matchers.containsString((HttpHeader.CONTENT_ENCODING+": "+HttpHeaderValue.GZIP).toLowerCase()));
|
||||
Assert.assertThat(out,Matchers.containsString((HttpHeader.CONNECTION+": "+HttpHeaderValue.KEEP_ALIVE).toLowerCase(Locale.ENGLISH)));
|
||||
Assert.assertThat(out,Matchers.containsString((HttpHeader.TRANSFER_ENCODING+": "+HttpHeaderValue.CHUNKED).toLowerCase(Locale.ENGLISH)));
|
||||
Assert.assertThat(out,Matchers.containsString((HttpHeader.CONTENT_ENCODING+": "+HttpHeaderValue.GZIP).toLowerCase(Locale.ENGLISH)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -302,7 +299,6 @@ public class HttpFieldsTest
|
|||
assertEquals(false, e.hasMoreElements());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetValues() throws Exception
|
||||
{
|
||||
|
@ -343,7 +339,6 @@ public class HttpFieldsTest
|
|||
assertEquals(false, e.hasMoreElements());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetQualityValues() throws Exception
|
||||
{
|
||||
|
@ -484,7 +479,6 @@ public class HttpFieldsTest
|
|||
header.putLongField("I6",-47);
|
||||
assertEquals("46",header.get("I5"));
|
||||
assertEquals("-47",header.get("I6"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -523,7 +517,5 @@ public class HttpFieldsTest
|
|||
assertFalse(header.contains(HttpHeader.AGE,"abc"));
|
||||
|
||||
assertFalse(header.containsKey("n11"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.eclipse.jetty.http2.frames;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.jetty.http2.ErrorCode;
|
||||
|
||||
public class ResetFrame extends Frame
|
||||
|
@ -46,7 +48,7 @@ public class ResetFrame extends Frame
|
|||
public String toString()
|
||||
{
|
||||
ErrorCode errorCode = ErrorCode.from(error);
|
||||
String reason = errorCode == null ? "error=" + error : errorCode.name().toLowerCase();
|
||||
String reason = errorCode == null ? "error=" + error : errorCode.name().toLowerCase(Locale.ENGLISH);
|
||||
return String.format("%s#%d{%s}", super.toString(), streamId, reason);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.http2.hpack;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
|
@ -69,7 +70,7 @@ public class HuffmanTest
|
|||
int pos=BufferUtil.flipToFill(buf);
|
||||
Huffman.encode(buf,test[2]);
|
||||
BufferUtil.flipToFlush(buf,pos);
|
||||
String encoded=TypeUtil.toHexString(BufferUtil.toArray(buf)).toLowerCase();
|
||||
String encoded=TypeUtil.toHexString(BufferUtil.toArray(buf)).toLowerCase(Locale.ENGLISH);
|
||||
Assert.assertEquals(test[0],test[1],encoded);
|
||||
Assert.assertEquals(test[1].length()/2,Huffman.octetsNeeded(test[2]));
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.http2.client.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.jetty.client.HttpChannel;
|
||||
import org.eclipse.jetty.client.HttpExchange;
|
||||
|
@ -109,7 +110,7 @@ public class HttpReceiverOverHTTP2 extends HttpReceiver implements Stream.Listen
|
|||
return;
|
||||
|
||||
ErrorCode error = ErrorCode.from(frame.getError());
|
||||
String reason = error == null ? "reset" : error.name().toLowerCase();
|
||||
String reason = error == null ? "reset" : error.name().toLowerCase(Locale.ENGLISH);
|
||||
exchange.getRequest().abort(new IOException(reason));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.eclipse.jetty.quickstart;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -101,7 +103,7 @@ public class PreconfigureQuickStartWar
|
|||
|
||||
if (xml != null)
|
||||
{
|
||||
if (xml.isDirectory() || !xml.toString().toLowerCase().endsWith(".xml"))
|
||||
if (xml.isDirectory() || !xml.toString().toLowerCase(Locale.ENGLISH).endsWith(".xml"))
|
||||
error("Bad context.xml: "+xml);
|
||||
XmlConfiguration xmlConfiguration = new XmlConfiguration(xml.getURL());
|
||||
xmlConfiguration.configure(webapp);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.quickstart;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -28,14 +29,11 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
|
||||
/**
|
||||
* QuickStartWar
|
||||
*
|
||||
*/
|
||||
public class QuickStartWebApp extends WebAppContext
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(QuickStartWebApp.class);
|
||||
|
||||
|
||||
|
||||
public static final String[] __configurationClasses = new String[]
|
||||
{
|
||||
org.eclipse.jetty.quickstart.QuickStartConfiguration.class.getCanonicalName(),
|
||||
|
@ -44,13 +42,11 @@ public class QuickStartWebApp extends WebAppContext
|
|||
org.eclipse.jetty.webapp.JettyWebXmlConfiguration.class.getCanonicalName()
|
||||
};
|
||||
|
||||
|
||||
private boolean _preconfigure=false;
|
||||
private boolean _autoPreconfigure=false;
|
||||
private boolean _startWebapp=false;
|
||||
private PreconfigureDescriptorProcessor _preconfigProcessor;
|
||||
|
||||
|
||||
public static final String[] __preconfigurationClasses = new String[]
|
||||
{
|
||||
org.eclipse.jetty.webapp.WebInfConfiguration.class.getCanonicalName(),
|
||||
|
@ -74,8 +70,8 @@ public class QuickStartWebApp extends WebAppContext
|
|||
return _preconfigure;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Preconfigure webapp
|
||||
/**
|
||||
* Preconfigure webapp
|
||||
* @param preconfigure If true, then starting the webapp will generate
|
||||
* the WEB-INF/quickstart-web.xml rather than start the webapp.
|
||||
*/
|
||||
|
@ -104,8 +100,6 @@ public class QuickStartWebApp extends WebAppContext
|
|||
super.startWebapp();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void stopWebapp() throws Exception
|
||||
{
|
||||
|
@ -128,7 +122,7 @@ public class QuickStartWebApp extends WebAppContext
|
|||
|
||||
if (base.isDirectory())
|
||||
dir=base;
|
||||
else if (base.toString().toLowerCase().endsWith(".war"))
|
||||
else if (base.toString().toLowerCase(Locale.ENGLISH).endsWith(".war"))
|
||||
{
|
||||
war=base;
|
||||
String w=war.toString();
|
||||
|
@ -176,7 +170,6 @@ public class QuickStartWebApp extends WebAppContext
|
|||
super.doStart();
|
||||
}
|
||||
|
||||
|
||||
public void generateQuickstartWebXml(String extraXML) throws Exception
|
||||
{
|
||||
Resource descriptor = getWebInf().addPath(QuickStartDescriptorGenerator.DEFAULT_QUICKSTART_DESCRIPTOR_NAME);
|
||||
|
@ -188,6 +181,4 @@ public class QuickStartWebApp extends WebAppContext
|
|||
generator.generateQuickStartWebXml(fos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.net.URLClassLoader;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
|
@ -89,8 +90,6 @@ public class Runner
|
|||
protected boolean _enableStats=false;
|
||||
protected String _statsPropFile;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Classpath
|
||||
*/
|
||||
|
@ -118,8 +117,9 @@ public class Runner
|
|||
addJars(item);
|
||||
else
|
||||
{
|
||||
if (path.toLowerCase().endsWith(".jar") ||
|
||||
path.toLowerCase().endsWith(".zip"))
|
||||
String lowerCasePath = path.toLowerCase(Locale.ENGLISH);
|
||||
if (lowerCasePath.endsWith(".jar") ||
|
||||
lowerCasePath.endsWith(".zip"))
|
||||
{
|
||||
URL url = item.getURL();
|
||||
_classpath.add(url);
|
||||
|
@ -148,7 +148,6 @@ public class Runner
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate helpful usage message and exit
|
||||
*
|
||||
|
@ -187,8 +186,6 @@ public class Runner
|
|||
System.exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Configure a jetty instance and deploy the webapps presented as args
|
||||
*
|
||||
|
@ -424,7 +421,7 @@ public class Runner
|
|||
contextPath = "/" + contextPath;
|
||||
|
||||
// Configure the context
|
||||
if (!ctx.isDirectory() && ctx.toString().toLowerCase().endsWith(".xml"))
|
||||
if (!ctx.isDirectory() && ctx.toString().toLowerCase(Locale.ENGLISH).endsWith(".xml"))
|
||||
{
|
||||
// It is a context config file
|
||||
XmlConfiguration xmlConfiguration = new XmlConfiguration(ctx.getURL());
|
||||
|
@ -481,7 +478,6 @@ public class Runner
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void prependHandler (Handler handler, HandlerCollection handlers)
|
||||
{
|
||||
if (handler == null || handlers == null)
|
||||
|
@ -494,16 +490,12 @@ public class Runner
|
|||
handlers.setHandlers(children);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void run() throws Exception
|
||||
{
|
||||
_server.start();
|
||||
_server.join();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Establish a classloader with custom paths (if any)
|
||||
*/
|
||||
|
@ -524,9 +516,6 @@ public class Runner
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Runner runner = new Runner();
|
||||
|
|
|
@ -248,7 +248,7 @@ public class ResponseTest
|
|||
response.setContentType("text/html;charset=utf-8;charset=UTF-8");
|
||||
response.getWriter();
|
||||
assertEquals("text/html;charset=utf-8;charset=UTF-8",response.getContentType());
|
||||
assertEquals("utf-8",response.getCharacterEncoding().toLowerCase());
|
||||
assertEquals("utf-8",response.getCharacterEncoding().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.servlet.GenericServlet;
|
||||
import javax.servlet.ServletException;
|
||||
|
@ -125,7 +126,7 @@ public class JspPropertyGroupServlet extends GenericServlet
|
|||
{
|
||||
_dftServlet.getServlet().service(req,res);
|
||||
}
|
||||
else if (_starJspMapped && pathInContext.toLowerCase().endsWith(".jsp"))
|
||||
else if (_starJspMapped && pathInContext.toLowerCase(Locale.ENGLISH).endsWith(".jsp"))
|
||||
{
|
||||
_jspServlet.getServlet().service(req,res);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.io.BufferedReader;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
@ -96,7 +97,7 @@ public class Licensing
|
|||
System.err.printf("%nProceed (y/N)? ");
|
||||
String response = input.readLine();
|
||||
|
||||
licenseAck = (Utils.isNotBlank(response) && response.toLowerCase().startsWith("y"));
|
||||
licenseAck = (Utils.isNotBlank(response) && response.toLowerCase(Locale.ENGLISH).startsWith("y"));
|
||||
}
|
||||
|
||||
return licenseAck;
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.eclipse.jetty.util.security;
|
|||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
@ -152,7 +153,7 @@ public class Password extends Credential
|
|||
if (b1<0 || b2<0)
|
||||
{
|
||||
int i0 = (0xff&b1)*256 + (0xff&b2);
|
||||
String x = Integer.toString(i0, 36).toLowerCase();
|
||||
String x = Integer.toString(i0, 36).toLowerCase(Locale.ENGLISH);
|
||||
buf.append("U0000",0,5-x.length());
|
||||
buf.append(x);
|
||||
}
|
||||
|
@ -161,7 +162,7 @@ public class Password extends Credential
|
|||
int i1 = 127 + b1 + b2;
|
||||
int i2 = 127 + b1 - b2;
|
||||
int i0 = i1 * 256 + i2;
|
||||
String x = Integer.toString(i0, 36).toLowerCase();
|
||||
String x = Integer.toString(i0, 36).toLowerCase(Locale.ENGLISH);
|
||||
|
||||
int j0 = Integer.parseInt(x, 36);
|
||||
int j1 = (i0 / 256);
|
||||
|
|
Loading…
Reference in New Issue