我目前正在使用:
String url = Page.getCurrent().getLocation().toString();
在url
的地址栏中获取vaadin app
。但问题是该应用程序已从www.mywebsite.freehost.com
重定向到www.mywebsite.com
,而我正在使用的代码正在获取wrong url
。它正在获得old url
。
我需要重定向的网址。 我该怎么做?有谁知道吗?
编辑:我在openshift上托管我的Vaadin应用程序,在不同的Web主机上托管我的html网站。我正在将vaadin应用程序重定向到login.mywebsite.com。但是我没有获取URL login.mywebsite.com,而是获取了openshift提供的URL。我该如何解决这个问题?
答案 0 :(得分:0)
此代码将在浏览器地址栏中为您提供服务器名称。
String url = ((VaadinServletRequest) VaadinService.getCurrentRequest()).getServerName();
答案 1 :(得分:0)
尝试一下:
public class HorizontalCollectionViewLayout : UICollectionViewFlowLayout { [YOUR CLASS] }
(字符串中的请求网址)
HttpServletRequest httpServletRequest = ((VaadinServletRequest)VaadinService.getCurrentRequest()).getHttpServletRequest();