List of usage examples for com.google.gwt.http.client URL decodeComponent
@Deprecated public static String decodeComponent(String encodedURLComponent)
From source file:org.gss_project.gss.web.client.rest.resource.GroupResource.java
License:Open Source License
@Override public String getName() { String[] names = uri.split("/"); return URL.decodeComponent(names[names.length - 1]); }
From source file:org.gss_project.gss.web.client.rest.resource.OtherUserResource.java
License:Open Source License
@Override public void createFromJSON(String text) { JSONObject json = (JSONObject) JSONParser.parse(text); 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.setNeedsExpanding(true); folders.add(sub); subfolderPaths.add(subUri); }//ww w . j av a 2s . c o m } } } 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"); Boolean fshared = unmarshallBoolean(fo, "shared"); boolean fversioned = unmarshallBoolean(fo, "versioned"); 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); String fpath = unmarshallString(fo, "path"); fpath = URL.decodeComponent(fpath); FileResource fs = new FileResource(furi); fs.setName(fname); fs.setPath(fpath); fs.setOwner(fowner); fs.setVersion(fversion); fs.setContentLength(fsize); fs.setDeleted(fdeleted); fs.setCreationDate(fcreationDate); fs.setModificationDate(fmodificationDate); fs.setShared(fshared); fs.setVersioned(fversioned); fs.setContentType(fcontent); files.add(fs); } } } }
From source file:org.gss_project.gss.web.client.rest.resource.SearchResource.java
License:Open Source License
@Override public void createFromJSON(String text) { JSONArray subs = JSONParser.parse(text).isArray(); if (subs != null) for (int i = 0; i < subs.size(); i++) { JSONObject fo = subs.get(i).isObject(); if (fo != null) { if (i == 0 && unmarshallInt(fo, "length") != -1) { setSize(unmarshallInt(fo, "length")); } else { 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"); boolean fversioned = unmarshallBoolean(fo, "versioned"); 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);//from w ww . j a v a2s .c om fs.setOwner(fowner); fs.setVersion(fversion); fs.setContentLength(fsize); fs.setDeleted(fdeleted); fs.setCreationDate(fcreationDate); fs.setModificationDate(fmodificationDate); fs.setContentType(fcontent); fs.setPath(fpath); fs.setShared(fshared); fs.setVersioned(fversioned); files.add(fs); } } } }
From source file:org.gss_project.gss.web.client.rest.resource.SharedResource.java
License:Open Source License
@Override public void createFromJSON(String text) { JSONObject json = (JSONObject) JSONParser.parse(text); 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.setNeedsExpanding(true); folders.add(sub); subfolderPaths.add(subUri); }/* www .j a v a 2s.c o m*/ } } } 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"); boolean fversioned = unmarshallBoolean(fo, "versioned"); 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); String fpath = unmarshallString(fo, "path"); fpath = URL.decodeComponent(fpath); FileResource fs = new FileResource(furi); fs.setPath(fpath); fs.setName(fname); fs.setOwner(fowner); fs.setVersion(fversion); fs.setVersioned(unmarshallBoolean(fo, "versioned")); fs.setContentLength(fsize); fs.setDeleted(fdeleted); fs.setShared(unmarshallBoolean(fo, "shared")); fs.setVersioned(fversioned); fs.setCreationDate(fcreationDate); fs.setModificationDate(fmodificationDate); fs.setContentType(fcontent); files.add(fs); } } } }
From source file:org.gss_project.gss.web.client.rest.resource.TrashResource.java
License:Open Source License
@Override public void createFromJSON(String text) { JSONObject json = (JSONObject) JSONParser.parse(text); 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"); subName = URL.decodeComponent(subName); if (subUri != null && subName != null) { if (!subUri.endsWith("/")) subUri = subUri + "/"; FolderResource sub = new FolderResource(subUri); sub.setName(subName); sub.setNeedsExpanding(true); folders.add(sub); subfolderPaths.add(subUri); }/* w w w .j av a 2 s . com*/ } } } 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"); Boolean fshared = unmarshallBoolean(fo, "shared"); Boolean fversioned = unmarshallBoolean(fo, "versioned"); String fpath = unmarshallString(fo, "path"); 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.setVersion(fversion); fs.setContentLength(fsize); fs.setDeleted(fdeleted); fs.setPath(fpath); fs.setCreationDate(fcreationDate); fs.setModificationDate(fmodificationDate); fs.setContentType(fcontent); fs.setShared(fshared); fs.setVersioned(fversioned); files.add(fs); } } } }
From source file:org.gss_project.gss.web.client.rest.resource.TrashResource.java
License:Open Source License
public List<FolderResource> getTrashedFolders() { List<FolderResource> res = new ArrayList<FolderResource>(); for (String s : subfolderPaths) { String[] pathElements = s.split("/"); FolderResource tr = new FolderResource(s); tr.setName(URL.decodeComponent(pathElements[pathElements.length - 1])); res.add(tr);/*from w w w . j a va2s .c o m*/ } return res; }
From source file:org.gwtportlets.portlet.client.util.GenUtil.java
License:Open Source License
/** * Get the target history token if event is for an internal link or * null otherwise.// w w w . j ava2 s. co m */ public static String getTargetHistoryToken(Event event) { Element link; try { link = DOM.eventGetTarget(event); } catch (Exception e) { return null; } if (link != null && isLink(link)) { String base = getBaseUrl() + "#"; String href = null; if (DOM.getElementProperty(link, "tagName").equalsIgnoreCase("a")) { href = URL.decodeComponent(DOM.getElementProperty(link, "href")); } else if (DOM.getElementProperty(link, "tagName").equalsIgnoreCase("img")) { String prop = DOM.getElementProperty(DOM.getParent(link), "href"); if (prop != null) { href = URL.decodeComponent(prop); } } if (href != null && href.startsWith(base)) { return href.substring(base.length()); } } return null; }
From source file:org.waveprotocol.wave.client.clipboard.AnnotationSerializer.java
License:Apache License
private static String unescape(String s) { return URL.decodeComponent(s); }
From source file:org.waveprotocol.wave.client.gadget.renderer.GadgetWidget.java
License:Apache License
/** * Utility function to convert an attribute string to a Gadget StateMap. * * @param attribute attribute value string. * @return StateMap constructed from the attribute value. *//* w w w .ja v a 2 s. com*/ private StateMap attributeToState(String attribute) { StateMap result = StateMap.create(); if ((attribute != null) && !attribute.equals("")) { log("Unescaped attribute: ", URL.decodeComponent(attribute)); result.fromJson(URL.decodeComponent(attribute)); log("State map: ", result.toJson()); } return result; }
From source file:org.waveprotocol.wave.client.gadget.renderer.GadgetWidget.java
License:Apache License
/** * Processes changes in the gadget element attributes. * TODO(user): move some of this code to the handler. * * @param name attribute name.//from w ww . j ava2 s. c o m * @param value new attribute value. */ public void onAttributeModified(String name, String value) { log("Attribute '", name, "' changed to '", value, "'"); if (userPrefs == null) { log("Attribute changed before the gadget is initialized."); return; } if (name.equals(URL_ATTRIBUTE)) { source = (value == null) ? "" : value; } else if (name.equals(TITLE_ATTRIBUTE)) { String title = (value == null) ? "" : URL.decodeComponent(value); if (!title.equals(ui.getTitleLabelText())) { log("Updating title: ", title); ui.setTitleLabelText(title); } } else if (name.equals(PREFS_ATTRIBUTE)) { updatePrefsFromAttribute(value); } else if (name.equals(STATE_ATTRIBUTE)) { StateMap newState = attributeToState(value); if (!state.compare(newState)) { String podiumState = newState.get(PODIUM_STATE_NAME); if ((podiumState != null) && (!podiumState.equals(state.get(PODIUM_STATE_NAME)))) { sendPodiumOnStateChangedRpc(getGadgetName(), podiumState); } state.clear(); state.copyFrom(newState); log("Updating gadget state: ", state.toJson()); gadgetStateSubmitter.submit(); } } }