diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java index a28d5cbfbae..012139f42c3 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpFields.java @@ -523,53 +523,6 @@ public class HttpFields implements Iterable return Collections.enumeration(empty); } - /** - * Get multi field values with separator. The multiple values can be represented as separate - * headers of the same name, or by a single header using the separator(s), or a combination of - * both. Separators may be quoted. - * - * @param name the case-insensitive field name - * @param separators String of separators. - * @return Enumeration of the values, or null if no such header. - */ - @Deprecated - public Enumeration getValues(String name, final String separators) - { - final Enumeration e = getValues(name); - if (e == null) - return null; - return new Enumeration() - { - QuotedStringTokenizer tok = null; - - @Override - public boolean hasMoreElements() - { - if (tok != null && tok.hasMoreElements()) return true; - while (e.hasMoreElements()) - { - String value = e.nextElement(); - if (value!=null) - { - tok = new QuotedStringTokenizer(value, separators, false, false); - if (tok.hasMoreElements()) return true; - } - } - tok = null; - return false; - } - - @Override - public String nextElement() throws NoSuchElementException - { - if (!hasMoreElements()) throw new NoSuchElementException(); - String next = (String) tok.nextElement(); - if (next != null) next = next.trim(); - return next; - } - }; - } - public void put(HttpField field) { boolean put=false; @@ -982,87 +935,6 @@ public class HttpFields implements Iterable return value.substring(0, i).trim(); } - @Deprecated - private static final Float __one = new Float("1.0"); - @Deprecated - private static final Float __zero = new Float("0.0"); - @Deprecated - private static final Trie __qualities = new ArrayTernaryTrie<>(); - static - { - __qualities.put("*", __one); - __qualities.put("1.0", __one); - __qualities.put("1", __one); - __qualities.put("0.9", new Float("0.9")); - __qualities.put("0.8", new Float("0.8")); - __qualities.put("0.7", new Float("0.7")); - __qualities.put("0.66", new Float("0.66")); - __qualities.put("0.6", new Float("0.6")); - __qualities.put("0.5", new Float("0.5")); - __qualities.put("0.4", new Float("0.4")); - __qualities.put("0.33", new Float("0.33")); - __qualities.put("0.3", new Float("0.3")); - __qualities.put("0.2", new Float("0.2")); - __qualities.put("0.1", new Float("0.1")); - __qualities.put("0", __zero); - __qualities.put("0.0", __zero); - } - - @Deprecated - public static Float getQuality(String value) - { - if (value == null) return __zero; - - int qe = value.indexOf(";"); - if (qe++ < 0 || qe == value.length()) return __one; - - if (value.charAt(qe++) == 'q') - { - qe++; - Float q = __qualities.get(value, qe, value.length() - qe); - if (q != null) - return q; - } - - Map params = new HashMap<>(4); - valueParameters(value, params); - String qs = params.get("q"); - if (qs==null) - qs="*"; - Float q = __qualities.get(qs); - if (q == null) - { - try - { - q = new Float(qs); - } - catch (Exception e) - { - q = __one; - } - } - return q; - } - - /** - * List values in quality order. - * - * @param e Enumeration of values with quality parameters - * @return values in quality order. - */ - @Deprecated - public static List qualityList(Enumeration e) - { - if (e == null || !e.hasMoreElements()) - return Collections.emptyList(); - - QuotedQualityCSV values = new QuotedQualityCSV(); - while(e.hasMoreElements()) - values.addValue(e.nextElement()); - return values.getValues(); - } - - private class Itr implements Iterator { int _cursor; // index of next element to return diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java index 0e0c5ab218a..cfa40814ee2 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java @@ -317,7 +317,7 @@ public class HttpFieldsTest assertEquals(e.nextElement(), "value0C,value0D"); assertEquals(false, e.hasMoreElements()); - e = fields.getValues("name0",","); + e = Collections.enumeration(fields.getCSV("name0",false)); assertEquals(true, e.hasMoreElements()); assertEquals(e.nextElement(), "value0A"); assertEquals(true, e.hasMoreElements()); @@ -328,7 +328,7 @@ public class HttpFieldsTest assertEquals(e.nextElement(), "value0D"); assertEquals(false, e.hasMoreElements()); - e = fields.getValues("name1",","); + e = Collections.enumeration(fields.getCSV("name1",false)); assertEquals(true, e.hasMoreElements()); assertEquals(e.nextElement(), "value1A"); assertEquals(true, e.hasMoreElements()); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java b/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java index ff6da429a3b..cdd8ec5ce45 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/PartialRFC2616Test.java @@ -260,8 +260,7 @@ public class PartialRFC2616Test HttpFields fields=new HttpFields(); fields.put("Q","bbb;q=0.5,aaa,ccc;q=0.002,d;q=0,e;q=0.0001,ddd;q=0.001,aa2,abb;q=0.7"); - Enumeration qualities=fields.getValues("Q",", \t"); - List list=HttpFields.qualityList(qualities); + List list=fields.getQualityCSV("Q"); assertEquals("Quality parameters","aaa",HttpFields.valueParameters(list.get(0),null)); assertEquals("Quality parameters","aa2",HttpFields.valueParameters(list.get(1),null)); assertEquals("Quality parameters","abb",HttpFields.valueParameters(list.get(2),null)); diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java index 9920479b944..d80a6c45c09 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java @@ -471,7 +471,7 @@ public class DoSFilter implements Filter @Override public void run() { - closeConnection(request, response, thread); + onRequestTimeout(request, response, thread); } }; Scheduler.Task task = _scheduler.schedule(requestTimeout, getMaxRequestMs(), TimeUnit.MILLISECONDS); @@ -510,15 +510,6 @@ public class DoSFilter implements Filter handlingThread.interrupt(); } - /** - * @deprecated use {@link #onRequestTimeout(HttpServletRequest, HttpServletResponse, Thread)} instead - */ - @Deprecated - protected void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread) - { - onRequestTimeout(request, response, thread); - } - /** * Get priority for this request, based on user type *