Made remove() methods return the removed value.

This commit is contained in:
Simone Bordet 2013-09-08 23:02:24 +02:00
parent 092fb2d36a
commit 400f0ce5a2
1 changed files with 8 additions and 9 deletions

View File

@ -18,10 +18,6 @@
package org.eclipse.jetty.http;
import static org.eclipse.jetty.util.QuotedStringTokenizer.isQuoted;
import static org.eclipse.jetty.util.QuotedStringTokenizer.quoteOnly;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -47,12 +43,13 @@ import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.DateCache;
import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.StringMap;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.Trie;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import static org.eclipse.jetty.util.QuotedStringTokenizer.isQuoted;
/**
* HTTP Fields. A collection of HTTP header and or Trailer fields.
@ -649,14 +646,15 @@ public class HttpFields implements Iterable<HttpField>
*
* @param name the field to remove
*/
public void remove(HttpHeader name)
public HttpField remove(HttpHeader name)
{
for (int i=_fields.size();i-->0;)
{
HttpField f=_fields.get(i);
if (f.getHeader()==name)
_fields.remove(i);
return _fields.remove(i);
}
return null;
}
/**
@ -664,14 +662,15 @@ public class HttpFields implements Iterable<HttpField>
*
* @param name the field to remove
*/
public void remove(String name)
public HttpField remove(String name)
{
for (int i=_fields.size();i-->0;)
{
HttpField f=_fields.get(i);
if (f.getName().equalsIgnoreCase(name))
_fields.remove(i);
return _fields.remove(i);
}
return null;
}
/**