Java Code Examples for com.google.gwt.http.client.URL#encodeQueryString()
The following examples show how to use
com.google.gwt.http.client.URL#encodeQueryString() .
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: FindDocumentSelectPopup.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * 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 2
Source File: OpenProjectDialog.java From geowe-core with GNU General Public License v3.0 | 6 votes |
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
Source File: Preview.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * 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 4
Source File: GadgetNonEditorGwtTest.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Tests the IFrame URI generator of Gadget class. */ public void testIframeUri() { String xmlSource = "http://test.com/gadget.xml"; String href = "http://" + Location.getHost(); String hrefEscaped = href.replace("?", "%3F"); if (hrefEscaped.endsWith("/")) { hrefEscaped = hrefEscaped.substring(0, hrefEscaped.length() - 1); } int clientInstanceId = 1234; GadgetUserPrefs userPrefs = GadgetUserPrefs.create(); userPrefs.put("pref1", "value1"); userPrefs.put("pref2", "value2"); GadgetMetadata metadata = getTestMetadata(xmlSource); WaveId waveId = WaveId.of("wave.google.com", "123"); WaveletId waveletId = WaveletId.of("wave.google.com", "conv+root"); WaveletName name = WaveletName.of(waveId, waveletId); String securityToken = "SECURITY"; GadgetWidget gadget = GadgetWidget.createForTesting( clientInstanceId, userPrefs, name, securityToken, new FakeLocale()); int gadgetInstanceId = -12345; String url = gadget.buildIframeUrl(gadgetInstanceId, metadata.getIframeUrl(VIEW_NAME)); String expectedValue = "//0" + GADGET_SERVER + "/gadgets" + "/ifr?url=http://test.com/gadget.xml&view=canvas&nocache=1&mid=" + gadgetInstanceId + "&lang=wizard&country=OZ&parent=" + hrefEscaped + "&wave=1&waveId=" + URL.encodeQueryString(ModernIdSerialiser.INSTANCE.serialiseWaveId(waveId)) + "#rpctoken=" + gadget.getRpcToken() + "&st=" + securityToken + "&up_pref1=value1&up_pref2=value2"; assertEquals(expectedValue, url); }
Example 5
Source File: JsoSearchBuilderImpl.java From swellrt with Apache License 2.0 | 5 votes |
private static String getUrl(SearchRequest searchRequest) { String query = URL.encodeQueryString(searchRequest.getQuery()); String params = "?query=" + query + "&index=" + searchRequest.getIndex() + "&numResults=" + searchRequest.getNumResults(); return SEARCH_URL_BASE + "/" + params; }
Example 6
Source File: MultivaluedParamComposition.java From requestor with Apache License 2.0 | 5 votes |
/** * 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, String... values) { assertNotNullOrEmpty(name, "Parameter name cannot be null or empty."); String uriPart = URL.encodeQueryString(name) + "="; String sep = ""; for (String value : values) { assertNotNullOrEmpty(value, "Parameter value of *" + name + "* null or empty. You must inform a valid value"); uriPart += sep + URL.encodeQueryString(value); sep = ","; } return uriPart; }
Example 7
Source File: PageFilter.java From unitime with Apache License 2.0 | 5 votes |
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 8
Source File: RoomsPage.java From unitime with Apache License 2.0 | 5 votes |
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 9
Source File: TeachingAssignmentsPage.java From unitime with Apache License 2.0 | 5 votes |
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 10
Source File: TeachingRequestsPage.java From unitime with Apache License 2.0 | 5 votes |
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 11
Source File: GeoDataImportDialog.java From geowe-core with GNU General Public License v3.0 | 5 votes |
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 12
Source File: Util.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Download file by UUID */ public static void downloadFileByUUID(String uuid, String params) { if (!params.equals("") && !params.endsWith("&")) { params += "&"; } final Element downloadIframe = RootPanel.get("__download").getElement(); String url = RPCService.DownloadServlet + "?" + params + "uuid=" + URL.encodeQueryString(uuid); DOM.setElementAttribute(downloadIframe, "src", url); }
Example 13
Source File: Util.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Download file */ public static void downloadFilePdf(String uuid) { final Element downloadIframe = RootPanel.get("__download").getElement(); String url = RPCService.ConverterServlet + "?inline=false&toPdf=true&uuid=" + URL.encodeQueryString(uuid); DOM.setElementAttribute(downloadIframe, "src", url); Main.get().conversionStatus.getStatus(); }
Example 14
Source File: JsoSearchBuilderImpl.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
private static String getUrl(SearchRequest searchRequest) { String query = URL.encodeQueryString(searchRequest.getQuery()); String params = "?query=" + query + "&index=" + searchRequest.getIndex() + "&numResults=" + searchRequest.getNumResults(); return SEARCH_URL_BASE + "/" + params; }
Example 15
Source File: Util.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * downloadFilesByUUID */ public static void downloadFilesByUUID(List<String> uuidList, String params) { if (!params.equals("")) { params = "&" + params; } final Element downloadIframe = RootPanel.get("__download").getElement(); String url = RPCService.DownloadServlet + "?export" + params; for (String uuid : uuidList) { url += "&uuidList=" + URL.encodeQueryString(uuid); } DOM.setElementAttribute(downloadIframe, "src", url); }
Example 16
Source File: Util.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Download file by path */ @Deprecated public static void downloadFile(String path, String params) { if (!params.equals("") && !params.endsWith("&")) { params += "&"; } final Element downloadIframe = RootPanel.get("__download").getElement(); String url = RPCService.DownloadServlet + "?" + params + "path=" + URL.encodeQueryString(path); DOM.setElementAttribute(downloadIframe, "src", url); }
Example 17
Source File: UrlCodecImpl.java From requestor with Apache License 2.0 | 4 votes |
@Override public String encodeQueryString(String decodedURLComponent) { return URL.encodeQueryString(decodedURLComponent); }
Example 18
Source File: Mail.java From document-management-system with GNU General Public License v2.0 | 4 votes |
/** * set * * @param mail */ public void set(GWTMail mail) { this.mail = mail; HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(new HTML(mail.getUuid())); hPanel.add(Util.hSpace("3px")); hPanel.add(new Clipboard(mail.getUuid())); tableProperties.setWidget(0, 1, hPanel); tableProperties.setHTML(1, 1, mail.getSubject()); tableProperties.setHTML(2, 1, mail.getParentPath()); tableProperties.setHTML(3, 1, Util.formatSize(mail.getSize())); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern")); tableProperties.setHTML(4, 1, dtf.format(mail.getCreated()) + " " + Main.i18n("mail.by") + " " + mail.getAuthor()); tableProperties.setHTML(6, 1, mail.getMimeType()); tableProperties.setWidget(7, 1, keywordManager.getKeywordPanel()); // Enable select tableProperties.getFlexCellFormatter().setStyleName(0, 1, "okm-EnableSelect"); tableProperties.getFlexCellFormatter().setStyleName(1, 1, "okm-EnableSelect"); tableProperties.getFlexCellFormatter().setStyleName(2, 1, "okm-EnableSelect"); // URL clipboard button String url = Main.get().workspaceUserProperties.getApplicationURL(); url += "?uuid=" + URL.encodeQueryString(URL.encodeQueryString(mail.getUuid())); tableProperties.setWidget(8, 1, new Clipboard(url)); // Webdav button String webdavUrl = Main.get().workspaceUserProperties.getApplicationURL(); String webdavPath = mail.getPath(); // Replace only in case webdav fix is enabled if (Main.get().workspaceUserProperties.getWorkspace() != null && Main.get().workspaceUserProperties.getWorkspace().isWebdavFix()) { webdavPath = webdavPath.replace("okm:", "okm_"); } // Login case write empty folder if (!webdavUrl.isEmpty()) { webdavPath = Util.encodePathElements(webdavPath); webdavUrl = webdavUrl.substring(0, webdavUrl.lastIndexOf('/')) + "/webdav" + webdavPath; } tableProperties.setWidget(9, 1, new Clipboard(webdavUrl)); remove = ((mail.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE); // Enables or disables change keywords with user permissions and document is not check-out or locked if (remove) { keywordManager.setVisible(true); categoryManager.setVisible(true); } else { keywordManager.setVisible(false); categoryManager.setVisible(false); } // Sets wordWrap for al rows for (int i = 0; i < 8; i++) { setRowWordWarp(i, 1, true, tableProperties); } // keywords keywordManager.reset(); keywordManager.setObject(mail, remove); keywordManager.drawAll(); // Categories categoryManager.removeAllRows(); categoryManager.setObject(mail, remove); categoryManager.drawAll(); }
Example 19
Source File: Util.java From document-management-system with GNU General Public License v2.0 | 4 votes |
/** * print file */ public static void print(String uuid) { final Element printIframe = RootPanel.get("__print").getElement(); String url = RPCService.ConverterServlet + "?inline=true&print=true&toPdf=true&uuid=" + URL.encodeQueryString(uuid); DOM.setElementAttribute(printIframe, "src", url); }
Example 20
Source File: FormDataSerializerUrlEncoded.java From requestor with Apache License 2.0 | 4 votes |
private String encode(String value) { return URL.encodeQueryString(value); }