/** * Returns the {@link HttpMethod} represented by the specified name. * If the specified name is a standard HTTP method name, a cached instance * will be returned. Otherwise, a new instance will be returned. */ public static HttpMethod valueOf(String name) { if (name == null) { throw new NullPointerException("name"); } name = name.trim(); if (name.length() == 0) { throw new IllegalArgumentException("empty name"); } HttpMethod result = methodMap.get(name); if (result != null) { return result; } else { return new HttpMethod(name); } }
/** * Returns the {@link HttpMethod} represented by the specified name. * If the specified name is a standard RTSP method name, a cached instance * will be returned. Otherwise, a new instance will be returned. */ public static HttpMethod valueOf(String name) { if (name == null) { throw new NullPointerException("name"); } name = name.trim().toUpperCase(); if (name.length() == 0) { throw new IllegalArgumentException("empty name"); } HttpMethod result = methodMap.get(name); if (result != null) { return result; } else { return new HttpMethod(name); } }
HttpRequest nettyRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, new HttpMethod(request.getMethod()), pathBuilder.toString());