getProtocol()が必要です

マルコ

Vaadinでプロトコル(httpまたはhttps)を取得する方法はありますか?ホストとポートを取得できますが、プロトコルも必要です。

import com.vaadin.ui.UI;

[...]

UI.getCurrent().getPage().getLocation().getHost();
UI.getCurrent().getPage().getLocation().getPort();

だから私は次のようなものが必要です:

UI.getCurrent().getPage().getLocation().getProtocol();
モーフィック

あなたはほとんどそこにいます:-)

System.out.println("Scheme=[" + Page.getCurrent().getLocation().getScheme() + "]");

スキーム= [http]


以下のAndreとの話し合いに従って、さらにオプションを追加します。

public class MyVaadinUI extends UI {

    protected void init(VaadinRequest request) {
        System.out.println("Location scheme=[" + Page.getCurrent().getLocation().getScheme() + "]");
        System.out.println("Web browser isSecureConnection=[" + Page.getCurrent().getWebBrowser().isSecureConnection() + "]");
        System.out.println("Request isSecure=[" + request.isSecure()+"]");
    }
}

ロケーションスキーム= [http]
WebブラウザisSecureConnection = [false]
リクエストisSecure = [false]

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事