List of usage examples for com.google.gwt.http.client URL encode
public static String encode(String decodedURL)
From source file:org.sonar.gwt.JsonUtils.java
License:Open Source License
public static void requestJson(String url, JSONHandler handler) { if (!url.endsWith("&") && !url.endsWith("?")) { url += "&"; }/* w ww . j a va 2 s. c o m*/ if (!url.contains("format=json")) { url += "format=json&"; } if (!url.contains("callback=")) { // IMPORTANT : the url should ended with ?callback= or &callback= for JSONP calls url += "callback="; } makeJSONRequest(requestId++, URL.encode(url), handler); }
From source file:org.sonar.plugins.core.ui.pageselector.client.PagePanel.java
License:Open Source License
private void loadEmbeddedPage(String resourceId) { final RootPanel panel = RootPanel.get(rootPanelId); panel.add(new Loading()); String url = def.getUrl();//from ww w . ja v a2s . co m if (url == null) { url = "/plugins/resource/" + resourceId + "?page=" + def.getId() + "&layout=false&hd=false"; } else { url += resourceId; } RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(Links.baseUrl() + url)); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { Utils.showError("Can not load the page " + request.toString()); } public void onResponseReceived(Request request, Response response) { panel.clear(); panel.add(new HTML(response.getText())); } }); } catch (RequestException e) { Utils.showError("Can not connect to server: " + url); } }
From source file:org.spiffyui.hellospiffymaven.client.Index.java
License:Apache License
/** * Send the REST request to the server and read the response back. */// w w w .ja v a 2 s . c om private void sendRequest() { String q = m_text.getValue().trim(); if (q.equals("")) { MessageUtil.showWarning("Enter your name in the text field.", false); return; } RESTility.callREST("simple/" + URL.encode(q), new RESTCallback() { @Override public void onSuccess(JSONValue val) { showSuccessMessage(val); } @Override public void onError(int statusCode, String errorResponse) { MessageUtil.showError("Error. Status Code: " + statusCode + " " + errorResponse); } @Override public void onError(RESTException e) { MessageUtil.showError(e.getReason()); } }); }
From source file:org.switchyard.console.client.ui.application.ApplicationPresenter.java
License:Apache License
/** * Notifies the presenter that the user has selected an application. The * presenter will load the application details and pass them back to the * view to be displayed.// w w w . j a v a2 s . c o m * * @param application the selected application. */ public void onApplicationSelected(Application application) { PlaceRequest request = new PlaceRequest(NameTokens.APPLICATIONS_PRESENTER); if (application != null) { request = request.with(NameTokens.APPLICATION_NAME_PARAM, URL.encode(application.getName())); } _placeManager.revealRelativePlace(request, -1); }
From source file:org.switchyard.console.client.ui.application.ApplicationPresenter.java
License:Apache License
/** * Notifies the presenter that the user has selected an artifact reference. * The presenter will navigate to the artifacts page. * /*ww w . j a v a 2 s. c om*/ * @param artifact the selected artifact. */ public void onArtifactSelected(ArtifactReference artifact) { PlaceRequest request = new PlaceRequest(NameTokens.ARTIFACTS_PRESENTER); if (artifact != null) { request = request.with(NameTokens.ARTIFACT_REFERENCE_KEY_PARAM, URL.encode(artifact.key())); } _placeManager.revealRelativePlace(request, -1); }
From source file:org.switchyard.console.client.ui.application.ApplicationPresenter.java
License:Apache License
/** * Notifies the presenter that the user wishes to view details about a * specific service.//from w ww . j a v a 2 s. c o m * * @param service the service. * @param application the application containing the service. */ public void onNavigateToService(Service service, Application application) { if (service == null || application == null) { Console.error(Singleton.MESSAGES.error_navigateToService()); return; } _placeManager.revealRelativePlace(new PlaceRequest(NameTokens.SERVICES_PRESENTER) .with(NameTokens.SERVICE_NAME_PARAM, URL.encode(service.getName())) .with(NameTokens.APPLICATION_NAME_PARAM, URL.encode(application.getName())), -1); }
From source file:org.switchyard.console.client.ui.application.ApplicationPresenter.java
License:Apache License
/** * Notifies the presenter that the user wishes to view details about a * specific reference.// w w w . j av a 2s. c o m * * @param reference the reference. * @param application the application containing the reference. */ public void onNavigateToReference(Reference reference, Application application) { if (reference == null || application == null) { Console.error(Singleton.MESSAGES.error_navigateToReference()); return; } _placeManager.revealRelativePlace(new PlaceRequest(NameTokens.REFERENCES_PRESENTER) .with(NameTokens.REFERENCE_NAME_PARAM, URL.encode(reference.getName())) .with(NameTokens.APPLICATION_NAME_PARAM, URL.encode(application.getName())), -1); }
From source file:org.switchyard.console.client.ui.artifacts.ArtifactPresenter.java
License:Apache License
/** * Navigates to the application page, displaying the details of the * application./* ww w. j a v a 2s. c om*/ * * @param application the selected application */ public void onApplicationSelected(Application application) { if (application == null) { Console.error(Singleton.MESSAGES.error_navigateToApplication()); return; } _placeManager.revealRelativePlace(new PlaceRequest(NameTokens.APPLICATIONS_PRESENTER) .with(NameTokens.APPLICATION_NAME_PARAM, URL.encode(application.getName())), -1); }
From source file:org.switchyard.console.client.ui.config.ConfigPresenter.java
License:Apache License
/** * Notifies the presenter that the user wishes to view details about a * specific component. The presenter will load the details and pass them * back to the view to be displayed./*from w w w . j av a 2s . co m*/ * * @param component the selected component. */ public void onComponentSelected(Component component) { clearComponentContent(); PlaceRequest request = new PlaceRequest(NameTokens.SYSTEM_CONFIG_PRESENTER); if (component != null) { request = request.with(NameTokens.COMPONENT_NAME_PARAM, URL.encode(component.getName())); } _placeManager.revealRelativePlace(request, -1); }