Example usage for com.vaadin.server VaadinRequest getContextPath

List of usage examples for com.vaadin.server VaadinRequest getContextPath

Introduction

In this page you can find the example usage for com.vaadin.server VaadinRequest getContextPath.

Prototype

public String getContextPath();

Source Link

Document

Returns the portion of the request URI that indicates the context of the request.

Usage

From source file:org.vaadin.tori.ToriApiLoader.java

License:Apache License

private static String getToriThemeImagesURL(final VaadinRequest request) throws MalformedURLException {
    URL url = Page.getCurrent().getLocation().toURL();
    int port = url.getPort();

    if (url.getProtocol().equals("http") && port == 80) {
        port = -1;//  ww w .j a va 2s .c o  m
    } else if (url.getProtocol().equals("https") && port == 443) {
        port = -1;
    }

    URL serverURL = new URL(url.getProtocol(), url.getHost(), port, "");
    String contextPath = request.getContextPath();
    String imagesPath = "/VAADIN/themes/tori/images/";

    return serverURL + contextPath + imagesPath;

}