public HttpRequestParser(OptionMap options) { maxParameters = options.get(UndertowOptions.MAX_PARAMETERS, UndertowOptions.DEFAULT_MAX_PARAMETERS); maxHeaders = options.get(UndertowOptions.MAX_HEADERS, UndertowOptions.DEFAULT_MAX_HEADERS); allowEncodedSlash = options.get(UndertowOptions.ALLOW_ENCODED_SLASH, false); decode = options.get(UndertowOptions.DECODE_URL, true); charset = options.get(UndertowOptions.URL_CHARSET, StandardCharsets.UTF_8.name()); maxCachedHeaderSize = options.get(UndertowOptions.MAX_CACHED_HEADER_SIZE, UndertowOptions.DEFAULT_MAX_CACHED_HEADER_SIZE); this.allowUnescapedCharactersInUrl = options.get(UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL, false); }
@Override public void setUndertowOptions(final OptionMap undertowOptions) { if (undertowOptions == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("undertowOptions"); } this.undertowOptions = undertowOptions; statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false); parser = new AjpRequestParser(undertowOptions.get(URL_CHARSET, StandardCharsets.UTF_8.name()), undertowOptions.get(DECODE_URL, true), undertowOptions.get(UndertowOptions.MAX_PARAMETERS, UndertowOptions.DEFAULT_MAX_PARAMETERS), undertowOptions.get(UndertowOptions.MAX_HEADERS, UndertowOptions.DEFAULT_MAX_HEADERS), undertowOptions.get(UndertowOptions.ALLOW_ENCODED_SLASH, false), undertowOptions.get(UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL, false)); }
/** * Creates a file system watcher, that can be used to monitor file system changes. * * @param name The watcher name * @param options The options to use to create the watcher * @return The file system watcher */ public FileSystemWatcher createFileSystemWatcher(final String name, final OptionMap options) { int pollInterval = options.get(Options.WATCHER_POLL_INTERVAL, 5000); boolean daemonThread = options.get(Options.THREAD_DAEMON, true); return new PollingFileSystemWatcher(name, pollInterval, daemonThread); }
public AjpOpenListener(final ByteBufferPool pool, final OptionMap undertowOptions) { this.undertowOptions = undertowOptions; this.bufferPool = pool; PooledByteBuffer buf = pool.allocate(); this.bufferSize = buf.getBuffer().remaining(); buf.close(); parser = new AjpRequestParser(undertowOptions.get(URL_CHARSET, StandardCharsets.UTF_8.name()), undertowOptions.get(DECODE_URL, true), undertowOptions.get(UndertowOptions.MAX_PARAMETERS, UndertowOptions.DEFAULT_MAX_PARAMETERS), undertowOptions.get(UndertowOptions.MAX_HEADERS, UndertowOptions.DEFAULT_MAX_HEADERS), undertowOptions.get(UndertowOptions.ALLOW_ENCODED_SLASH, false), undertowOptions.get(UndertowOptions.ALLOW_UNESCAPED_CHARACTERS_IN_URL, false)); connectorStatistics = new ConnectorStatisticsImpl(); statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false); }
@Override public void setUndertowOptions(final OptionMap undertowOptions) { if (undertowOptions == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("undertowOptions"); } this.undertowOptions = undertowOptions; statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false); }
public static String getQueryParamEncoding(HttpServerExchange exchange) { String encoding = null; OptionMap undertowOptions = exchange.getConnection().getUndertowOptions(); if(undertowOptions.get(UndertowOptions.DECODE_URL, true)) { encoding = undertowOptions.get(UndertowOptions.URL_CHARSET, StandardCharsets.UTF_8.name()); } return encoding; } }
public AlpnOpenListener(ByteBufferPool bufferPool, OptionMap undertowOptions, String fallbackProtocol, DelegateOpenListener fallbackListener) { this.bufferPool = bufferPool; this.undertowOptions = undertowOptions; this.fallbackProtocol = fallbackProtocol; statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false); if (fallbackProtocol != null && fallbackListener != null) { addProtocol(fallbackProtocol, fallbackListener, 0); } }
@Override public void setUndertowOptions(OptionMap undertowOptions) { if (undertowOptions == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("undertowOptions"); } this.undertowOptions = undertowOptions; for (Map.Entry<String, ListenerEntry> delegate : listeners.entrySet()) { delegate.getValue().listener.setRootHandler(rootHandler); } statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false); }
private static void addSaslProperties(OptionMap optionMap, Option<Sequence<Property>> option, Map<String, Object> map) { final Sequence<Property> value = optionMap.get(option); if (value == null) return; for (Property current : value) { map.put(current.getKey(), current.getValue()); } } }
@Override public void setUndertowOptions(final OptionMap undertowOptions) { if (undertowOptions == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("undertowOptions"); } this.undertowOptions = undertowOptions; this.parser = HttpRequestParser.instance(undertowOptions); statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false); }
@Override public FileSystemWatcher createFileSystemWatcher(String name, OptionMap options) { try { boolean daemonThread = options.get(Options.THREAD_DAEMON, true); return new WatchServiceFileSystemWatcher(name, daemonThread); } catch (LinkageError e) { //ignore } return super.createFileSystemWatcher(name, options); }
private Map<String, String> getSaslProperties(final OptionMap optionMap) { Map<String, String> saslProperties = null; final Sequence<Property> value = optionMap.get(Options.SASL_PROPERTIES); if (value != null) { saslProperties = new HashMap<>(value.size()); for (Property property : value) { saslProperties.put(property.getKey(), (String) property.getValue()); } } return saslProperties; }
ServerConnectionOpenListener(final RemoteConnection connection, final ConnectionProviderContext connectionProviderContext, final SaslAuthenticationFactory saslAuthenticationFactory, final OptionMap optionMap) { this.connection = connection; this.connectionProviderContext = connectionProviderContext; this.saslAuthenticationFactory = saslAuthenticationFactory; this.optionMap = optionMap; if (optionMap.contains(RemotingOptions.SERVER_NAME)) { serverName = optionMap.get(RemotingOptions.SERVER_NAME); } else { serverName = InetUtils.determineServerName(connection.getLocalAddress().getHostName()); } }
public Http2OpenListener(final ByteBufferPool pool, final OptionMap undertowOptions, String protocol) { this.undertowOptions = undertowOptions; this.bufferPool = pool; PooledByteBuffer buf = pool.allocate(); this.bufferSize = buf.getBuffer().remaining(); buf.close(); connectorStatistics = new ConnectorStatisticsImpl(); statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_STATISTICS, false); this.protocol = protocol; }
/** * @return A mutable map of request cookies */ public Map<String, Cookie> getRequestCookies() { if (requestCookies == null) { requestCookies = Cookies.parseRequestCookies( getConnection().getUndertowOptions().get(UndertowOptions.MAX_COOKIES, 200), getConnection().getUndertowOptions().get(UndertowOptions.ALLOW_EQUALS_IN_COOKIE_VALUE, false), requestHeaders.get(Headers.COOKIE)); } return requestCookies; }
private FormEncodedDataParser(final String charset, final HttpServerExchange exchange) { this.exchange = exchange; this.charset = charset; this.data = new FormData(exchange.getConnection().getUndertowOptions().get(UndertowOptions.MAX_PARAMETERS, 1000)); }
public HttpOpenListener(final ByteBufferPool pool, final OptionMap undertowOptions) { this.undertowOptions = undertowOptions; this.bufferPool = pool; PooledByteBuffer buf = pool.allocate(); this.bufferSize = buf.getBuffer().remaining(); buf.close(); parser = HttpRequestParser.instance(undertowOptions); connectorStatistics = new ConnectorStatisticsImpl(); statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false); }
private boolean handleHttp2PriorKnowledge(PooledByteBuffer pooled, HttpServerExchange httpServerExchange) throws IOException { if(httpServerExchange.getRequestMethod().equals(PRI) && connection.getUndertowOptions().get(UndertowOptions.ENABLE_HTTP2, false)) { handleHttp2PriorKnowledge(connection.getChannel(), connection, pooled); return false; } else { sendBadRequestAndClose(connection.getChannel(), new IOException()); return true; } }
RemoteConnection(final StreamConnection connection, final SslChannel sslChannel, final OptionMap optionMap, final RemoteConnectionProvider remoteConnectionProvider) { this.connection = connection; this.messageReader = new MessageReader(connection.getSourceChannel(), writeListener.queue); this.sslChannel = sslChannel; this.optionMap = optionMap; heartbeatInterval = optionMap.get(RemotingOptions.HEARTBEAT_INTERVAL, RemotingOptions.DEFAULT_HEARTBEAT_INTERVAL); Messages.conn.tracef("Initialized connection from %s to %s with options %s", connection.getPeerAddress(), connection.getLocalAddress(), optionMap); this.executor = remoteConnectionProvider.getExecutor(); this.remoteConnectionProvider = remoteConnectionProvider; }
public static void addDateHeaderIfRequired(HttpServerExchange exchange) { HeaderMap responseHeaders = exchange.getResponseHeaders(); if (exchange.getConnection().getUndertowOptions().get(UndertowOptions.ALWAYS_SET_DATE, true) && !responseHeaders.contains(Headers.DATE)) { String dateString = getCurrentDateTime(exchange); responseHeaders.put(Headers.DATE, dateString); } }