com.vaadin.shared.ApplicationConstants Java Examples

The following examples show how to use com.vaadin.shared.ApplicationConstants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SockJSPushConnection.java    From vertx-vaadin with MIT License 6 votes vote down vote up
private void connect() {
    String baseUrl = connection.translateVaadinUri(url);
    String extraParams = UIConstants.UI_ID_PARAMETER + "="
        + connection.getConfiguration().getUIId();

    String pushId = connection.getMessageHandler().getPushId();
    if (pushId != null) {
        extraParams += "&" + ApplicationConstants.PUSH_ID_PARAMETER + "="
            + pushId;
    }

    // uri is needed to identify the right connection when closing
    uri = SharedUtil.addGetParameters(baseUrl, extraParams);

    getLogger().info("Establishing push connection");
    socket = doConnect(uri, getConfig());
}
 
Example #2
Source File: VaadinAccessDeniedHandler.java    From jdal with Apache License 2.0 6 votes vote down vote up
/**
 * Test if current request is an UIDL request
 * @return true if in UIDL request, false otherwise
 */
private boolean isUidlRequest() {
	VaadinRequest request = VaadinService.getCurrentRequest();
	
	if (request == null)
		return false;
	
	 String pathInfo = request.getPathInfo();

	 if (pathInfo == null) {
            return false;
	 }
	 
	 if (pathInfo.startsWith("/" + ApplicationConstants.UIDL_PATH)) {
            return true;
        }

        return false;
}
 
Example #3
Source File: SockJSPushConnection.java    From vertx-vaadin with MIT License 5 votes vote down vote up
@Override
public void init(ApplicationConnection connection, UIState.PushConfigurationState pushConfiguration) {
    this.connection = connection;

    connection.addHandler(ApplicationConnection.ApplicationStoppedEvent.TYPE,
        event -> {
            if (state == State.CLOSING
                || state == State.CLOSED) {
                return;
            }

            disconnect(() -> {
            });
        });

    config = createConfig();
    String debugParameter = Window.Location.getParameter("debug");
    if ("push".equals(debugParameter)) {
        config.setStringValue("logLevel", "debug");
    }
    for (String param : pushConfiguration.parameters.keySet()) {
        String value = pushConfiguration.parameters.get(param);
        if (value.equalsIgnoreCase("true")
            || value.equalsIgnoreCase("false")) {
            config.setBooleanValue(param, value.equalsIgnoreCase("true"));
        } else {
            config.setStringValue(param, value);
        }
    }
    config.mapTransports();
    if (pushConfiguration.pushUrl != null) {
        url = pushConfiguration.pushUrl;
    } else {
        url = ApplicationConstants.APP_PROTOCOL_PREFIX
            + ApplicationConstants.PUSH_PATH;
    }
    runWhenSockJSLoaded(
        () -> Scheduler.get().scheduleDeferred(this::connect));

}
 
Example #4
Source File: CubaApplicationServlet.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected boolean hasUidlPathPrefix(HttpServletRequest request) {
    String pathInfo = request.getPathInfo();
    if (pathInfo == null) {
        return false;
    }

    String prefix = '/' + ApplicationConstants.UIDL_PATH + '/';

    return pathInfo.startsWith(prefix);
}