List of usage examples for com.google.gwt.http.client URL decodeComponent
@Deprecated public static String decodeComponent(String encodedURLComponent)
From source file:com.google.gwt.sample.feedreader.client.GwtFeedReader.java
License:Apache License
/** * Change the application's state based on a new history token. *//*from ww w.j a v a 2 s . c o m*/ private void processHistoryToken(String token) { if (token.length() == 0) { return; } token = URL.decodeComponent(token); if ("about".equals(token)) { ConfigurationPanel cp = new ConfigurationPanel(configuration, manifest); cp.showAbout(); return; } if ("manifest".equals(token)) { manifest.enter(); return; } if ("configuration".equals(token)) { ConfigurationPanel cp = new ConfigurationPanel(configuration, manifest); cp.enter(); return; } if (token.startsWith("search||")) { ConfigurationPanel cp = new ConfigurationPanel(configuration, manifest); cp.showSearch(token.substring(8)); return; } String feedUrl; String entryUrl; if (token.indexOf("||") != -1) { String[] halves = token.split("\\|\\|"); feedUrl = halves[0]; entryUrl = halves[1]; } else { feedUrl = token; entryUrl = null; } // See if the token represents a new feed URL. If a new URL was added // to the configuration, tell the manifest panel it should redraw itself // the next time it's shown. if (configuration.importFeeds(feedUrl)) { manifest.setDirty(); } // Find the URL and display it Configuration.Feed feed = configuration.findFeed(feedUrl); if (feed != null) { manifest.showFeed(feed, entryUrl); } }
From source file:com.google.mobile.trippy.web.client.HistoryTokenHandler.java
License:Apache License
private static Map<String, List<String>> buildListParamMap(final String queryString) { Map<String, List<String>> out = new HashMap<String, List<String>>(); if (queryString != null && queryString.length() > 1) { final String qs = queryString.substring(1); for (String kvPair : qs.split("&")) { final String[] kv = kvPair.split("=", 2); if (kv[0].length() == 0) { continue; }/* w w w. ja v a 2 s . c o m*/ List<String> values = out.get(kv[0]); if (values == null) { values = new ArrayList<String>(); out.put(kv[0], values); } values.add(kv.length > 1 ? URL.decodeComponent(kv[1]) : ""); } } for (Map.Entry<String, List<String>> entry : out.entrySet()) { entry.setValue(Collections.unmodifiableList(entry.getValue())); } out = Collections.unmodifiableMap(out); return out; }
From source file:com.square.composant.envoi.email.square.client.composant.FichierUpload.java
License:Open Source License
@Override public void onSubmitComplete(SubmitCompleteEvent event) { LoadingPopup.stopAll();// ww w. j a va2 s . co m String resultat = event.getResults().replaceAll("<[^>]*>", ""); if (!"".equals(resultat)) { // S'il n'y a pas d'erreur on formate le contenu du rsultat if (resultat.startsWith(ComposantEnvoiEmailConstants.PARAM_NOM_FICHIER)) { // Publication de l'vnement pour la mise a jour de l'affichage des pices jointes eventBus.fireEvent(new FinUploadPieceJointeEvent(URL.decodeComponent(resultat))); } else if (resultat.equals(ComposantEnvoiEmailConstants.ERREUR_UPLOAD_FICHIER_NOM_INCORRECT)) { resultat = composantMessages.erreurUploadFichierNomIncorrect(); } else if (resultat.equals(ComposantEnvoiEmailConstants.ERREUR_UPLOAD_FICHIER)) { resultat = composantMessages.erreurUploadFichier(); } else { final ErrorPopupConfiguration errorPopupConfiguration = new ErrorPopupConfiguration(resultat); ErrorPopup.afficher(errorPopupConfiguration); } } }
From source file:com.teardrop.client.PerformSearch.java
License:Apache License
private String getDecodedRecord(Record r, String name) { if (r.getAsString(name) == null) return ""; return URL.decodeComponent(r.getAsString(name)); }
From source file:main.client.ui.SourceBrowserPortlet.java
License:Open Source License
/** * Pickup clicks on links in the Java HTML and navigate to the file being * clicked on by refreshing this portlet. *///from w w w . j a v a2 s . co m private void onJavaHtmlClick() { Event ev = DOM.eventGetCurrentEvent(); if (ev == null) { return; } Element link; try { link = DOM.eventGetTarget(ev); } catch (Exception e) { return; } if (link != null && GenUtil.isLink(link)) { String base = GenUtil.getBaseUrl() + "src/"; String href = URL.decodeComponent(DOM.getElementProperty(link, "href")); if (href != null && href.startsWith(base)) { DOM.eventPreventDefault(ev); navigateTo(href.substring(base.length())); } } }
From source file:org.eurekastreams.web.client.jsni.WidgetJSNIFacadeImpl.java
License:Apache License
/** * Decode a URL encoded string.// www. jav a2s. c o m * * @param value * the value to decode. * @return the decoded string. */ public String urlDecode(final String value) { return URL.decodeComponent(value); }
From source file:org.eurekastreams.web.client.ui.pages.activity.ActivityContent.java
License:Apache License
/** * Load a stream.// w w w . j a va2s .com * * @param views * the stream history link. * @param searchTerm * the search term. */ private void loadStream(final List<String> views, final String searchTerm) { // save for change detection loadedViews = new ArrayList<String>(views); loadedSearchTerm = searchTerm; Window.scrollTo(0, 0); noResults.addClassName(StaticResourceBundle.INSTANCE.coreCss().displayNone()); Session.getInstance().getActionProcessor().setQueueRequests(true); addBookmark.setVisible(false); subscribeViaEmail.setVisible(false); feedLink.setVisible(false); streamOptionsPanel.getStyle().setDisplay(Display.BLOCK); streamDetailsComposite.init(); errorPanel.clear(); errorPanel.setVisible(false); AvatarBadgeManager.getInstance().clearBadges(); singleActivityMode = false; activitySpinner.removeClassName(StaticResourceBundle.INSTANCE.coreCss().displayNone()); moreLink.setVisible(false); streamPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().hidden()); currentRequestObj = StreamJsonRequestFactory.getEmptyRequest(); currentStream = new StreamScope(ScopeType.PERSON, Session.getInstance().getCurrentPerson().getAccountId()); ShowRecipient showRecipient = ShowRecipient.YES; streamContainerPanel.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().hasOwnerRights()); stickyActivityHolder.clear(); UIObject.setVisible(stickyActivityArea, false); renderer.setShowStickActivity(false); currentStreamEntity = null; deferLoadAwaitingQueryBuilt = false; deferLoadAwaitingEntityReceived = false; //getEmailContactLink.setVisible(false); boolean streamIsAnEntity = false; if (views == null || views.size() == 0 || views.get(0).equals("following") || ((views.get(0).equals("sort") && (views.size() == 2)))) { currentRequestObj = StreamJsonRequestFactory.setSourceAsFollowing(currentRequestObj); setAsActiveStream(followingFilterPanel); EventBus.getInstance().notifyObservers(new PostableStreamScopeChangeEvent(currentStream)); feedLink.setVisible(true); streamDetailsComposite.setStreamTitle("Following", CustomAvatar.FOLLOWING); streamDetailsComposite.setCondensedMode(true); currentDisplayName = "Following"; } else if (views.get(0).equals("person") && views.size() >= 2) { streamIsAnEntity = true; showRecipient = ShowRecipient.RESOURCE_ONLY; String accountId = views.get(1); currentRequestObj = StreamJsonRequestFactory.addRecipient(EntityType.PERSON, accountId, currentRequestObj); PersonalInformationModel.getInstance().fetch(accountId, false); currentStream.setScopeType(ScopeType.PERSON); currentStream.setUniqueKey(accountId); String mapKey = "person/" + accountId; setAsActiveStream(bookmarksWidgetMap.get(mapKey)); if (!bookmarksWidgetMap.containsKey(mapKey)) { addBookmark.setVisible(true); } else { addBookmark.setVisible(false); currentDisplayName = bookmarksWidgetMap.get(mapKey).getStreamName(); } subscribeViaEmail.setVisible(true); feedLink.setVisible(true); streamDetailsComposite.setCondensedMode(false); PersonActivitySubscriptionModel.getInstance().fetch(currentStream.getUniqueKey(), true); } else if (views.get(0).equals("group") && views.size() >= 2) { streamIsAnEntity = true; showRecipient = ShowRecipient.RESOURCE_ONLY; String shortName = views.get(1); currentRequestObj = StreamJsonRequestFactory.addRecipient(EntityType.GROUP, shortName, currentRequestObj); GroupModel.getInstance().fetch(shortName, false); currentStream.setScopeType(ScopeType.GROUP); currentStream.setUniqueKey(shortName); String mapKey = "group/" + shortName; setAsActiveStream(bookmarksWidgetMap.get(mapKey)); if (!bookmarksWidgetMap.containsKey(mapKey)) { addBookmark.setVisible(true); } else { addBookmark.setVisible(false); currentDisplayName = bookmarksWidgetMap.get(mapKey).getStreamName(); } subscribeViaEmail.setVisible(true); feedLink.setVisible(true); streamDetailsComposite.setCondensedMode(false); // Note: the links this will generate will only be visible if user is an admin/coordinator (via CSS) renderer.setShowStickActivity(true); deferLoadAwaitingEntityReceived = true; deferLoadAwaitingQueryBuilt = true; GroupActivitySubscriptionModel.getInstance().fetch(currentStream.getUniqueKey(), true); } else if (views.get(0).equals("custom") && views.size() >= 3) { currentRequestObj = StreamJsonRequestFactory.getJSONRequest(URL.decodeComponent(views.get(2))); setAsActiveStream(customStreamWidgetMap.get(Long.parseLong(views.get(1)))); currentStream.setScopeType(null); EventBus.getInstance().notifyObservers(new PostableStreamScopeChangeEvent(currentStream)); feedLink.setVisible(true); String streamName = customStreamWidgetMap.get(Long.parseLong(views.get(1))).getStreamName(); streamDetailsComposite.setStreamTitle(streamName, CustomAvatar.FOLLOWING); streamDetailsComposite.setCondensedMode(true); currentDisplayName = streamName; } else if (views.get(0).equals("everyone")) { currentRequestObj = StreamJsonRequestFactory.getEmptyRequest(); setAsActiveStream(everyoneFilterPanel); EventBus.getInstance().notifyObservers(new PostableStreamScopeChangeEvent(currentStream)); feedLink.setVisible(true); streamDetailsComposite.setStreamTitle("Everyone", CustomAvatar.EVERYONE); streamDetailsComposite.setCondensedMode(true); currentDisplayName = "Everyone"; } else if (views.size() == 1) { showRecipient = ShowRecipient.RESOURCE_ONLY; singleActivityMode = true; } if (searchTerm != null && searchTerm.length() > 0) { streamSearchStatusWidget.setSearchTerm(searchTerm); currentRequestObj = StreamJsonRequestFactory.setSearchTerm(searchTerm, currentRequestObj); searchContainer.addClassName(style.activeSearch()); searchBox.setText(searchTerm); } else { streamSearchStatusWidget.onSearchCanceled(); searchContainer.removeClassName(style.activeSearch()); } if (!streamIsAnEntity) { streamDetailsComposite.setVisible(true); } renderer.setShowRecipientInStream(showRecipient); if (!singleActivityMode) { streamOptionsPanel.getStyle().setDisplay(Display.BLOCK); String sortBy = "recent"; if (views != null && views.size() >= 2 && "sort".equals(views.get(views.size() - 2))) { sortBy = views.get(views.size() - 1); } recentSort.removeStyleName(style.activeSort()); popularSort.removeStyleName(style.activeSort()); activeSort.removeStyleName(style.activeSort()); sortKeyword = "date"; if ("recent".equals(sortBy)) { recentSort.addStyleName(style.activeSort()); sortKeyword = "date"; } else if ("popular".equals(sortBy)) { popularSort.addStyleName(style.activeSort()); sortKeyword = "interesting"; } else if ("active".equals(sortBy)) { activeSort.addStyleName(style.activeSort()); sortKeyword = "commentdate"; } currentRequestObj = StreamJsonRequestFactory.setSort(sortKeyword, currentRequestObj); // see notes where field declared deferLoadAwaitingQueryBuilt = false; if (!deferLoadAwaitingEntityReceived) { fetchStream(currentRequestObj); } } else { streamDetailsComposite.setCondensedMode(false); streamOptionsPanel.getStyle().setDisplay(Display.NONE); postBox.setVisible(false); try { ActivityModel.getInstance().fetch(Long.parseLong(views.get(0)), true); } catch (Exception e) { // Do nothing. int x = 0; } } Session.getInstance().getActionProcessor().fireQueuedRequests(); Session.getInstance().getActionProcessor().setQueueRequests(false); }
From source file:org.gss_project.gss.admin.client.ui.PermissionsList.java
License:Open Source License
public void updateTable() { int i = 1;// w w w . j a v a2s . com if (toRemove != null) { permissions.remove(toRemove); toRemove = null; } for (final PermissionDTO dto : permissions) { Button removeButton = new Button("remove", new ClickHandler() { @Override public void onClick(ClickEvent event) { toRemove = dto; updateTable(); hasChanges = true; } }); if (dto.getUser() != null) if (dto.getUser() != null && dto.getUser().getUsername().equals(owner)) { permTable.setHTML(i, 0, "<span>" + " Owner</span>"); removeButton.setVisible(false); } else { HTML userLabel = new HTML("<a href='#'>" + dto.getUser().getUsername() + "</a></span>"); permTable.setWidget(i, 0, userLabel); userLabel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { TwoAdmin.get().searchUsers("username:" + dto.getUser().getUsername()); } }); } else if (dto.getGroup() != null) { //String user = GSS.get().getCurrentUserResource().getUsername(); String[] names = dto.getGroup().getName().split("/"); String name = URL.decodeComponent(names[names.length - 1]); //String ownr = names.length>1 ? URL.decodeComponent(names[names.length - 3]) : user; String groupName = name; permTable.setHTML(i, 0, "<span>" + " " + groupName + "</span>"); } CheckBox read = new CheckBox(); read.setValue(dto.getRead()); CheckBox write = new CheckBox(); write.setValue(dto.getWrite()); CheckBox modify = new CheckBox(); modify.setValue(dto.getModifyACL()); permTable.setWidget(i, 1, read); permTable.setWidget(i, 2, write); permTable.setWidget(i, 3, modify); if (dto.getUser() != null && dto.getUser().getUsername().equals(owner) || !allowEditPermissions) { read.setEnabled(false); write.setEnabled(false); modify.setEnabled(false); } else permTable.setWidget(i, 4, removeButton); permTable.getFlexCellFormatter().setStyleName(i, 0, "props-labels"); permTable.getFlexCellFormatter().setHorizontalAlignment(i, 1, HasHorizontalAlignment.ALIGN_CENTER); permTable.getFlexCellFormatter().setHorizontalAlignment(i, 2, HasHorizontalAlignment.ALIGN_CENTER); permTable.getFlexCellFormatter().setHorizontalAlignment(i, 3, HasHorizontalAlignment.ALIGN_CENTER); i++; } for (; i < permTable.getRowCount(); i++) permTable.removeRow(i); hasChanges = false; }
From source file:org.gss_project.gss.web.client.rest.resource.FileResource.java
License:Open Source License
@Override public void createFromJSON(String text) { JSONObject metadata = (JSONObject) JSONParser.parse(text); name = unmarshallString(metadata, "name"); name = URL.decodeComponent(name); path = unmarshallString(metadata, "path"); path = URL.decodeComponent(path); owner = unmarshallString(metadata, "owner"); contentType = unmarshallString(metadata, "content"); readForAll = unmarshallBoolean(metadata, "readForAll"); versioned = unmarshallBoolean(metadata, "versioned"); createdBy = unmarshallString(metadata, "createdBy"); modifiedBy = unmarshallString(metadata, "modifiedBy"); setShared(unmarshallBoolean(metadata, "shared")); if (metadata.get("version") != null) version = new Integer(metadata.get("version").toString()); deleted = unmarshallBoolean(metadata, "deleted"); if (deleted)// ww w .j a v a 2 s . c o m GWT.log("FOUND A DELETED FILE:" + name, null); if (metadata.get("folder") != null) { JSONObject folder = metadata.get("folder").isObject(); folderURI = unmarshallString(folder, "uri"); folderName = unmarshallString(folder, "name"); if (folderName != null) folderName = URL.decodeComponent(folderName); } if (metadata.get("permissions") != null) { JSONArray perm = metadata.get("permissions").isArray(); if (perm != null) for (int i = 0; i < perm.size(); i++) { JSONObject obj = perm.get(i).isObject(); if (obj != null) { PermissionHolder permission = new PermissionHolder(); if (obj.get("user") != null) permission.setUser(unmarshallString(obj, "user")); if (obj.get("group") != null) { String group = unmarshallString(obj, "group"); group = URL.decodeComponent(group); permission.setGroup(group); } permission.setRead(unmarshallBoolean(obj, "read")); permission.setWrite(unmarshallBoolean(obj, "write")); permission.setModifyACL(unmarshallBoolean(obj, "modifyACL")); permissions.add(permission); } } } if (metadata.get("tags") != null) { JSONArray perm = metadata.get("tags").isArray(); if (perm != null) for (int i = 0; i < perm.size(); i++) { JSONString obj = perm.get(i).isString(); if (obj != null) tags.add(URL.decodeComponent(obj.stringValue())); } } if (metadata.get("creationDate") != null) creationDate = new Date(new Long(metadata.get("creationDate").toString())); if (metadata.get("modificationDate") != null) modificationDate = new Date(new Long(metadata.get("modificationDate").toString())); if (metadata.get("size") != null) contentLength = Long.parseLong(metadata.get("size").toString()); }
From source file:org.gss_project.gss.web.client.rest.resource.FolderResource.java
License:Open Source License
@Override public void createFromJSON(String text) { JSONObject json = (JSONObject) JSONParser.parse(text); name = unmarshallString(json, "name"); owner = unmarshallString(json, "owner"); createdBy = unmarshallString(json, "createdBy"); modifiedBy = unmarshallString(json, "modifiedBy"); deleted = unmarshallBoolean(json, "deleted"); shared = unmarshallBoolean(json, "shared"); readForAll = unmarshallBoolean(json, "readForAll"); if (deleted)/* w ww.j av a 2s. c o m*/ GWT.log("FOUND A DELETED FOLDER:" + name, null); if (json.get("parent") != null) { JSONObject parent = json.get("parent").isObject(); parentURI = unmarshallString(parent, "uri"); parentName = unmarshallString(parent, "name"); } if (json.get("permissions") != null) { JSONArray perm = json.get("permissions").isArray(); if (perm != null) for (int i = 0; i < perm.size(); i++) { JSONObject obj = perm.get(i).isObject(); if (obj != null) { PermissionHolder permission = new PermissionHolder(); if (obj.get("user") != null) permission.setUser(unmarshallString(obj, "user")); if (obj.get("group") != null) permission.setGroup(URL.decodeComponent(unmarshallString(obj, "group"))); permission.setRead(unmarshallBoolean(obj, "read")); permission.setWrite(unmarshallBoolean(obj, "write")); permission.setModifyACL(unmarshallBoolean(obj, "modifyACL")); permissions.add(permission); } } } if (json.get("folders") != null) { JSONArray subs = json.get("folders").isArray(); if (subs != null) for (int i = 0; i < subs.size(); i++) { JSONObject so = subs.get(i).isObject(); if (so != null) { String subUri = unmarshallString(so, "uri"); String subName = unmarshallString(so, "name"); if (subUri != null && subName != null) { if (!subUri.endsWith("/")) subUri = subUri + "/"; FolderResource sub = new FolderResource(subUri); sub.setName(subName); sub.setParentURI(uri); sub.setParentName(name); sub.setNeedsExpanding(true); folders.add(sub); subfolderPaths.add(subUri); } } } } if (json.get("files") != null) { JSONArray subs = json.get("files").isArray(); if (subs != null) for (int i = 0; i < subs.size(); i++) { JSONObject fo = subs.get(i).isObject(); if (fo != null) { String fname = unmarshallString(fo, "name"); String fowner = unmarshallString(fo, "owner"); String fcontent = unmarshallString(fo, "content"); String fpath = unmarshallString(fo, "path"); Boolean fshared = unmarshallBoolean(fo, "shared"); fpath = URL.decodeComponent(fpath); Integer fversion = null; if (fo.get("version") != null) fversion = new Integer(fo.get("version").toString()); boolean fdeleted = unmarshallBoolean(fo, "deleted"); Date fcreationDate = null; if (fo.get("creationDate") != null) fcreationDate = new Date(new Long(fo.get("creationDate").toString())); Date fmodificationDate = null; if (fo.get("modificationDate") != null) fmodificationDate = new Date(new Long(fo.get("modificationDate").toString())); String furi = unmarshallString(fo, "uri"); Long fsize = 0L; if (fo.get("size") != null) fsize = new Long(fo.get("size").toString()); filePaths.add(furi); FileResource fs = new FileResource(furi); fs.setName(fname); fs.setOwner(fowner); fs.setPath(fpath); fs.setVersioned(unmarshallBoolean(fo, "versioned")); fs.setVersion(fversion); fs.setContentLength(fsize); fs.setDeleted(fdeleted); fs.setShared(fshared); fs.setCreationDate(fcreationDate); fs.setModificationDate(fmodificationDate); fs.setContentType(fcontent); files.add(fs); } } } if (json.get("creationDate") != null) creationDate = new Date(new Long(json.get("creationDate").toString())); if (json.get("modificationDate") != null) modificationDate = new Date(new Long(json.get("modificationDate").toString())); }