/** Convert alternate charset names (eg utf8) to normalized * name (eg UTF-8). * @param s the charset to normalize * @return the normalized charset (or null if normalized version not found) */ public static String normalizeCharset(String s) { String n=CHARSETS.get(s); return (n==null)?s:n; }
/** Add a form encoded HTTP Method * @param method HTTP Method of requests that can be decoded as * x-www-form-urlencoded content to be made available via the * {@link Request#getParameter(String)} and associated APIs */ public void addFormEncodedMethod(String method) { _formEncodedMethods.put(method,Boolean.TRUE); }
/** * Optimised lookup to find a method name and trailing space in a byte array. * @param buffer buffer containing ISO-8859-1 characters * @return A HttpMethod if a match or null if no easy match. */ public static HttpMethod lookAheadGet(ByteBuffer buffer) { if (buffer.hasArray()) return lookAheadGet(buffer.array(),buffer.arrayOffset()+buffer.position(),buffer.arrayOffset()+buffer.limit()); return CACHE.getBest(buffer,0,buffer.remaining()); }
/** Create a configuration from another. * @param config The configuration to copy. */ public HttpConfiguration(HttpConfiguration config) { _customizers.addAll(config._customizers); for (String s:config._formEncodedMethods.keySet()) _formEncodedMethods.put(s,Boolean.TRUE); _outputBufferSize=config._outputBufferSize; _outputAggregationSize=config._outputAggregationSize; _requestHeaderSize=config._requestHeaderSize; _responseHeaderSize=config._responseHeaderSize; _headerCacheSize=config._headerCacheSize; _secureScheme=config._secureScheme; _securePort=config._securePort; _blockingTimeout=config._blockingTimeout; _sendDateHeader=config._sendDateHeader; _sendServerVersion=config._sendServerVersion; _sendXPoweredBy=config._sendXPoweredBy; _delayDispatchUntilContent=config._delayDispatchUntilContent; _persistentConnectionsEnabled=config._persistentConnectionsEnabled; _maxErrorDispatches=config._maxErrorDispatches; }
@Override public O remove(Object pathSpec) { if (pathSpec!=null) { String spec=(String) pathSpec; if (spec.equals("/*")) _prefixDefault=null; else if (spec.endsWith("/*")) _prefixMap.remove(spec.substring(0,spec.length()-2)); else if (spec.startsWith("*.")) _suffixMap.remove(spec.substring(2)); else if (spec.equals(URIUtil.SLASH)) { _default=null; _defaultSingletonList=null; } else _exactMap.remove(spec); } return super.remove(pathSpec); }
/** * @return the set of HTTP methods of requests that can be decoded as * {@code x-www-form-urlencoded} content to be made available via the * {@link Request#getParameter(String)} and associated APIs */ public Set<String> getFormEncodedMethods() { return _formEncodedMethods.keySet(); }
/** * Optimised lookup to find a method name and trailing space in a byte array. * @param buffer buffer containing ISO-8859-1 characters * @return A HttpMethod if a match or null if no easy match. */ public static HttpMethod lookAheadGet(ByteBuffer buffer) { if (buffer.hasArray()) return lookAheadGet(buffer.array(),buffer.arrayOffset()+buffer.position(),buffer.arrayOffset()+buffer.limit()); return CACHE.getBest(buffer,0,buffer.remaining()); }
@Override public O remove(Object pathSpec) { if (pathSpec!=null) { String spec=(String) pathSpec; if (spec.equals("/*")) _prefixDefault=null; else if (spec.endsWith("/*")) _prefixMap.remove(spec.substring(0,spec.length()-2)); else if (spec.startsWith("*.")) _suffixMap.remove(spec.substring(2)); else if (spec.equals(URIUtil.SLASH)) { _default=null; _defaultSingletonList=null; } else _exactMap.remove(spec); } return super.remove(pathSpec); }
/** * @return Set of HTTP Methods of requests that can be decoded as * x-www-form-urlencoded content to be made available via the * {@link Request#getParameter(String)} and associated APIs */ public Set<String> getFormEncodedMethods() { return _formEncodedMethods.keySet(); }
/** Convert alternate charset names (eg utf8) to normalized * name (eg UTF-8). * @param s the charset to normalize * @param offset the offset in the charset * @param length the length of the charset in the input param * @return the normalized charset (or null if not found) */ public static String normalizeCharset(String s,int offset,int length) { String n=CHARSETS.get(s,offset,length); return (n==null)?s.substring(offset,offset+length):n; }