List of usage examples for com.google.gwt.http.client UrlBuilder PORT_UNSPECIFIED
int PORT_UNSPECIFIED
To view the source code for com.google.gwt.http.client UrlBuilder PORT_UNSPECIFIED.
Click Source Link
From source file:org.pentaho.mantle.client.ui.tabs.MantleTab.java
License:Open Source License
public void createDeepLink() { if (getContent() instanceof IFrameTabPanel) { PromptDialogBox dialogBox = new PromptDialogBox(Messages.getString("deepLink"), //$NON-NLS-1$ Messages.getString("ok"), Messages.getString("cancel"), false, //$NON-NLS-1$ //$NON-NLS-2$ true);/*from ww w. j ava 2 s. com*/ String startup = ((IFrameTabPanel) getContent()).getUrl(); if (!StringUtils.isEmpty(((IFrameTabPanel) getContent()).getDeepLinkUrl())) { startup = ((IFrameTabPanel) getContent()).getDeepLinkUrl(); } UrlBuilder builder = new UrlBuilder(); builder.setProtocol(Window.Location.getProtocol()); builder.setHost(Window.Location.getHostName()); try { builder.setPort(Integer.parseInt(Window.Location.getPort())); } catch (NumberFormatException e) { builder.setPort(UrlBuilder.PORT_UNSPECIFIED); } builder.setPath(Window.Location.getPath()); //UrlBuilder will encode spaces as '+' which is a valid special character so we replace all spaces with '%20' builder.setParameter("name", getLabelText().replaceAll("\\s", "%20")); //the startup string is already encoded with ':' being replaced with '\t' and then encoded again... builder.setParameter("startup-url", startup); final TextArea urlbox = new TextArea(); //encode any space characters urlbox.setText(builder.buildString()); urlbox.setReadOnly(true); urlbox.setVisibleLines(3); dialogBox.setContent(urlbox); urlbox.setHeight("80px"); urlbox.setWidth("600px"); urlbox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { urlbox.selectAll(); } }); dialogBox.center(); urlbox.selectAll(); } }