[exo-jcr-commits] exo-jcr SVN: r3405 - ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Nov 8 03:43:43 EST 2010
Author: aparfonov
Date: 2010-11-08 03:43:42 -0500 (Mon, 08 Nov 2010)
New Revision: 3405
Modified:
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
Log:
EXOJCR-1037
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2010-11-08 07:42:28 UTC (rev 3404)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2010-11-08 08:43:42 UTC (rev 3405)
@@ -90,14 +90,15 @@
/**
* Comparator for tokens which have quality value.
- * @see QualityValue
+ *
+ * @see QualityValue
*/
public static final Comparator<QualityValue> QUALITY_VALUE_COMPARATOR = new Comparator<QualityValue>()
{
/**
* Compare two QualityValue for order.
- *
+ *
* @param o1 first QualityValue to be compared
* @param o2 second QualityValue to be compared
* @return result of comparison
@@ -121,6 +122,7 @@
/**
* Accept media type producer.
+ *
* @see ListHeaderProducer
*/
private static final ListHeaderProducer<AcceptMediaType> LIST_MEDIA_TYPE_PRODUCER =
@@ -140,7 +142,7 @@
/**
* Create sorted by quality value accepted media type list.
- *
+ *
* @param header source header string
* @return List of AcceptMediaType
*/
@@ -154,6 +156,7 @@
/**
* Accept language producer.
+ *
* @see ListHeaderProducer
*/
private static final ListHeaderProducer<AcceptLanguage> LIST_LANGUAGE_PRODUCER =
@@ -173,7 +176,7 @@
/**
* Create sorted by quality value accepted language list.
- *
+ *
* @param header source header string
* @return List of AcceptLanguage
*/
@@ -186,8 +189,9 @@
}
/**
- * Accept token producer. Useful for processing
- * 'accept-charset' and 'accept-encoding' request headers.
+ * Accept token producer. Useful for processing 'accept-charset' and
+ * 'accept-encoding' request headers.
+ *
* @see ListHeaderProducer
*/
private static final ListHeaderProducer<AcceptToken> LIST_TOKEN_PRODUCER = new ListHeaderProducer<AcceptToken>()
@@ -226,7 +230,7 @@
/**
* Create sorted by quality value 'accept-character' list.
- *
+ *
* @param header source header string
* @return List of accept charset tokens
*/
@@ -240,7 +244,7 @@
/**
* Create sorted by quality value 'accept-encoding' list.
- *
+ *
* @param header source header string
* @return List of accept encoding tokens
*/
@@ -261,7 +265,7 @@
{
/**
- * Cookie name.
+ * Cookie name.
*/
String name;
@@ -322,7 +326,7 @@
/**
* Parse cookie header string and create collection of cookie from it.
- *
+ *
* @param cookie the cookie string.
* @return collection of Cookie.
*/
@@ -366,7 +370,7 @@
if (name.indexOf('$') == -1)
{
- // first save previous cookie
+ // first save previous cookie
if (temp != null)
l.add(new Cookie(temp.name, temp.value, temp.path, temp.domain, temp.version));
@@ -462,10 +466,10 @@
/**
* Parse date header. Will try to found appropriated format for given date
- * header. Format can be one of see {@link <a
- * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1"
- * >HTTP/1.1 documentation</a>}.
- *
+ * header. Format can be one of see
+ * {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1" >HTTP/1.1 documentation</a>}
+ * .
+ *
* @param header source date header
* @return parsed Date
*/
@@ -478,9 +482,9 @@
}
catch (ParseException e)
{
- // ignore all ParseException now
+ // ignore all ParseException now
}
- // no one format was found
+ // no one format was found
throw new IllegalArgumentException("Not found appropriated date format for " + header);
}
@@ -488,7 +492,8 @@
/**
* @param httpHeaders HTTP headers
- * @return parsed content-length or null if content-length header is not specified
+ * @return parsed content-length or null if content-length header is not
+ * specified
*/
public static long getContentLengthLong(MultivaluedMap<String, String> httpHeaders)
{
@@ -500,7 +505,7 @@
/**
* Create string representation of Java Object for adding to response. Method
* use {@link HeaderDelegate#toString()}.
- *
+ *
* @param o HTTP header as Java type.
* @return string representation of supplied type
*/
@@ -508,14 +513,14 @@
public static String getHeaderAsString(Object o)
{
HeaderDelegate hd = RuntimeDelegate.getInstance().createHeaderDelegate(o.getClass());
- return hd.toString(o);
+ return hd != null ? hd.toString(o) : o.toString();
}
/**
- * Convert Collection<String> to single String, where values separated by ','.
- * Useful for getting source string of HTTP header for next processing quality
- * value of header tokens.
- *
+ * Convert Collection<String> to single String, where values separated
+ * by ','. Useful for getting source string of HTTP header for next
+ * processing quality value of header tokens.
+ *
* @param collection the source list
* @return String result
*/
@@ -540,7 +545,7 @@
/**
* Append string in given string buffer, if string contains quotes or
* whitespace, then it be escaped.
- *
+ *
* @param sb string buffer
* @param s string
*/
@@ -564,7 +569,7 @@
/**
* Append string in given string buffer, quotes will be escaped.
- *
+ *
* @param sb string buffer
* @param s string
*/
@@ -581,7 +586,7 @@
/**
* Remove all whitespace from given string.
- *
+ *
* @param s the source string
* @return the result string
*/
@@ -597,7 +602,7 @@
/**
* Add quotes to <code>String</code> if it consists whitespaces, otherwise
* <code>String</code> will be returned without changes.
- *
+ *
* @param s the source string.
* @return new string.
*/
@@ -614,7 +619,7 @@
/**
* Check syntax of quality value and parse it. Quality value must have not
* more then 5 characters and be not more then 1 .
- *
+ *
* @param qstring string representation of quality value
* @return quality value
*/
@@ -633,7 +638,7 @@
/**
* Check is given string token. Token may contains only US-ASCII characters
* except separators, {@link #SEPARTORS} and controls.
- *
+ *
* @param token the token
* @return -1 if string has only valid character otherwise index of first
* wrong character
@@ -654,7 +659,7 @@
* The cookies parameters can be separated by ';' or ',', try to find first
* available separator in cookie string. If both not found the string length
* will be returned.
- *
+ *
* @param cookie the cookie string.
* @param start index for start searching.
* @return the index of ',' or ';'.
@@ -683,7 +688,7 @@
* <p>
* String \"hello \\\"someone\\\"\" will be changed to hello \"someone\"
* </p>
- *
+ *
* @param token token for processing
* @return result
*/
More information about the exo-jcr-commits
mailing list