Java Code Examples for com.google.gwt.http.client.URL

The following are top voted examples for showing how to use com.google.gwt.http.client.URL. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: unitimes   File: UserAuthentication.java   Source Code and License 6 votes vote down vote up
public void authenticate() {
	if (!CONSTANTS.allowUserLogin()) {
		if (isAllowLookup())
			doLookup();
		else
			ToolBox.open(GWT.getHostPageBaseURL() + "login.do?target=" + URL.encodeQueryString(Window.Location.getHref()));
		return;
	}
	AriaStatus.getInstance().setText(ARIA.authenticationDialogOpened());
	iError.setVisible(false);
	iDialog.center();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iUserName.selectAll();
			iUserName.setFocus(true);
		}
	});
}
 
Example 2
Project: sig-seguimiento-vehiculos   File: OpenProjectDialog.java   Source Code and License 6 votes vote down vote up
private SelectHandler createUrlToShare(final VerticalPanel geoDataContainer) {
	return new SelectHandler() {
		@Override
		public void onSelect(SelectEvent event) {
			urlToShareAnchor.setHref(getHref());
			urlToShareAnchor.setText(
					UIMessages.INSTANCE.seeOtherWindow("GeoWE Project"),
					Direction.LTR);

			urlShared.setText(getHref());
			urlPanel.setVisible(true);
			urlShared.setVisible(true);
		}

		private String getHref() {
			String baseUrl = GWT.getHostPageBaseURL();

			baseUrl += "?projectUrl="
					+ URL.encodeQueryString(urlTextField.getValue());

			return baseUrl;
		}
	};
}
 
Example 3
Project: sig-seguimiento-vehiculos   File: WfsVectorLayerDef.java   Source Code and License 6 votes vote down vote up
private String createWfsUrl() {
	StringBuffer url = new StringBuffer(serviceUrl);
	url.append("?request=GetFeature");
	url.append("&service=WFS");
	url.append("&version=" + version);
	url.append("&typeName=" + nameSpaceFeatureType);
	if (maxFeatures != 0) {
		url.append(getMaxFeaturesLimit());
	}
	if (!getFormat().isEmpty()) {
		url.append(getOutputFormat());
	}
	if (queryBbox) {
		url.append("&srsName=" + getEpsg());
		url.append("&bbox=" + bbox.getLowerLeftX() + ","
				+ bbox.getLowerLeftY() + "," + bbox.getUpperRightX() + ","
				+ bbox.getUpperRightY());
	} else {
		url.append("&CQL_FILTER=" + URL.encodeQueryString(cql));
	}
	return url.toString();
}
 
Example 4
Project: WebConsole   File: JSONPControllerConnector.java   Source Code and License 6 votes vote down vote up
private static String buildCompleteJsonUrl(String controllerUrl, String[] params, EnumControllerCommand command) {
	String url = controllerUrl;
	int paramCounter = 0;
	url = url.endsWith("/") ? url : url + "/";
	String methodUrl = getJsonMethodUrl(command);
	
	if (methodUrl.equals("")) {
		return "";
	} else {
		url += methodUrl;
	}		
	
	for (String param : params) {
		url += param;
		paramCounter++;
		if (paramCounter < params.length) {
			url = url.endsWith("/") ? url : url + "/";
		}
	}
	url = URL.encode(url);
	return url;
}
 
Example 5
Project: WebConsole   File: JSONControllerConnector.java   Source Code and License 6 votes vote down vote up
private static String buildCompleteJsonUrl(String controllerUrl, String[] params, EnumControllerCommand command) {
	String url = controllerUrl;
	int paramCounter = 0;
	url = url.endsWith("/") ? url : url + "/";
	String methodUrl = getJsonMethodUrl(command);
	
	if (methodUrl.equals("")) {
		return "";
	} else {
		url += methodUrl;
	}		
	
	for (String param : params) {
		url += param;
		paramCounter++;
		if (paramCounter < params.length) {
			url = url.endsWith("/") ? url : url + "/";
		}
	}
	
	url = URL.encode(url);
	return url;
}
 
Example 6
Project: LAS   File: CruiseIconWidget.java   Source Code and License 6 votes vote down vote up
public void init(LASRequest request, String cruiseid) {
  	message.setVisible(false);
  	request.setOperation("Cruise_List", "v7");
  	List<Map<String, String>> c = request.getVariableConstraints();
  	for (Iterator cIt = c.iterator(); cIt.hasNext();) {
	Map<String, String> map = (Map<String, String>) cIt.next();
	String varid = map.get("varID");
	if ( varid.equals(cruiseid)) {
		
	} else {
		
	}
}
String url = Util.getProductServer()+"?xml="+URL.encode(request.toString());
  	RequestBuilder sendRequest = new RequestBuilder(RequestBuilder.GET, UriUtils.sanitizeUri(url));
try {
	sendRequest.sendRequest(null, iconListRequestCallback);
} catch (RequestException e) {
	message.setVisible(true);
	message.setHTML("Unable to icon list");
}
  }
 
Example 7
Project: LAS   File: ClimateAnalysis.java   Source Code and License 6 votes vote down vote up
@Override
public void onClick(ClickEvent event) {
	if ( xSecondID.equals(xInitialId) ) {
		Window.alert("Please select a second data set.");
	} else if ( xSecondVarID.equals(xInitialId) ) {
		Window.alert("Second variable not set, try again in a moment.");
	} else {
		set.clear();
		lasRequest = new LASRequest();
		lasRequest.setOperation("Climate_Analysis_Plot", "V7");
		lasRequest.addVariable(xFirstID, xFirstVarID, 0);
		lasRequest.addVariable(xSecondID, xSecondVarID, 0);
		lasRequest.setRange("t", xDateWidget.getFerretDateLo(), xDateWidget.getFerretDateHi(), 0);
		lasRequest.setRange("t", xDateWidgetTwo.getFerretDateLo(), xDateWidgetTwo.getFerretDateHi(), 1);
		String type = xAnalysisType.getValue(xAnalysisType.getSelectedIndex());
		lasRequest.setProperty("climate_analysis", "type", type);
		List<String> activeRegions = xRegions.getActiveVariablesAndRegions();
		for (Iterator arIt = activeRegions.iterator(); arIt.hasNext();) {
			String ar = (String) arIt.next();
			lasRequest.setProperty("climate_analysis_regions", type+"_region_"+ar, ar);
		}
		Window.open(Util.getProductServer()+"?xml="+URL.encode(lasRequest.toString()), "_blank", Constants.WINDOW_FEATURES);
	}
}
 
Example 8
Project: LAS   File: Util.java   Source Code and License 6 votes vote down vote up
public static HashMap<String, String> getTokenMap(String token) {
    token = URL.decode(token);
	String[] tokens = token.split(";");
	HashMap<String, String> tokenMap = new HashMap<String, String>();
	for( int i=0; i < tokens.length; i++ ) {
		if ( tokens[i].contains("=") ) {
			String[] parts = tokens[i].split("=");
			String name = parts[0];
			String value = parts[1];
			if ( !value.contains("ferret_") ) {
				tokenMap.put(name, value);
			}
		}
	}
	return tokenMap;
}
 
Example 9
Project: mentor   File: TokenParser.java   Source Code and License 6 votes vote down vote up
public TokenParser(String token) {
	
	String[] tokens = token.split("\\" + TokenConstants.FilterMainSeparator, 2);
	
	primaryToken = URL.decode(tokens[0]);
	
	if (tokens.length > 1) {
		filters = new HashMap<String, String>();
		String[] filterComponents = tokens[1].split("\\" + TokenConstants.FilterSeparator, 0);
		for (String filter : filterComponents) {
			String[] keyValue = filter.split("\\" + TokenConstants.FilterKeyValueSeparator, 2);
			if (keyValue.length != 2)
				continue;
			filters.put(URL.decode(keyValue[0]), URL.decode(keyValue[1]));
		}
	} else {
		filters = null;
	}
	
}
 
Example 10
Project: document-management-system   File: FindDocumentSelectPopup.java   Source Code and License 6 votes vote down vote up
/**
 * addDocument
 */
private void addDocumentToWikiEditor() {
	if (selectedRow >= 0) {
		String uuid = documentTable.getText(selectedRow, 2);
		String name = UtilComunicator.getName(documentTable.getText(selectedRow, 1));

		switch (type) {
			case FIND_DOCUMENT:
				Wiki.get().addDocumentTag(uuid, name);
				break;

			case FIND_IMAGE:
				String url = RPCService.DownloadServlet;
				url += "?uuid=" + URL.encodeQueryString(uuid);
				Wiki.get().addImageTag(url, getParameters());
				break;
		}
	}
}
 
Example 11
Project: document-management-system   File: FindDocumentSelectPopup.java   Source Code and License 6 votes vote down vote up
/**
 * addDocument
 */
private void addDocumentToHTMLEditor() {
	if (selectedRow >= 0) {
		String uuid = documentTable.getText(selectedRow, 2);
		String name = UtilComunicator.getName(documentTable.getText(selectedRow, 1));

		switch (type) {
			case FIND_DOCUMENT:
				addDocumentHTMLEditor(uuid, name);
				break;

			case FIND_IMAGE:
				String downloadServletName = RPCService.DownloadServlet.substring(RPCService.DownloadServlet.lastIndexOf("/") + 1);
				String url = "./" + downloadServletName;
				url += "?uuid=" + URL.encodeQueryString(uuid);
				addImageHTMLEditor(url, getParameters());
				break;
		}
	}
}
 
Example 12
Project: document-management-system   File: Util.java   Source Code and License 6 votes vote down vote up
/**
 * Download files exported as zip
 *
 * @author danilo
 */
@Deprecated
public static void downloadFiles(List<String> path, String params) {
	if (!params.equals("")) {
		params = "&" + params;
	}

	final Element downloadIframe = RootPanel.get("__download").getElement();
	String url = RPCService.DownloadServlet + "?export" + params;

	for (String p : path) {
		url += "&pathList=" + URL.encodeQueryString(p);
	}

	DOM.setElementAttribute(downloadIframe, "src", url);
}
 
Example 13
Project: document-management-system   File: Location.java   Source Code and License 6 votes vote down vote up
protected void setQueryString(String queryString) {
	this.queryString = queryString;
	paramMap = new HashMap<String, String>();

	if (queryString != null && queryString.length() > 1) {
		String qs = queryString.substring(1);
		String[] kvPairs = qs.split("&");
		for (int i = 0; i < kvPairs.length; i++) {
			String[] kv = kvPairs[i].split("=");
			if (kv.length > 1) {
				paramMap.put(kv[0], URL.decodeQueryString(kv[1]));
			} else {
				paramMap.put(kv[0], "");
			}
		}
	}
}
 
Example 14
Project: document-management-system   File: Preview.java   Source Code and License 6 votes vote down vote up
/**
 * showEmbedPDF
 *
 * @param uuid Unique document ID to be previewed.
 */
public void showEmbedPDF(String uuid) {
	hideWidgetExtension();
	vPanel.clear();

	if (previewEvent != null) {
		vPanel.add(hReturnPanel);
		vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT) + "px");
	}

	vPanel.add(pdf);
	vPanel.setCellHorizontalAlignment(pdf, HasAlignment.ALIGN_CENTER);
	vPanel.setCellVerticalAlignment(pdf, HasAlignment.ALIGN_MIDDLE);

	if (previewAvailable) {
		String url = RPCService.DownloadServlet + "?inline=true&uuid=" + URL.encodeQueryString(uuid);
		pdf.setHTML("<div id=\"pdfembededcontainer\">" +
				"<object id=\"" + pdfID + "\" name=\"" + pdfID + "\" width=\"" + width + "\" height=\"" + height + "\" type=\"application/pdf\" data=\"" + url + "\"&#zoom=85&scrollbar=1&toolbar=1&navpanes=1&view=FitH\">" +
				"<p>Browser plugin suppport error, PDF can not be displayed</p>" +
				"</object>" +
				"</div>\n"); // needed for rewriting  purpose
	} else {
		swf.setHTML("<div id=\"pdfembededcontainer\" align=\"center\"><br><br>" + Main.i18n("preview.unavailable") + "</div>\n");
	}
}
 
Example 15
Project: social-analytics   File: SearchView.java   Source Code and License 6 votes vote down vote up
/**
 * Constructs a url for searching tweets
 *
 * the url has the form:
 *
 *  HOST_URL/search/:text/:screenName/:collection/:fromYear/:fromMonth/:fromDay/:toYear/:toMonth/:toDay/:page
 *
 * @param e
 * @return
 */
private static String getUrl(SearchEvent e){

    searchText = e.getSearchText();

    searchText = URL.encodePathSegment(searchText);

    url = Consts.HOST_URL + "/search/" + searchText + "/";

    url = url + e.getAccount() + "/" + ((e.getSearchType() == 2) ? "mentions" : "statuses");

    url = url + "/" + e.getMediaOnly();

    if (e.getStartDate() != null && e.getEndDate() != null){
        url = url + e.getStartDate() + e.getEndDate() + "/";
    }else if (e.getEndDate() != null){
        url = url + "/0/0/0" + e.getEndDate() + "/";
    }else if (e.getStartDate() != null){
        url = url + e.getStartDate() + "/0/0/0/";
    }else{
        url = url + "/0/0/0/0/0/0/";
    }

    return url;
}
 
Example 16
Project: dangchat-sdk   File: JsFacade.java   Source Code and License 6 votes vote down vote up
@UsedByApp
public void handleLinkClick(Event event) {
    Element target = Element.as(event.getEventTarget());
    String href = target.getAttribute("href");
    if (href.startsWith("send:")) {
        String msg = href.substring("send:".length());
        msg = URL.decode(msg);
        if (lastVisiblePeer != null) {
            messenger.sendMessage(lastVisiblePeer, msg);
            event.preventDefault();
        }
    } else {
        if (JsElectronApp.isElectron()) {
            JsElectronApp.openUrlExternal(href);
            event.preventDefault();
        }
    }
}
 
Example 17
Project: Wiab.pro   File: UrlParameters.java   Source Code and License 6 votes vote down vote up
UrlParameters(String query) {
  if (query.length() > 1) {
    String[] keyvalpairs = query.substring(1, query.length()).split("&");
    for (String pair : keyvalpairs) {
      String[] keyval = pair.split("=");
      // Some basic error handling for invalid query params.
      String paramUnderlineName = URL.decodeQueryString(keyval[0]);
      String paramCamelName = ValueUtils.toCamelCase(paramUnderlineName, "_", false);
      String key = FlagConstants.getShortName(paramCamelName);
      if (keyval.length == 2) {
        String value = URL.decodeQueryString(keyval[1]);
        map.put(key, value);
      } else if (keyval.length == 1) {
        map.put(key, "");
      }
    }
  }
}
 
Example 18
Project: Wiab.pro   File: UrlParameters.java   Source Code and License 6 votes vote down vote up
/**
 * Build a query string out of a map of key/value pairs.
 * @param queryEntries
 */
public static String buildQueryString(Map<String, String> queryEntries) {
  StringBuilder sb = new StringBuilder();
  boolean firstIteration = true;
  for (Entry<String, String> e : queryEntries.entrySet()) {
    if (firstIteration) {
      sb.append('?');
    } else {
      sb.append('&');
    }
    String encodedName = URL.encodeQueryString(e.getKey());
    sb.append(encodedName);

    sb.append('=');

    String encodedValue = URL.encodeQueryString(e.getValue());
    sb.append(encodedValue);
    firstIteration = false;
  }
  return sb.toString();
}
 
Example 19
Project: Wiab.pro   File: Scrub.java   Source Code and License 6 votes vote down vote up
/**
 * Scrub a url if scrubbing is turned on
 *
 * Does not scrub urls with leading hashes
 *
 * @param url
 * @return The scrubbed version of the url, if it's not already scrubbed
 */
public static String scrub(String url) {
  if (enableScrubbing) {
    if (url.startsWith("#") || url.startsWith(REFERRER_SCRUBBING_URL)) {
      // NOTE(user): The caller should be responsible for url encoding if
      // neccessary. There is no XSS risk here as it is a fragment.
      return url;
    } else {
      String x = REFERRER_SCRUBBING_URL + URL.encodeComponent(url);
      return x;
    }
  } else {
    // If we are not scrubbing the url, then we still need to sanitize it,
    // to protect against e.g. javascript.
    String sanitizedUri = EscapeUtils.sanitizeUri(url);
    return sanitizedUri;
  }
}
 
Example 20
Project: x-cure-chat   File: ServerSideAccessManager.java   Source Code and License 6 votes vote down vote up
/**
 * Return the URL for the default user profile file
 * @param fileDescr the user file descriptor
 * @param isThumbnail true if we need a thumbnail, otherwise false
 * @return the required URL
 */
public static String getProfileFileURL( final int userID, final ShortFileDescriptor fileDescr, final boolean isThumbnail ) {
	final int fileID, ownerID = userID;
	final String fileName = getURLAllowedFileName( fileDescr, PROFILE_FILE_DEFAULT_NAME_PREFIX );
	final boolean isImageFile;
	if( fileDescr == null ) {
		fileID = ShortFileDescriptor.UNKNOWN_FILE_ID;
		isImageFile = true;
	} else {
		fileID = fileDescr.fileID;
		isImageFile = SupportedFileMimeTypes.isImageMimeType( fileDescr.mimeType ) ||
		  			  SupportedFileMimeTypes.isImageMimeType( SupportedFileMimeTypes.getFileMimeTypeStringByExtension( fileName ) );
	}
	
	return	URL.encode( GWT.getModuleBaseURL() +
			USER_PROFILE_FILES_SERVLET_CONTEXT +
			SERVER_CONTEXT_DELIMITER + URL.encodeQueryString( fileName ) + URL_QUERY_DELIMITER +
			FOR_USER_ID_IMAGE_SERVLET_PARAM + SERVER_PARAM_NAME_VAL_DELIM + ownerID + SERVLET_PARAMETERS_DELIMITER +
			FILE_ID_SERVLET_PARAM + SERVER_PARAM_NAME_VAL_DELIM + fileID + SERVLET_PARAMETERS_DELIMITER +
			IS_THUMBNAIL_SERVLET_PARAM + SERVER_PARAM_NAME_VAL_DELIM + (isThumbnail ? "1" : "0") + SERVLET_PARAMETERS_DELIMITER +
			IS_IMAGE_SERVLET_PARAM + SERVER_PARAM_NAME_VAL_DELIM + (isImageFile ? "1" : "0") );
}
 
Example 21
Project: x-cure-chat   File: ShareMessageLinkBase.java   Source Code and License 6 votes vote down vote up
/**
 * Must be called in the constructor of the subclass in order to initialize the widget  
 */
protected void initialize() {
	//Set the image
	image.setUrl( ServerSideAccessManager.MESSAGES_RELATED_IMAGES_LOCATION + getLinkImageFileName() + ".png" );
	image.addStyleName( CommonResourcesContainer.SHARE_FORUM_MESSAGE_LINK_IMAGE_STYLE );
	
	//Set the hyperlink
	link.setHref( getLinkURL( messageURL, URL.encodeQueryString( messageTitle ) ) );
	link.setTarget( "_blank" );
	link.setTitle( linkTitle );
	link.setHTML( image.getElement().getString() );
	link.setStyleName( CommonResourcesContainer.SHARE_FORUM_MESSAGE_LINK_STYLE );
	
	//Add the click handler if needed
	if( clickAction  ) {
		link.addClickHandler( new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				onClickAction(messageURL, event);
			}
		} );
	}
	//Initialize the composite
	initWidget( link );
}
 
Example 22
Project: x-cure-chat   File: UserAvatarImageWidget.java   Source Code and License 6 votes vote down vote up
/**
 * Return the URL for the user avatar image
 * @param userID the id of the user we want a picture of
 * @param isMale true if this is a male's avatar, it is only
 * neded if the user's avatar is not set.
 * @param update true if we want to update the image, in this
 * case the URL will be changed.
 * @return the required URL
 */
private static String getProfileAvatarURL( final int userID, final boolean isMale, final boolean update ) {
	long time; final boolean isMyAvatar = (userID == SiteManager.getUserID());
	if( isMyAvatar ) {
		if( update || myAvatarUpdateTimeMillisec < System.currentTimeMillis() ) {
			myAvatarUpdateTimeMillisec += 60000;
		}
		time = myAvatarUpdateTimeMillisec;
	} else {
		if( update || otherAvatarsUpdateTimeMillisec < System.currentTimeMillis() ) {
			otherAvatarsUpdateTimeMillisec += 60000;
		}
		time = otherAvatarsUpdateTimeMillisec;
	}
	
	return	URL.encode( GWT.getModuleBaseURL() +
			ServerSideAccessManager.USER_PROFILE_AVATAR_SERVLET_CONTEXT + ServerSideAccessManager.URL_QUERY_DELIMITER +
			ServerSideAccessManager.FOR_USER_ID_AVATAR_SERVLET_PARAM + ServerSideAccessManager.SERVER_PARAM_NAME_VAL_DELIM + userID + ServerSideAccessManager.SERVLET_PARAMETERS_DELIMITER +
			ServerSideAccessManager.FOR_USER_GENDER_AVATAR_SERVLET_PARAM + ServerSideAccessManager.SERVER_PARAM_NAME_VAL_DELIM + ( isMale ? "1" : "0") + ServerSideAccessManager.SERVLET_PARAMETERS_DELIMITER +
			ServerSideAccessManager.DUMMY_TIME_SERVLET_PARAM + ServerSideAccessManager.SERVER_PARAM_NAME_VAL_DELIM + time );
	//NOTE: The last parameter is only used for updating the avatar images
}
 
Example 23
Project: wte4j   File: GenerateDocumentPresenter.java   Source Code and License 6 votes vote down vote up
public void createAndDownlaodDocument() {
	orderService.createDocument(selectedOrder, selectedTemplate,
			new AsyncCallback<String>() {
				@Override
				public void onSuccess(String result) {
					display.hideTemplateList();

					String url = GWT.getModuleBaseURL() + "orderService?file=" + result.toString();
					url = URL.decode(url);
					Window.open(url, "parent", "");
				}

				@Override
				public void onFailure(Throwable caught) {
					display.hideTemplateList();
					showErrorOnFailure(caught);
				}
			});

}
 
Example 24
Project: scheduling-portal   File: UsageView.java   Source Code and License 6 votes vote down vote up
private ClickHandler downloadUsageData() {
    return new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            String from = DATE_FORMAT.format(readDateFromFormItem(datesForm.getItem("From")));
            String to = DATE_FORMAT.format(readDateFromFormItem(datesForm.getItem("To")));

            String url = GWT.getModuleBaseURL() + "usageexporter";
            url += "?sessionId=" + LoginModel.getInstance().getSessionId();
            url += "&user=" + userSelect.getValue().toString();
            url += "&startDate=" + URL.encodeQueryString(from);
            url += "&endDate=" + URL.encodeQueryString(to);
            Window.open(url, "_blank", "");
        }
    };
}
 
Example 25
Project: che   File: WorkspaceServiceClient.java   Source Code and License 6 votes vote down vote up
/**
 * Updates command.
 *
 * @return a promise that resolves to the {@link WorkspaceImpl}, or rejects with an error
 */
public Promise<WorkspaceImpl> updateCommand(
    String wsId, String commandName, CommandImpl commandUpdate) {
  final String url = baseHttpUrl + '/' + wsId + "/command/" + URL.encodePathSegment(commandName);

  final CommandDto commandDto =
      dtoFactory
          .createDto(CommandDto.class)
          .withName(commandUpdate.getName())
          .withCommandLine(commandUpdate.getCommandLine())
          .withType(commandUpdate.getType())
          .withAttributes(commandUpdate.getAttributes());

  return asyncRequestFactory
      .createRequest(PUT, url, commandDto, false)
      .header(ACCEPT, APPLICATION_JSON)
      .header(CONTENT_TYPE, APPLICATION_JSON)
      .loader(loaderFactory.newLoader("Updating command..."))
      .send(dtoUnmarshallerFactory.newUnmarshaller(WorkspaceDto.class))
      .then((Function<WorkspaceDto, WorkspaceImpl>) WorkspaceImpl::new);
}
 
Example 26
Project: actor-platform   File: JsFacade.java   Source Code and License 6 votes vote down vote up
@UsedByApp
public void handleLinkClick(Event event) {
    Element target = Element.as(event.getEventTarget());
    String href = target.getAttribute("href");
    if (href.startsWith("send:")) {
        String msg = href.substring("send:".length());
        msg = URL.decode(msg);
        if (lastVisiblePeer != null) {
            messenger.sendMessage(lastVisiblePeer, msg);
            event.preventDefault();
        }
    } else {
        if (JsElectronApp.isElectron()) {
            JsElectronApp.openUrlExternal(href);
            event.preventDefault();
        }
    }
}
 
Example 27
Project: geowe-core   File: OpenProjectDialog.java   Source Code and License 6 votes vote down vote up
private SelectHandler createUrlToShare(final VerticalPanel geoDataContainer) {
	return new SelectHandler() {
		@Override
		public void onSelect(SelectEvent event) {
			urlToShareAnchor.setHref(getHref());
			urlToShareAnchor.setText(
					UIMessages.INSTANCE.seeOtherWindow("GeoWE Project"),
					Direction.LTR);

			urlShared.setText(getHref());
			urlPanel.setVisible(true);
			urlShared.setVisible(true);
		}

		private String getHref() {
			String baseUrl = GWT.getHostPageBaseURL();

			baseUrl += "?projectUrl="
					+ URL.encodeQueryString(urlTextField.getValue());

			return baseUrl;
		}
	};
}
 
Example 28
Project: gerrit   File: PaginatedProjectScreen.java   Source Code and License 6 votes vote down vote up
protected void parseToken(String token) {
  for (String kvPair : token.split("[,;&/?]")) {
    String[] kv = kvPair.split("=", 2);
    if (kv.length != 2 || kv[0].isEmpty()) {
      continue;
    }

    if ("filter".equals(kv[0])) {
      match = URL.decodeQueryString(kv[1]);
    }

    if ("skip".equals(kv[0]) && URL.decodeQueryString(kv[1]).matches("^[\\d]+")) {
      start = Integer.parseInt(URL.decodeQueryString(kv[1]));
    }
  }
}
 
Example 29
Project: unitime   File: UserAuthentication.java   Source Code and License 6 votes vote down vote up
public void authenticate() {
	if (!CONSTANTS.allowUserLogin()) {
		if (isAllowLookup())
			doLookup();
		else
			ToolBox.open(GWT.getHostPageBaseURL() + "login.do?target=" + URL.encodeQueryString(Window.Location.getHref()));
		return;
	}
	AriaStatus.getInstance().setText(ARIA.authenticationDialogOpened());
	iError.setVisible(false);
	iDialog.center();
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			iUserName.selectAll();
			iUserName.setFocus(true);
		}
	});
}
 
Example 30
Project: dhcalc   File: LeaderboardPanel.java   Source Code and License 6 votes vote down vote up
protected void showPaperdoll() {
	String btag = getSelectedAccount();
	Realm realm = mainPanel.getSelectedRealm();

	if ((realm != null) && (btag != null)) {
		String[] split = btag.split("#");

		if (split.length > 2) {
			MainPanel.openPaperdoll(realm.name(),
					URL.encodePathSegment(split[0]), Integer.valueOf(split[1]),
					Integer.valueOf(split[2]));
		} else {
			MainPanel.showInfoDialog("No HeroId");
		}
	}
}
 
Example 31
Project: turbogwt-http   File: MultivaluedParamComposition.java   Source Code and License 6 votes vote down vote up
/**
 * Construct encoded URI part from gives values.
 *
 * @param separator the separator of parameters from current URI part
 * @param name      the parameter name
 * @param values    the parameter value(s), each object will be converted to a {@code String} using its {@code
 *                  toString()} method.
 *
 * @return encoded URI part
 */
@Override
public String asUriPart(String separator, String name, Object... values) {
    assertNotNullOrEmpty(name, "Parameter name cannot be null or empty.");
    String uriPart = "";
    String sep = "";
    for (Object value : values) {
        String strValue = value.toString();
        assertNotNullOrEmpty(strValue, "Parameter value of *" + name
                + "* null or empty. You must inform a valid value");

        uriPart += sep + URL.encodeQueryString(name) + "=" + URL.encodeQueryString(strValue);
        sep = separator;
    }
    return uriPart;
}
 
Example 32
Project: turbogwt-http   File: MultivaluedParamComposition.java   Source Code and License 6 votes vote down vote up
/**
 * Construct encoded URI part from gives values.
 *
 * @param separator the separator of parameters from current URI part
 * @param name      the parameter name
 * @param values    the parameter value(s), each object will be converted to a {@code String} using its {@code
 *                  toString()} method.
 *
 * @return encoded URI part
 */
@Override
public String asUriPart(String separator, String name, Object... values) {
    assertNotNullOrEmpty(name, "Parameter name cannot be null or empty.");
    String uriPart = URL.encodeQueryString(name) + "=";
    String sep = "";
    for (Object value : values) {
        String strValue = value.toString();
        assertNotNullOrEmpty(strValue, "Parameter value of *" + name
                + "* null or empty. You must inform a valid value");

        uriPart += sep + URL.encodeQueryString(strValue);
        sep = ",";
    }
    return uriPart;
}
 
Example 33
Project: rva   File: GadgetCustomSettingsWidget.java   Source Code and License 6 votes vote down vote up
private void loadDataRPC() {
		//fetch XML data using server proxy in order to resolve browsers' cross-domain security restrictions
//		setStatus("Data is loading...");
		String xmlUrl = gadgetSettings.getGadgetXmlUrl();
		xmlUrl = URL.decodeQueryString(xmlUrl);
		gadgetService.getGadgetXml(xmlUrl, rpcCallBackHandler);
		//http://www.roseindia.net/tutorials/gwt/retrieving-xml-data.shtml
//		RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, gadgetUrl);
//		try {
//			requestBuilder.sendRequest(null, new RequestCallback() {
//				public void onResponseReceived(Request request, Response response) {
//					actionsWidget.setEnabled(true);
//					tbName.setText(response.getText());
//					bindData();
//					statusBox.clear();
//				}
//				public void onError(Request request, Throwable ex) {
//					actionsWidget.setEnabled(true);
//					statusBox.setStatus(StatusBoxWidget.Status.ERROR, "Error: " + ex.getMessage());
//				}
//			});			
//		} catch (RequestException ex) {
//			statusBox.setStatus(StatusBoxWidget.Status.ERROR, "Error: " + ex.getMessage());
//	    }
	}
 
Example 34
Project: rva   File: WidgetCustomUIWidget.java   Source Code and License 6 votes vote down vote up
public void show(Command onSave, WidgetSettingsInfo widgetSettings) {
//		this.onSave = onSave;
		this.widgetSettings = widgetSettings;
		
		String url = widgetSettings.getWidgetUiUrl();
		url += url.contains("?") ? "&" : "?";
		url += "up_id=" + "if_divEditor";
		url += "&parent=" + URL.encodeQueryString(Window.Location.getHref());
		url += "&up_rsW=" + PresentationLayoutWidget.getInstance().getPlaceholderWidth();
		url += "&up_rsH=" + PresentationLayoutWidget.getInstance().getPlaceholderHeight();
		url += "&up_companyId=" + SelectedCompanyController.getInstance().getSelectedCompanyId();
		
		url = url.replace("'", "\\'");

//		String params = widgetSettings.getAdditionalParams() != null ? widgetSettings.getAdditionalParams() : "";
//		params = params.replace("\"", "\\\"");
		
		show(url);
	}
 
Example 35
Project: rva   File: DataAccessController.java   Source Code and License 6 votes vote down vote up
public static void getFinancialData(String urlToken, String tq, DataResponseBase response, boolean customQuery) {
		String action = configController.getConfiguration().getFinancialServerURL() + urlToken;
//		String action = "http://contentfinancial2.appspot.com" + urlToken;
		
		String callback = "callback" + (int)(Math.random() * 1000000) + "_" + new Date().getTime();
		String tqx = "responseHandler:" + callback;
		
		String url = action + "?tqx=" + tqx + "&";
		if (customQuery) {
			url += tq;
		}
		else {
			url += "tq=" + URL.encodeQueryString(tq);
		}
		
		getDataNative(url, callback, response);
		
	}
 
Example 36
Project: rva   File: StoreContentFrameWidget.java   Source Code and License 6 votes vote down vote up
public void show(String storePath, Command onSave, Command onCancel){
	this.onSave = onSave;
	this.onCancel = onCancel;
	
	String url = ConfigurationController.getInstance().getConfiguration().getStoreURL();
	url += storePath;
	url += "?inRVA=true&cat=Content&cid=" + SelectedCompanyController.getInstance().getSelectedCompanyId();
	url += "&up_id=" + "if_divEditor";
	url += "&parent=" + URL.encodeQueryString(Window.Location.getHref());

	this.getElement().getStyle().clearBackgroundColor();
	
	this.getElement().addClassName("responsive-iframe");

	show(url);
}
 
Example 37
Project: lumongo   File: UrlParamBuilder.java   Source Code and License 6 votes vote down vote up
/**
 * Build the URL and return it as an encoded string.
 *
 * @return the encoded URL string
 */
public String buildString() {
	StringBuilder url = new StringBuilder();

	// Generate the query string.
	// http://www.google.com:80/path/to/file.html?k0=v0&k1=v1
	String prefix = "";
	for (Map.Entry<String, String[]> entry : listParamMap.entrySet()) {
		for (String val : entry.getValue()) {
			url.append(prefix).append(URL.encodeQueryString(entry.getKey())).append('=');
			if (val != null) {
				// Also encodes +,& etc.
				url.append(URL.encodeQueryString(val));
			}
			prefix = "&";
		}
	}

	return url.toString();
}
 
Example 38
Project: opennmszh   File: DefaultLocationManager.java   Source Code and License 6 votes vote down vote up
private void showLocationDetails(final String locationName) {
    // TODO: this needs a callback to get the location details, and fill
    // in the content
    final LocationInfo loc = m_dataManager.getLocation(locationName);
    m_remoteService.getLocationDetails(locationName, new AsyncCallback<LocationDetails>() {
        public void onFailure(final Throwable t) {
            String htmlTitle = "Error Getting Location Details";
            String htmlContent = "<p>An error occurred getting the location details.</p>" + "<pre>"
                       + URL.encode(t.getMessage()) + "</pre>";
            m_view.showLocationDetails(locationName, htmlTitle, htmlContent);
        }

        public void onSuccess(final LocationDetails locationDetails) {
            m_view.showLocationDetails(
                locationName,
                locationName + " (" + loc.getArea() + ")",
                getLocationInfoDetails(loc, locationDetails)
            );
        }

    });
}
 
Example 39
Project: edal-java   File: BaseWmsClient.java   Source Code and License 6 votes vote down vote up
/**
 * Encodes the URL, including proxy and base WMS URL
 * 
 * @param baseUrl
 *            The base URL to encode
 * @param params
 *            A series of key=value arguments to append as GET parameters
 * @return the encoded URL
 */
protected String getUrlFromGetArgs(String baseUrl, String... params) {
    StringBuilder argPart = new StringBuilder();
    /*
     * If the baseUrl already contains a "?", we need to append with "&"
     */
    argPart.append(baseUrl.contains("?") ? "&" : "?");
    for (String param : params) {
        argPart.append(param + "&");
    }
    argPart.deleteCharAt(argPart.length() - 1);

    String ret = URL.encode(proxyUrl + baseUrl) + argPart.toString();
    GWT.log("encoded:" + ret);
    return ret;
}
 
Example 40
Project: geomajas-project-client-gwt2   File: DynamicVectorServerLayerLegend.java   Source Code and License 6 votes vote down vote up
private void buildLegend(VerticalPanel layout) {
	NamedStyleInfo styleInfo = layer.getLayerInfo().getNamedStyleInfo();
	int i = 0;
	for (FeatureTypeStyleInfo sfi : styleInfo.getUserStyle().getFeatureTypeStyleList()) {
		for (RuleInfo rInfo : sfi.getRuleList()) {
			String url = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl();
			ServerLayerStyleWidget.addPath(url, layer.getServerLayerId());
			ServerLayerStyleWidget.addPath(url, styleInfo.getName());
			ServerLayerStyleWidget.addPath(url, i + ".png");
			ServerLayerStyleWidget widget = new ServerLayerStyleWidget(URL.encode(url), rInfo.getName(), rInfo);
			ruleWidgets.add(widget);
			layout.add(widget);
			i++;
		}
	}
}
 
Example 41
Project: phenotype-portal   File: WorkflowTab.java   Source Code and License 6 votes vote down vote up
public void insertImage(Image image) {
    clearTab();

    if (image != null && image.getImagePath() != null) {
        wfImage = new Img();
        wfImage.setImageType(ImageStyle.NORMAL);
     wfImage.setSrc(URL.encode(GWT.getModuleBaseURL() + "images?id=" + image.getImagePath()));
        wfImage.setDefaultWidth(image.getWidth());
        wfImage.setDefaultHeight(image.getHeight());
        imagePanel.setContents("");

        imagePanel.addChild(wfImage);
    } else {
        imagePanel.setContents("<b>There is no workflow image for this algorithm</b>");
    }
    imagePanel.markForRedraw();
}
 
Example 42
Project: incubator-wave   File: UrlParameters.java   Source Code and License 6 votes vote down vote up
/**
 * Build a query string out of a map of key/value pairs.
 * @param queryEntries
 */
public static String buildQueryString(Map<String, String> queryEntries) {
  StringBuffer sb = new StringBuffer();
  boolean firstIteration = true;
  for (Entry<String, String> e : queryEntries.entrySet()) {
    if (firstIteration) {
      sb.append('?');
    } else {
      sb.append('&');
    }
    String encodedName = URL.encodeComponent(e.getKey());
    sb.append(encodedName);

    sb.append('=');

    String encodedValue = URL.encodeComponent(e.getValue());
    sb.append(encodedValue);
    firstIteration = false;
  }
  return sb.toString();
}
 
Example 43
Project: incubator-wave   File: Scrub.java   Source Code and License 6 votes vote down vote up
/**
 * Scrub a url if scrubbing is turned on
 *
 * Does not scrub urls with leading hashes
 *
 * @param url
 * @return The scrubbed version of the url, if it's not already scrubbed
 */
public static String scrub(String url) {
  if (enableScrubbing) {
    if (url.startsWith("#") || url.startsWith(REFERRER_SCRUBBING_URL)) {
      // NOTE(user): The caller should be responsible for url encoding if
      // neccessary. There is no XSS risk here as it is a fragment.
      return url;
    } else {
      String x = REFERRER_SCRUBBING_URL + URL.encodeComponent(url);
      return x;
    }
  } else {
    // If we are not scrubbing the url, then we still need to sanitize it,
    // to protect against e.g. javascript.
    String sanitizedUri = EscapeUtils.sanitizeUri(url);
    return sanitizedUri;
  }
}
 
Example 44
Project: OpenNMS   File: DefaultLocationManager.java   Source Code and License 6 votes vote down vote up
private void showLocationDetails(final String locationName) {
    // TODO: this needs a callback to get the location details, and fill
    // in the content
    final LocationInfo loc = m_dataManager.getLocation(locationName);
    m_remoteService.getLocationDetails(locationName, new AsyncCallback<LocationDetails>() {
        public void onFailure(final Throwable t) {
            String htmlTitle = "Error Getting Location Details";
            String htmlContent = "<p>An error occurred getting the location details.</p>" + "<pre>"
                       + URL.encode(t.getMessage()) + "</pre>";
            m_view.showLocationDetails(locationName, htmlTitle, htmlContent);
        }

        public void onSuccess(final LocationDetails locationDetails) {
            m_view.showLocationDetails(
                locationName,
                locationName + " (" + loc.getArea() + ")",
                getLocationInfoDetails(loc, locationDetails)
            );
        }

    });
}
 
Example 45
Project: jcommerce   File: PageState.java   Source Code and License 6 votes vote down vote up
public String encode (String s){
	    if (s == null) {
	        return s;
	    }
	    
		String res = s;
			
		res = res.replace(EQUAL, EQUALCODE);
		res = res.replace(AND, ANDCODE);
		res = res.replace(LEFT, LEFTCODE);
		res = res.replace(RIGHT, RIGHTCODE);
//			String res = Base64.encode(s);
		
//			byte[] ss = Base64.encode(Util.getBytes(s));
//			res = Util.toString(ss);
		
		res = URL.encode(res);
		
//			res = URLEncoder.encode(res, "UTF-8");
		
//			res = res.replace('+', '*');
//			res = res.replace('/', '-');
		Logger.getClientLogger().log("encode: before="+s+", after="+res);
		return res;
	}
 
Example 46
Project: unitimes   File: TeachingRequestsPage.java   Source Code and License 5 votes vote down vote up
void export(String type) {
	RoomCookie cookie = RoomCookie.getInstance();
	String query = "output=" + type;
	FilterRpcRequest requests = iFilterBox.getElementsRequest();
	if (requests.hasOptions()) {
		for (Map.Entry<String, Set<String>> option: requests.getOptions().entrySet()) {
			for (String value: option.getValue()) {
				query += "&r:" + option.getKey() + "=" + URL.encodeQueryString(value);
			}
		}
	}
	if (requests.getText() != null && !requests.getText().isEmpty()) {
		query += "&r:text=" + URL.encodeQueryString(requests.getText());
	}
	query += "&sort=" + InstructorCookie.getInstance().getSortTeachingRequestsBy(iAssigned) +
			"&columns=" + InstructorCookie.getInstance().getTeachingRequestsColumns(iAssigned) + 
			"&grid=" + (cookie.isGridAsText() ? "0" : "1") +
			"&vertical=" + (cookie.areRoomsHorizontal() ? "0" : "1") +
			(cookie.hasMode() ? "&mode=" + cookie.getMode() : "");
	RPC.execute(EncodeQueryRpcRequest.encode(query), new AsyncCallback<EncodeQueryRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
		}
		@Override
		public void onSuccess(EncodeQueryRpcResponse result) {
			ToolBox.open(GWT.getHostPageBaseURL() + "export?q=" + result.getQuery());
		}
	});
}
 
Example 47
Project: unitimes   File: TeachingAssignmentsPage.java   Source Code and License 5 votes vote down vote up
void export(String type) {
	RoomCookie cookie = RoomCookie.getInstance();
	String query = "output=" + type;
	FilterRpcRequest requests = iFilterBox.getElementsRequest();
	if (requests.hasOptions()) {
		for (Map.Entry<String, Set<String>> option: requests.getOptions().entrySet()) {
			for (String value: option.getValue()) {
				query += "&r:" + option.getKey() + "=" + URL.encodeQueryString(value);
			}
		}
	}
	if (requests.getText() != null && !requests.getText().isEmpty()) {
		query += "&r:text=" + URL.encodeQueryString(requests.getText());
	}
	query += "&sort=" + InstructorCookie.getInstance().getSortTeachingAssignmentsBy() +
			"&columns=" + InstructorCookie.getInstance().getTeachingAssignmentsColumns() + 
			"&grid=" + (cookie.isGridAsText() ? "0" : "1") +
			"&vertical=" + (cookie.areRoomsHorizontal() ? "0" : "1") +
			(cookie.hasMode() ? "&mode=" + cookie.getMode() : "");
	RPC.execute(EncodeQueryRpcRequest.encode(query), new AsyncCallback<EncodeQueryRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
		}
		@Override
		public void onSuccess(EncodeQueryRpcResponse result) {
			ToolBox.open(GWT.getHostPageBaseURL() + "export?q=" + result.getQuery());
		}
	});
}
 
Example 48
Project: unitimes   File: RoomsPage.java   Source Code and License 5 votes vote down vote up
public void parse(String token) {
	if (token != null && !token.isEmpty())
		for (String pair: token.split("\\&")) {
			int idx = pair.indexOf('=');
			if (idx >= 0)
				iParams.put(pair.substring(0, idx), URL.decodeQueryString(pair.substring(idx + 1)));
		}
}
 
Example 49
Project: unitimes   File: RoomsPage.java   Source Code and License 5 votes vote down vote up
public String toString(String skip) {
	String ret = "";
	for (String key: new TreeSet<String>(iParams.keySet())) {
		if (key.equals(skip)) continue;
		if (!ret.isEmpty()) ret += "&";
		ret += key + "=" + URL.encodeQueryString(iParams.get(key));
	}
	return ret;
}
 
Example 50
Project: unitimes   File: PageFilter.java   Source Code and License 5 votes vote down vote up
public String getQuery() {
	String query = "";
	for (FilterParameterInterface param: iFilter.getParameters()) {
		String value = param.getValue();
		if (value != null)
			query += "&" + param.getName() + "=" + URL.encodeQueryString(value);
	}
	return query;
}
 
Example 51
Project: unitimes   File: ToolBox.java   Source Code and License 5 votes vote down vote up
public static void checkAccess(Throwable t) {
	if (t != null && t instanceof GwtRpcException && t.getCause() != null) t = t.getCause();
	if (t != null && t instanceof PageAccessException) {
		open(GWT.getHostPageBaseURL() + "login.do?menu=hide&m=" + URL.encodeQueryString(t.getMessage())+"&target=" + URL.encodeQueryString(Window.Location.getHref()));
		/*
		UniTimeFrameDialog.openDialog("UniTime " + CONSTANTS.version() + "| Log In", "login.do?menu=hide&m=" + URL.encodeQueryString(t.getMessage())
				+"&target=" + URL.encodeQueryString(Window.Location.getHref()), "700px", "420px");
		*/
	}
}
 
Example 52
Project: unitimes   File: EventResourceTimetable.java   Source Code and License 5 votes vote down vote up
public HistoryToken(PageType type) {
	iType = type.name();
	
	// 1. take page type defaults --> DEFAULTS
	if (type.getParams() != null)
		for (int i = 0; 1 + i < type.getParams().length; i += 2)
			iDefaults.put(type.getParams()[i], type.getParams()[i + 1]);

	// 2. take page parameters --> DEFAULTS (on top of the page type defaults)
	for (Map.Entry<String, List<String>> params: Window.Location.getParameterMap().entrySet())
		iDefaults.put(params.getKey(), params.getValue().get(0));
	
	// 3. take cookie --> PARAMS (override defaults)
	String cookie = EventCookie.getInstance().getHash(iType);
	if (cookie != null) {
		for (String pair: cookie.split("\\&")) {
			int idx = pair.indexOf('=');
			if (idx >= 0) {
				String key = pair.substring(0, idx);
				if (Location.getParameter(key) == null)
					iParams.put(key, URL.decodeQueryString(pair.substring(idx + 1)));
			}
		}
	}			
	
	// 4. take page token (hash) --> PARAMS (override cookie)
	parse(History.getToken());
}
 
Example 53
Project: unitimes   File: EventResourceTimetable.java   Source Code and License 5 votes vote down vote up
public void parse(String token) {
	if (token != null && !token.isEmpty())
		for (String pair: token.split("\\&")) {
			int idx = pair.indexOf('=');
			if (idx >= 0)
				iParams.put(pair.substring(0, idx), URL.decodeQueryString(pair.substring(idx + 1)));
		}
}
 
Example 54
Project: unitimes   File: EventResourceTimetable.java   Source Code and License 5 votes vote down vote up
public String toString(String skip) {
	String ret = "";
	for (String key: new TreeSet<String>(iParams.keySet())) {
		if (key.equals(skip)) continue;
		if (!ret.isEmpty()) ret += "&";
		ret += key + "=" + URL.encodeQueryString(iParams.get(key));
	}
	return ret;
}
 
Example 55
Project: unitimes   File: SectioningStatusPage.java   Source Code and License 5 votes vote down vote up
private void checkLastQuery() {
	if (Window.Location.getParameter("q") != null) {
		iFilter.setValue(Window.Location.getParameter("q"), true);
		if (Window.Location.getParameter("t") != null) {
			if ("2".equals(Window.Location.getParameter("t"))) {
				iTabPanel.selectTab(1);
			} else {
				iTabPanel.selectTab(0);
			}
		} else {
			loadData();
		}
	} else if (Window.Location.getHash() != null && !Window.Location.getHash().isEmpty()) {
		String hash = URL.decode(Window.Location.getHash().substring(1));
		if (!hash.matches("^[0-9]+\\:?[0-9]*@?$")) {
			if (hash.endsWith("@")) {
				iFilter.setValue(hash.substring(0, hash.length() - 1), true);
				iTabPanel.selectTab(1);
			} else if (hash.endsWith("$")) {
				iFilter.setValue(hash.substring(0, hash.length() - 1), true);
				iTabPanel.selectTab(2);
			} else {
				iFilter.setValue(hash, true);
				loadData();
			}
		}
	} else {
		String q = SectioningStatusCookie.getInstance().getQuery(iOnline);
		if (q != null) iFilter.setValue(q);
		int t = SectioningStatusCookie.getInstance().getTab(iOnline);
		if (t >= 0 && t < iTabPanel.getTabCount()) {
			iTabPanel.selectTab(t, false);
			iTabIndex = -1;
		}
		if (GWT_CONSTANTS.searchWhenPageIsLoaded() && q != null && !q.isEmpty())
			loadData();
	}
}
 
Example 56
Project: unitimes   File: SectioningStatusPage.java   Source Code and License 5 votes vote down vote up
private void exportData() {
	int tab = iTabIndex;
	if (tab < 0)
		tab = SectioningStatusCookie.getInstance().getTab(iOnline);
	
	String query = "output=student-dashboard.csv&online=" + (iOnline ? 1 : 0) + "&tab=" + tab + "&sort=" + SectioningStatusCookie.getInstance().getSortBy(iOnline, tab);
	if (tab == 0)
		for (Long courseId: iSelectedCourseIds)
			query += "&c=" + courseId;
	query += "&query=" + URL.encodeQueryString(iFilter.getValue());
	FilterRpcRequest req = iFilter.getElementsRequest();
	if (req.hasOptions()) {
		for (Map.Entry<String, Set<String>> option: req.getOptions().entrySet()) {
			for (String value: option.getValue()) {
				query += "&f:" + option.getKey() + "=" + URL.encodeQueryString(value);
			}
		}
	}
	if (req.getText() != null && !req.getText().isEmpty()) {
		query += "&f:text=" + URL.encodeQueryString(req.getText());
	}
	
	RPC.execute(EncodeQueryRpcRequest.encode(query), new AsyncCallback<EncodeQueryRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
		}
		@Override
		public void onSuccess(EncodeQueryRpcResponse result) {
			ToolBox.open(GWT.getHostPageBaseURL() + "export?q=" + result.getQuery());
		}
	});
}
 
Example 57
Project: sig-seguimiento-vehiculos   File: GeoDataImportDialog.java   Source Code and License 5 votes vote down vote up
private SelectHandler createUrlToShare(final VerticalPanel geoDataContainer) {
	return new SelectHandler() {
		@Override
		public void onSelect(SelectEvent event) {
			urlToShareAnchor.setHref(getHref());
			urlToShareAnchor.setText(
					UIMessages.INSTANCE.seeOtherWindow(getLayerName()),
					Direction.LTR);

			urlShared.setText(getHref());
			urlPanel.setVisible(true);
			urlShared.setVisible(true);
		}

		private String getHref() {
			String baseUrl = GWT.getHostPageBaseURL();

			baseUrl += "?layerUrl="
					+ URL.encodeQueryString(urlTextField.getValue())
					+ "&layerName=" + getLayerName() + "&layerProj="
					+ getProjectionName() + "&layerFormat="
					+ getDataFormat();

			return baseUrl;
		}
	};
}
 
Example 58
Project: WebConsole   File: BrowserUtils.java   Source Code and License 5 votes vote down vote up
public static String getImageProxyURL(String username, String password, String url) {
	String imageUrl = url;

	if (username != null && password != null) {
		String authStr = username + ":" + password;
		authStr = BrowserUtils.base64Encode(authStr);
		
		imageUrl =  GWT.getModuleBaseURL() + "imageproxy?userpass=" + authStr + "&url=" + URL.encode(url);
	}	
	
	return imageUrl;
}
 
Example 59
Project: LAS   File: ESGFSearchPanel.java   Source Code and License 5 votes vote down vote up
protected void addFacet(CheckBox checkBox) {
    if ( !activeFacets.contains(checkBox) ) {
        activeFacets.add(checkBox);
    }
    String query = URL.encode(showFacets());     
    if ( query.length() ==0 ) {
        datasetPanel.clear();
    } else {
        spinLabel.setText("Searching...");
        spin.show();
        Util.getRPCService().getESGFDatasets(query+"&access=LAS&limit="+limit+"&offset="+offset, datasetCallback);
    }
}
 
Example 60
Project: LAS   File: ESGFSearchPanel.java   Source Code and License 5 votes vote down vote up
protected void removeFacet(CheckBox checkBox) {
    checkBox.setValue(false, false);
    activeFacets.remove(checkBox);
    String query = URL.encode(showFacets());  
    offset=0;
    if ( query.length() == 0 ) {
        datasetPanel.clear();
    } else {
        spinLabel.setText("Searching...");
        spin.show();
        Util.getRPCService().getESGFDatasets(query+"&access=LAS&limit="+limit+"&offset="+offset, datasetCallback);
    }
}