Vaadin application init with params from URL

If it possible to make in VAADIN application class some sort of annotations like @RequestMapping(method = RequestMethod.GET, value = “{some value}”), with will allow start application with some params from URL.


@Configurable(preConstruction = true)
@RequestMapping(method = RequestMethod.GET, value = "{value}")
public class Application extends Application {

	@Override
	public void init(@PathVariable final Integer value) {
		System.out.println(value);

                Window window = new Window();
		setMainWindow(window);
	}

}

PS. Already read
URL parameters at application/window initialization
and
Vaadin steals all Url Patterns
.

Right now found workaround to solve this issue. First of all main application class should implements HttpServletRequestListener.


@Override
public void onRequestStart(final HttpServletRequest request, final HttpServletResponse response) {
	extractURLParameters(request);
	this.request = request;
}

private void extractURLParameters(HttpServletRequest request) {
	String appURL = null;
	String requestPath = null;
	StringBuffer currentURL = request.getRequestURL();

	//Remove this code if you use Spring in project
	if (this == null) {
		return;
	}
	if (request == null || request.getRequestURL() == null || request.getPathInfo() == null || currentURL == null) {
		return;
	}
	//If you use Spring in your project, better to use this code instead this one.
	/*
	try {
		Assert.notNull(this);
		Assert.notNull(request);
		Assert.notNull(request.getRequestURL());
		Assert.notNull(request.getPathInfo());
		Assert.notNull(currentURL);
	} catch (IllegalArgumentException e) {
			return;
	}
	*/

	appURL = StringUtils.substringBefore(currentURL.toString(), request.getPathInfo());
	requestPath = StringUtils.substringAfter(currentURL.toString(), appURL);
	requestPath = StringUtils.substringAfter(requestPath, "/");
	requestPath = StringUtils.trimToEmpty(requestPath);

	if (!StringUtils.isNotBlank(requestPath)) {
		return;
	}

	if (requestPath == null || requestPath.equals(Constant.UIDL)) {
		return;
	}

	String[] requestPathMap = requestPath.split("/");
	List<String> requestPathList = Arrays.asList(requestPathMap);
}