/** * This can be used to add a HTTP message header to this object. * The name and value of the HTTP message header will be used to * create a HTTP message header object which can be retrieved using * the <code>getValue</code> in combination with the get methods. * * @param name the name of the HTTP message header to be added * @param value the value the HTTP message header will have */ public void addValue(String name, String value) { List<String> list = getAll(name); if(value != null) { list.add(value); } }
/** * This can be used to add a HTTP message header to this object. * The name and value of the HTTP message header will be used to * create a HTTP message header object which can be retrieved using * the <code>getValue</code> in combination with the get methods. * * @param name the name of the HTTP message header to be added * @param value the value the HTTP message header will have */ public void addValue(String name, String value) { List<String> list = getAll(name); if(value != null) { list.add(value); } }
/** * This can be used to add a HTTP message header to this object. * The name and value of the HTTP message header will be used to * create a HTTP message header object which can be retrieved using * the <code>getValue</code> in combination with the get methods. * * @param name the name of the HTTP message header to be added * @param value the value the HTTP message header will have */ public void addValue(String name, String value) { List<String> list = getAll(name); if(value != null) { list.add(value); } }
/** * This can be used to get the value of the first message header * that has the specified name. This will return the full string * representing the named header value. If the named header does * not exist then this will return a null value. * * @param name the HTTP message header to get the value from * @param index this is the index to get the value from * * @return this returns the value that the HTTP message header */ public String getValue(String name, int index) { List<String> list = getAll(name); if(list.size() > index) { return list.get(index); } return null; }
/** * This can be used to get the value of the first message header * that has the specified name. This will return the full string * representing the named header value. If the named header does * not exist then this will return a null value. * * @param name the HTTP message header to get the value from * @param index this is the index to get the value from * * @return this returns the value that the HTTP message header */ public String getValue(String name, int index) { List<String> list = getAll(name); if(list.size() > index) { return list.get(index); } return null; }
/** * This can be used to get the value of the first message header * that has the specified name. This will return the full string * representing the named header value. If the named header does * not exist then this will return a null value. * * @param name the HTTP message header to get the value from * @param index this is the index to get the value from * * @return this returns the value that the HTTP message header */ public String getValue(String name, int index) { List<String> list = getAll(name); if(list.size() > index) { return list.get(index); } return null; }
/** * This can be used to get the values of HTTP message headers * that have the specified name. This is a convenience method that * will present that values as tokens extracted from the header. * This has obvious performance benefits as it avoids having to * deal with <code>substring</code> and <code>trim</code> calls. * <p> * The tokens returned by this method are ordered according to * there HTTP quality values, or "q" values, see RFC 2616 section * 3.9. This also strips out the quality parameter from tokens * returned. So "image/html; q=0.9" results in "image/html". If * there are no "q" values present then order is by appearance. * <p> * The result from this is either the trimmed header value, that * is, the header value with no leading or trailing whitespace * or an array of trimmed tokens ordered with the most preferred * in the lower indexes, so index 0 is has highest preference. * * @param name the name of the headers that are to be retrieved * * @return ordered list of tokens extracted from the header(s) */ public List<String> getValues(String name) { return getValues(getAll(name)); }
/** * This can be used to get the values of HTTP message headers * that have the specified name. This is a convenience method that * will present that values as tokens extracted from the header. * This has obvious performance benefits as it avoids having to * deal with <code>substring</code> and <code>trim</code> calls. * <p> * The tokens returned by this method are ordered according to * there HTTP quality values, or "q" values, see RFC 2616 section * 3.9. This also strips out the quality parameter from tokens * returned. So "image/html; q=0.9" results in "image/html". If * there are no "q" values present then order is by appearance. * <p> * The result from this is either the trimmed header value, that * is, the header value with no leading or trailing whitespace * or an array of trimmed tokens ordered with the most preferred * in the lower indexes, so index 0 is has highest preference. * * @param name the name of the headers that are to be retrieved * * @return ordered list of tokens extracted from the header(s) */ public List<String> getValues(String name) { return getValues(getAll(name)); }
/** * This can be used to get the values of HTTP message headers * that have the specified name. This is a convenience method that * will present that values as tokens extracted from the header. * This has obvious performance benefits as it avoids having to * deal with <code>substring</code> and <code>trim</code> calls. * <p> * The tokens returned by this method are ordered according to * there HTTP quality values, or "q" values, see RFC 2616 section * 3.9. This also strips out the quality parameter from tokens * returned. So "image/html; q=0.9" results in "image/html". If * there are no "q" values present then order is by appearance. * <p> * The result from this is either the trimmed header value, that * is, the header value with no leading or trailing whitespace * or an array of trimmed tokens ordered with the most preferred * in the lower indexes, so index 0 is has highest preference. * * @param name the name of the headers that are to be retrieved * * @return ordered list of tokens extracted from the header(s) */ public List<String> getValues(String name) { return getValues(getAll(name)); }
/** * This can be used to set a HTTP message header to this object. * The name and value of the HTTP message header will be used to * create a HTTP message header object which can be retrieved using * the <code>getValue</code> in combination with the get methods. * This will perform a <code>remove</code> using the issued header * name before the header value is set. * * @param name the name of the HTTP message header to be added * @param value the value the HTTP message header will have */ public void setValue(String name, String value) { List<String> list = getAll(name); if(value == null) { String token = name.toLowerCase(); values.remove(token); names.remove(token); } else { list.clear(); list.add(value); } }
/** * This can be used to set a HTTP message header to this object. * The name and value of the HTTP message header will be used to * create a HTTP message header object which can be retrieved using * the <code>getValue</code> in combination with the get methods. * This will perform a <code>remove</code> using the issued header * name before the header value is set. * * @param name the name of the HTTP message header to be added * @param value the value the HTTP message header will have */ public void setValue(String name, String value) { List<String> list = getAll(name); if(value == null) { String token = name.toLowerCase(); values.remove(token); names.remove(token); } else { list.clear(); list.add(value); } }
/** * This can be used to set a HTTP message header to this object. * The name and value of the HTTP message header will be used to * create a HTTP message header object which can be retrieved using * the <code>getValue</code> in combination with the get methods. * This will perform a <code>remove</code> using the issued header * name before the header value is set. * * @param name the name of the HTTP message header to be added * @param value the value the HTTP message header will have */ public void setValue(String name, String value) { List<String> list = getAll(name); if(value == null) { String token = name.toLowerCase(); values.remove(token); names.remove(token); } else { list.clear(); list.add(value); } }
/** * This is used to acquire all the individual header values from * the message. The header values provided by this are unparsed * and represent the actual string values that have been added to * the message keyed by a given header name. * * @param name the name of the header to get the values for * * @return this returns a list of the values for the header name */ public List<String> getAll(String name) { String token = name.toLowerCase(); Series series = values.get(token); if(series == null) { return getAll(name, token); } return series.getValues(); }
/** * This is used to acquire all the individual header values from * the message. The header values provided by this are unparsed * and represent the actual string values that have been added to * the message keyed by a given header name. * * @param name the name of the header to get the values for * * @return this returns a list of the values for the header name */ public List<String> getAll(String name) { String token = name.toLowerCase(); Series series = values.get(token); if(series == null) { return getAll(name, token); } return series.getValues(); }
/** * This is used to acquire all the individual header values from * the message. The header values provided by this are unparsed * and represent the actual string values that have been added to * the message keyed by a given header name. * * @param name the name of the header to get the values for * * @return this returns a list of the values for the header name */ public List<String> getAll(String name) { String token = name.toLowerCase(); Series series = values.get(token); if(series == null) { return getAll(name, token); } return series.getValues(); }