Java Code Examples for com.google.gwt.http.client.URL#encode()
The following examples show how to use
com.google.gwt.http.client.URL#encode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GUIExternalCall.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public String getUrl(boolean document, Long[] ids, String[] titles) { String url = getBaseUrl(); url += "?type=" + (document ? "document" : "folder"); url += "&id="; for (Long id : ids) { if (!url.endsWith("=")) url += ","; url += id.toString(); } for (String param : getParameters()) { if ("user".equals(param.trim())) url += "&user=" + Session.get().getUser().getUsername(); else if ("filename".equals(param.trim())) { url += "&filename="; for (String title : titles) { if (!url.endsWith("=")) url += ","; url += title; } } } if (getSuffix() != null && !"".equals(getSuffix())) url += "&" + getSuffix(); return URL.encode(url); }
Example 2
Source File: Util.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static String downloadAttachmentURL(long docId, String fileVersion, String attachmentFileName) { String url = contextPath() + "download-attachment?docId=" + docId; if (fileVersion != null) url += "&fileVersion=" + fileVersion; if (attachmentFileName != null) url += "&attachmentFileName=" + URL.encode(attachmentFileName); return url; }
Example 3
Source File: UrlBuilder.java From geomajas-gwt2-quickstart-application with GNU Affero General Public License v3.0 | 5 votes |
/** * Build the URL and return it as an encoded string. * * @return the encoded URL string */ public String toString() { StringBuilder url = new StringBuilder(baseUrl); if (params.size() > 0) { url.append("?"); for (Iterator<String> iterator = params.keySet().iterator(); iterator.hasNext();) { String name = iterator.next(); url.append(name).append("=").append(params.get(name)); if (iterator.hasNext()) { url.append("&"); } } } return URL.encode(url.toString()); }
Example 4
Source File: FetchProfilesBuilder.java From swellrt with Apache License 2.0 | 4 votes |
private static String getUrl(ProfileRequest profileRequest) { String params = "?addresses=" + Joiner.on(",").join(profileRequest.getAddresses()); return SEARCH_URL_BASE + "/" + URL.encode(params); }
Example 5
Source File: ClientPercentEncoderDecoder.java From swellrt with Apache License 2.0 | 4 votes |
@Override public String encode(String decodedValue) { return URL.encode(decodedValue); }
Example 6
Source File: EditToolbar.java From swellrt with Apache License 2.0 | 4 votes |
private void createInsertAttachmentButton(ToolbarView toolbar, final ParticipantId user) { WaveRef waveRef = WaveRef.of(waveId); Preconditions.checkState(waveRef != null); final String waveRefToken = URL.encode(GwtWaverefEncoder.encodeToUriQueryString(waveRef)); new ToolbarButtonViewBuilder().setIcon(css.insertAttachment()).setTooltip("Insert attachment") .applyTo(toolbar.addClickButton(), new ToolbarClickButton.Listener() { @Override public void onClicked() { int tmpCursor = -1; FocusedRange focusedRange = editor.getSelectionHelper().getSelectionRange(); if (focusedRange != null) { tmpCursor = focusedRange.getFocus(); } final int cursorLoc = tmpCursor; AttachmentPopupView attachmentView = new AttachmentPopupWidget(); attachmentView.init(new Listener() { @Override public void onShow() { } @Override public void onHide() { } @Override public void onDone(String encodedWaveRef, String attachmentId, String fullFileName) { // Insert a file name linking to the attachment URL. int lastSlashPos = fullFileName.lastIndexOf("/"); int lastBackSlashPos = fullFileName.lastIndexOf("\\"); String fileName = fullFileName; if (lastSlashPos != -1) { fileName = fullFileName.substring(lastSlashPos + 1, fullFileName.length()); } else if (lastBackSlashPos != -1) { fileName = fullFileName.substring(lastBackSlashPos + 1, fullFileName.length()); } /* * From UploadToolbarAction in Walkaround * @author [email protected] (David Hearnden) */ CMutableDocument doc = editor.getDocument(); FocusedContentRange selection = editor.getSelectionHelper().getSelectionPoints(); Point<ContentNode> point; if (selection != null) { point = selection.getFocus(); } else { // Focus was probably lost. Bring it back. editor.focus(false); selection = editor.getSelectionHelper().getSelectionPoints(); if (selection != null) { point = selection.getFocus(); } else { // Still no selection. Oh well, put it at the end. point = doc.locate(doc.size() - 1); } } XmlStringBuilder content = ImageThumbnail.constructXml(attachmentId, fileName); ImageThumbnailWrapper thumbnail = ImageThumbnailWrapper.of(doc.insertXml(point, content)); thumbnail.setAttachmentId(attachmentId); } }); attachmentView.setAttachmentId(attachmentIdGenerator.newAttachmentId()); attachmentView.setWaveRef(waveRefToken); attachmentView.show(); } }); }
Example 7
Source File: UrlCodecImpl.java From requestor with Apache License 2.0 | 4 votes |
@Override public String encode(String decodedURL) { return URL.encode(decodedURL); }
Example 8
Source File: FetchProfilesBuilder.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
private static String getUrl(ProfileRequest profileRequest) { String params = "?addresses=" + Joiner.on(",").join(profileRequest.getAddresses()); return SEARCH_URL_BASE + "/" + URL.encode(params); }
Example 9
Source File: ClientPercentEncoderDecoder.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
@Override public String encode(String decodedValue) { return URL.encode(decodedValue); }
Example 10
Source File: EditToolbar.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
private void createInsertAttachmentButton(ToolbarView toolbar, final ParticipantId user) { WaveRef waveRef = WaveRef.of(waveId); Preconditions.checkState(waveRef != null); final String waveRefToken = URL.encode(GwtWaverefEncoder.encodeToUriQueryString(waveRef)); new ToolbarButtonViewBuilder().setIcon(css.insertAttachment()).setTooltip("Insert attachment") .applyTo(toolbar.addClickButton(), new ToolbarClickButton.Listener() { @Override public void onClicked() { int tmpCursor = -1; FocusedRange focusedRange = editor.getSelectionHelper().getSelectionRange(); if (focusedRange != null) { tmpCursor = focusedRange.getFocus(); } final int cursorLoc = tmpCursor; AttachmentPopupView attachmentView = new AttachmentPopupWidget(); attachmentView.init(new Listener() { @Override public void onShow() { } @Override public void onHide() { } @Override public void onDone(String encodedWaveRef, String attachmentId, String fullFileName) { // Insert a file name linking to the attachment URL. int lastSlashPos = fullFileName.lastIndexOf("/"); int lastBackSlashPos = fullFileName.lastIndexOf("\\"); String fileName = fullFileName; if (lastSlashPos != -1) { fileName = fullFileName.substring(lastSlashPos + 1, fullFileName.length()); } else if (lastBackSlashPos != -1) { fileName = fullFileName.substring(lastBackSlashPos + 1, fullFileName.length()); } /* * From UploadToolbarAction in Walkaround * @author [email protected] (David Hearnden) */ CMutableDocument doc = editor.getDocument(); FocusedContentRange selection = editor.getSelectionHelper().getSelectionPoints(); Point<ContentNode> point; if (selection != null) { point = selection.getFocus(); } else { // Focus was probably lost. Bring it back. editor.focus(false); selection = editor.getSelectionHelper().getSelectionPoints(); if (selection != null) { point = selection.getFocus(); } else { // Still no selection. Oh well, put it at the end. point = doc.locate(doc.size() - 1); } } XmlStringBuilder content = ImageThumbnail.constructXml(attachmentId, fileName); ImageThumbnailWrapper thumbnail = ImageThumbnailWrapper.of(doc.insertXml(point, content)); thumbnail.setAttachmentId(attachmentId); } }); attachmentView.setAttachmentId(attachmentIdGenerator.newAttachmentId()); attachmentView.setWaveRef(waveRefToken); attachmentView.show(); } }); }