/** * Returns an existing or new {@link HttpVersion} instance which matches to * the specified protocol version string. If the specified {@code text} is * equal to {@code "HTTP/1.0"}, {@link #HTTP_1_0} will be returned. If the * specified {@code text} is equal to {@code "HTTP/1.1"}, {@link #HTTP_1_1} * will be returned. Otherwise, a new {@link HttpVersion} instance will be * returned. */ public static HttpVersion valueOf(String text) { if (text == null) { throw new NullPointerException("text"); } text = text.trim(); if (text.isEmpty()) { throw new IllegalArgumentException("text is empty (possibly HTTP/0.9)"); } // Try to match without convert to uppercase first as this is what 99% of all clients // will send anyway. Also there is a change to the RFC to make it clear that it is // expected to be case-sensitive // // See: // * http://trac.tools.ietf.org/wg/httpbis/trac/ticket/1 // * http://trac.tools.ietf.org/wg/httpbis/trac/wiki // HttpVersion version = version0(text); if (version == null) { version = new HttpVersion(text, true); } return version; }
/** * Returns an existing or new {@link HttpVersion} instance which matches to * the specified protocol version string. If the specified {@code text} is * equal to {@code "HTTP/1.0"}, {@link #HTTP_1_0} will be returned. If the * specified {@code text} is equal to {@code "HTTP/1.1"}, {@link #HTTP_1_1} * will be returned. Otherwise, a new {@link HttpVersion} instance will be * returned. */ public static HttpVersion valueOf(String text) { if (text == null) { throw new NullPointerException("text"); } text = text.trim(); if (text.isEmpty()) { throw new IllegalArgumentException("text is empty (possibly HTTP/0.9)"); } // Try to match without convert to uppercase first as this is what 99% of all clients // will send anyway. Also there is a change to the RFC to make it clear that it is // expected to be case-sensitive // // See: // * http://trac.tools.ietf.org/wg/httpbis/trac/ticket/1 // * http://trac.tools.ietf.org/wg/httpbis/trac/wiki // HttpVersion version = version0(text); if (version == null) { version = new HttpVersion(text, true); } return version; }
/** * Returns an existing or new {@link HttpVersion} instance which matches to * the specified protocol version string. If the specified {@code text} is * equal to {@code "HTTP/1.0"}, {@link #HTTP_1_0} will be returned. If the * specified {@code text} is equal to {@code "HTTP/1.1"}, {@link #HTTP_1_1} * will be returned. Otherwise, a new {@link HttpVersion} instance will be * returned. */ public static HttpVersion valueOf(String text) { if (text == null) { throw new NullPointerException("text"); } text = text.trim(); if (text.isEmpty()) { throw new IllegalArgumentException("text is empty (possibly HTTP/0.9)"); } // Try to match without convert to uppercase first as this is what 99% of all clients // will send anyway. Also there is a change to the RFC to make it clear that it is // expected to be case-sensitive // // See: // * http://trac.tools.ietf.org/wg/httpbis/trac/ticket/1 // * http://trac.tools.ietf.org/wg/httpbis/trac/wiki // HttpVersion version = version0(text); if (version == null) { version = new HttpVersion(text, true); } return version; }
/** * Returns an existing or new {@link HttpVersion} instance which matches to * the specified protocol version string. If the specified {@code text} is * equal to {@code "HTTP/1.0"}, {@link #HTTP_1_0} will be returned. If the * specified {@code text} is equal to {@code "HTTP/1.1"}, {@link #HTTP_1_1} * will be returned. Otherwise, a new {@link HttpVersion} instance will be * returned. */ public static HttpVersion valueOf(String text) { if (text == null) { throw new NullPointerException("text"); } text = text.trim(); if (text.isEmpty()) { throw new IllegalArgumentException("text is empty (possibly HTTP/0.9)"); } // Try to match without convert to uppercase first as this is what 99% of all clients // will send anyway. Also there is a change to the RFC to make it clear that it is // expected to be case-sensitive // // See: // * http://trac.tools.ietf.org/wg/httpbis/trac/ticket/1 // * http://trac.tools.ietf.org/wg/httpbis/trac/wiki // HttpVersion version = version0(text); if (version == null) { version = new HttpVersion(text, true); } return version; }
/** * Returns an existing or new {@link HttpVersion} instance which matches to * the specified protocol version string. If the specified {@code text} is * equal to {@code "HTTP/1.0"}, {@link #HTTP_1_0} will be returned. If the * specified {@code text} is equal to {@code "HTTP/1.1"}, {@link #HTTP_1_1} * will be returned. Otherwise, a new {@link HttpVersion} instance will be * returned. */ public static HttpVersion valueOf(String text) { if (text == null) { throw new NullPointerException("text"); } text = text.trim(); if (text.isEmpty()) { throw new IllegalArgumentException("text is empty (possibly HTTP/0.9)"); } // Try to match without convert to uppercase first as this is what 99% of all clients // will send anyway. Also there is a change to the RFC to make it clear that it is // expected to be case-sensitive // // See: // * http://trac.tools.ietf.org/wg/httpbis/trac/ticket/1 // * http://trac.tools.ietf.org/wg/httpbis/trac/wiki // HttpVersion version = version0(text); if (version == null) { version = new HttpVersion(text, true); } return version; }