本文整理汇总了Java中com.google.gwt.user.client.Window.Location.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java Location.getPort方法的具体用法?Java Location.getPort怎么用?Java Location.getPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Window.Location
的用法示例。
在下文中一共展示了Location.getPort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUiSwitcherUrl
import com.google.gwt.user.client.Window.Location; //导入方法依赖的package包/类
private static String getUiSwitcherUrl(String token) {
UrlBuilder builder = new UrlBuilder();
builder.setProtocol(Location.getProtocol());
builder.setHost(Location.getHost());
String port = Location.getPort();
if (port != null && !port.isEmpty()) {
builder.setPort(Integer.parseInt(port));
}
String[] tokens = token.split("@", 2);
if (Location.getPath().endsWith("/") && tokens[0].startsWith("/")) {
tokens[0] = tokens[0].substring(1);
}
builder.setPath(Location.getPath() + tokens[0]);
if (tokens.length == 2) {
builder.setHash(tokens[1]);
}
builder.setParameter("polygerrit", "1");
return builder.buildString();
}
示例2: selfRedirect
import com.google.gwt.user.client.Window.Location; //导入方法依赖的package包/类
public static String selfRedirect(String suffix) {
// Clean up the path. Users seem to like putting extra slashes into the URL
// which can break redirections by misinterpreting at either client or server.
String path = Location.getPath();
if (path == null || path.isEmpty()) {
path = "/";
} else {
while (path.startsWith("//")) {
path = path.substring(1);
}
while (path.endsWith("//")) {
path = path.substring(0, path.length() - 1);
}
if (!path.endsWith("/")) {
path = path + "/";
}
}
if (suffix != null) {
while (suffix.startsWith("/")) {
suffix = suffix.substring(1);
}
path += suffix;
}
UrlBuilder builder = new UrlBuilder();
builder.setProtocol(Location.getProtocol());
builder.setHost(Location.getHost());
String port = Location.getPort();
if (port != null && !port.isEmpty()) {
builder.setPort(Integer.parseInt(port));
}
builder.setPath(path);
return builder.buildString();
}
示例3: addProjectLink
import com.google.gwt.user.client.Window.Location; //导入方法依赖的package包/类
private static LinkMenuItem addProjectLink(LinkMenuBar m, TopMenuItem item) {
LinkMenuItem i =
new ProjectLinkMenuItem(item.getName(), item.getUrl()) {
@Override
protected void onScreenLoad(Project.NameKey project) {
String p = panel.replace(PROJECT_NAME_MENU_VAR, URL.encodeQueryString(project.get()));
if (!panel.startsWith("/x/") && !isAbsolute(panel)) {
UrlBuilder builder = new UrlBuilder();
builder.setProtocol(Location.getProtocol());
builder.setHost(Location.getHost());
String port = Location.getPort();
if (port != null && !port.isEmpty()) {
builder.setPort(Integer.parseInt(port));
}
builder.setPath(Location.getPath());
p = builder.buildString() + p;
}
getElement().setPropertyString("href", p);
}
@Override
public void go() {
String href = getElement().getPropertyString("href");
if (href.startsWith("#")) {
super.go();
} else {
Window.open(href, getElement().getPropertyString("target"), "");
}
}
};
if (item.getTarget() != null && !item.getTarget().isEmpty()) {
i.getElement().setAttribute("target", item.getTarget());
}
if (item.getId() != null) {
i.getElement().setAttribute("id", item.getId());
}
m.addItem(i);
return i;
}
示例4: getPlaceUrl
import com.google.gwt.user.client.Window.Location; //导入方法依赖的package包/类
public String getPlaceUrl( Place place )
{
String token = placeTokenizer.getToken( place );
return Location.getProtocol() + "//" + Location.getHost() + Location.getPort() + Location.getPath() + Location.getQueryString() + "#" + token;
}