/* * Copyright 2000-2018 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.server; import java.util.ArrayList; import java.util.Collections; import java.util.EventObject; import java.util.List; import java.util.Objects; /** * Event fired to {@link VaadinServiceInitListener} when a {@link VaadinService} * is being initialized. *
* This event can also be used to add {@link RequestHandler}s that will be used
* by the {@code VaadinService} for handling all requests.
*
* @since 8.0
* @author Vaadin Ltd
*/
public class ServiceInitEvent extends EventObject {
private Listnull
*/
public void addRequestHandler(RequestHandler requestHandler) {
Objects.requireNonNull(requestHandler,
"Request handler cannot be null");
addedRequestHandlers.add(requestHandler);
}
/**
* Gets an unmodifiable list of all custom request handlers that have been
* added for the service.
*
* @return the current list of added request handlers
*/
public Listnull
*
* @since 8.1
*/
public void addDependencyFilter(DependencyFilter dependencyFilter) {
Objects.requireNonNull(dependencyFilter,
"Dependency filter cannot be null");
addedDependencyFilters.add(dependencyFilter);
}
/**
* Gets an unmodifiable list of all dependency filters that have been added
* for the service.
*
* @return the current list of added dependency filters.
*
* @since 8.1
*/
public Listnull
*
* @since 8.1
*/
public void addConnectorIdGenerator(
ConnectorIdGenerator connectorIdGenerator) {
Objects.requireNonNull(connectorIdGenerator,
"Connector id generator cannot be null");
/*
* We're collecting all generators so that a custom service
* implementation can pick which one to use even though the default
* implementation throws if there are more than one.
*/
addedConnectorIdGenerators.add(connectorIdGenerator);
}
/**
* Gets an unmodifiable list of all connector id generators that have been
* added for the service.
*
* @return the current list of added connector id generators
*
* @since 8.1
*/
public List