List of usage examples for com.google.gwt.http.client URL encodeQueryString
public static String encodeQueryString(String decodedURLComponent)
From source file:opus.gwt.management.console.client.dashboard.DashboardPanel.java
License:Apache License
@UiHandler("destroyButton") void onDestroyButtonClick(ClickEvent event) { StringBuffer formBuilder = new StringBuffer(); formBuilder.append("csrfmiddlewaretoken="); formBuilder.append(URL.encodeQueryString(JSVarHandler.getCSRFTokenURL())); RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, "/deployments/" + projectName + "/destroy"); builder.setHeader("Content-type", "application/x-www-form-urlencoded"); try {/* ww w. j a va 2s .c o m*/ Request request = builder.sendRequest(formBuilder.toString(), new RequestCallback() { public void onError(Request request, Throwable exception) { ErrorPanel ep = new ErrorPanel(clientFactory); ep.errorHTML.setHTML("<p>Error Occured</p>"); applicationsFlowPanel.add(ep); } public void onResponseReceived(Request request, Response response) { if (response.getText().contains("scheduled for destruction")) { clientFactory.getProjects().remove(projectName); eventBus.fireEvent(new DeleteProjectEvent(projectName)); deletePopupPanel.hide(); } else { ErrorPanel ep = new ErrorPanel(clientFactory); ep.errorHTML.setHTML(response.getText()); applicationsFlowPanel.add(ep); } } }); } catch (RequestException e) { } }
From source file:opus.gwt.management.console.client.dashboard.DashboardPanel.java
License:Apache License
private void setProjectStatus(boolean active) { StringBuffer formBuilder = new StringBuffer(); formBuilder.append("csrfmiddlewaretoken="); formBuilder.append(URL.encodeQueryString(JSVarHandler.getCSRFTokenURL())); formBuilder.append("&active=" + active); RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, "/deployments/" + projectName + "/"); builder.setHeader("Content-type", "application/x-www-form-urlencoded"); try {/* w w w . j a v a2s . c om*/ Request request = builder.sendRequest(formBuilder.toString(), new RequestCallback() { public void onError(Request request, Throwable exception) { ErrorPanel ep = new ErrorPanel(clientFactory); ep.errorHTML.setHTML("<p>Error Occured</p>"); applicationsFlowPanel.clear(); applicationsFlowPanel.add(ep); } @Override public void onResponseReceived(Request request, Response response) { if (response.getText().contains("Project deactivated")) { setActive(false); } else if (response.getText().contains("Project activated")) { setActive(true); } else if (response.getText().contains("You asked me to activate the project")) { eventBus.fireEvent(new PanelTransitionEvent( PanelTransitionEvent.TransitionTypes.PROJECTSETTINGS, projectName)); } else { ErrorPanel ep = new ErrorPanel(clientFactory); ep.errorHTML.setHTML(response.getText()); applicationsFlowPanel.clear(); applicationsFlowPanel.add(ep); } } }); } catch (RequestException e) { e.printStackTrace(); } }
From source file:opus.gwt.management.console.client.deployer.DatabaseOptionsPanel.java
License:Apache License
public String getPostData() { StringBuffer postData = new StringBuffer(); postData.append("&dbengine="); postData.append(URL.encodeQueryString(dbengineListBox.getValue(dbengineListBox.getSelectedIndex()))); postData.append("&dbname="); postData.append(URL.encodeQueryString(nameTextBox.getValue())); postData.append("&dbpassword="); postData.append(URL.encodeQueryString(passwordTextBox.getValue())); postData.append("&dbhost="); postData.append(URL.encodeQueryString(hostTextBox.getValue())); postData.append("&dbport="); postData.append(URL.encodeQueryString(portTextBox.getValue())); return postData.toString(); }
From source file:opus.gwt.management.console.client.deployer.ProjectDeployerController.java
License:Apache License
private void deployProject() { createdProjectName = deploymentOptionsPanel.getProjectName(); ArrayList<String> paths = appBrowserPanel.getAppPaths(); ArrayList<String> apptypes = appBrowserPanel.getAppTypes(); ArrayList<String> appNames = appBrowserPanel.getAppNames(); StringBuffer formBuilder = new StringBuffer(); formBuilder.append("csrfmiddlewaretoken="); formBuilder.append(URL.encodeQueryString(jsVarHandler.getCSRFTokenURL())); formBuilder.append("&form-TOTAL_FORMS="); formBuilder.append(URL.encodeQueryString(String.valueOf(paths.size()))); formBuilder.append("&form-INITIAL_FORMS="); formBuilder.append(URL.encodeQueryString(String.valueOf(0))); formBuilder.append("&form-MAX_NUM_FORMS="); for (int i = 0; i < paths.size(); i++) { formBuilder.append("&form-" + i + "-apptype="); formBuilder.append(apptypes.get(i)); formBuilder.append("&form-" + i + "-apppath="); formBuilder.append(paths.get(i)); formBuilder.append("&form-" + i + "-appname="); formBuilder.append(appNames.get(i)); }//w w w . j a v a 2 s .c o m formBuilder.append(deploymentOptionsPanel.getPostData()); formBuilder.append(projectOptionsPanel.getPostData()); formBuilder.append(databaseOptionsPanel.getPostData()); RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, "/deployments/" + createdProjectName + "/"); builder.setHeader("Content-type", "application/x-www-form-urlencoded"); //builder.setHeader(header, value); try { Request request = builder.sendRequest(formBuilder.toString(), new RequestCallback() { public void onError(Request request, Throwable exception) { ErrorPanel ep = new ErrorPanel(clientFactory); ep.errorHTML.setHTML("<p>Error Occured</p>"); deployerDeckPanel.add(ep); deployerDeckPanel.showWidget(deployerDeckPanel.getWidgetIndex(ep)); } public void onResponseReceived(Request request, Response response) { if (response.getText().contains("Back to")) { loadingPopup.hide(); eventBus.fireEvent(new AsyncRequestEvent("addProject", createdProjectName)); } else { loadingPopup.hide(); ErrorPanel ep = new ErrorPanel(clientFactory); ep.errorHTML.setHTML(response.getText()); deployerDeckPanel.add(ep); deployerDeckPanel.showWidget(deployerDeckPanel.getWidgetIndex(ep)); } } }); } catch (RequestException e) { } loadingPopup.setGlassEnabled(true); loadingPopup.setGlassStyleName(style.loadingGlass()); loadingPopup.show(); int left = (Window.getClientWidth() / 2) - 150; int top = (Window.getClientHeight() / 2) - 10; loadingPopup.setPopupPosition(left, top); loadingPopup.show(); }
From source file:opus.gwt.management.console.client.deployer.ProjectOptionsPanel.java
License:Apache License
public String getPostData() { StringBuffer postData = new StringBuffer(); postData.append("&superusername="); postData.append(URL.encodeQueryString(usernameTextBox.getValue())); postData.append("&superpassword="); postData.append(URL.encodeQueryString(passwordTextBox.getValue())); postData.append("&superpasswordconfirm="); postData.append(URL.encodeQueryString(passwordConfirmTextBox.getValue())); postData.append("&superemail="); postData.append(URL.encodeQueryString(emailTextBox.getValue())); postData.append("&idprovider="); postData.append(URL.encodeQueryString(idProvider.getValue(idProvider.getSelectedIndex()))); return postData.toString(); }
From source file:org.bonitasoft.console.client.admin.process.view.StartProcessFormPage.java
License:Open Source License
@Override public void buildView() { final String processName = this.getParameter(ProcessItem.ATTRIBUTE_NAME); final String encodedProcessName = URL.encodeQueryString(processName); final String processVersion = URL.encodeQueryString(this.getParameter(ProcessItem.ATTRIBUTE_VERSION)); final String processId = URL.encodeQueryString(this.getParameter(ProcessItem.ATTRIBUTE_ID)); final String locale = AbstractI18n.getDefaultLocale().toString(); String userId = this.getParameter(ATTRIBUTE_USER_ID); if (userId == null) { userId = Session.getUserId().toString(); }//from www .ja v a 2 s . com this.setTitle(_("Start an instance of process %app_name%", new Arg("app_name", processName))); final StringBuilder frameURL = new StringBuilder(); frameURL.append(GWT.getModuleBaseURL()).append("homepage?ui=form&locale=").append(locale); // if tenant is filled in portal url add tenant parameter to IFrame url final String tenantId = ClientApplicationURL.getTenantId(); if (tenantId != null && !tenantId.isEmpty()) { frameURL.append("&tenant=").append(tenantId); } frameURL.append("#form=").append(encodedProcessName).append(UUID_SEPERATOR).append(processVersion) .append("$entry&process=").append(processId).append("&autoInstantiate=false&mode=form&userId=") .append(userId); addBody(new UiComponent(new IFrameView(frameURL.toString()))); }
From source file:org.bonitasoft.console.client.common.view.PerformTaskPage.java
License:Open Source License
private String buildTasksFormURL(final HumanTaskItem item, final boolean assignTask) { final StringBuilder frameURL = new StringBuilder() .append(GWT.getModuleBaseURL()).append("homepage?ui=form&locale=") .append(AbstractI18n.getDefaultLocale().toString()); // if tenant is filled in portal url add tenant parameter to IFrame url final String tenantId = ClientApplicationURL.getTenantId(); if (tenantId != null && !tenantId.isEmpty()) { frameURL.append("&tenant=").append(tenantId); }//w ww. j a v a2 s. co m String userId = this.getParameter(StartProcessFormPage.ATTRIBUTE_USER_ID); if (userId == null) { userId = getUserId().toString(); } frameURL.append("#form=").append(URL.encodeQueryString(item.getProcess().getName())).append(UUID_SEPERATOR) .append(URL.encodeQueryString(item.getProcess().getVersion())).append(UUID_SEPERATOR) .append(URL.encodeQueryString(item.getName())) .append("$entry") .append("&task=").append(item.getId()).append("&mode=form"); if (assignTask) { frameURL.append("&assignTask=true"); } if (getParameter(PARAMETER_USER_ID) != null && !getParameter(PARAMETER_USER_ID).isEmpty()) { frameURL.append("&" + PARAMETER_USER_ID + "="); frameURL.append(getParameter(PARAMETER_USER_ID)); } return frameURL.toString(); }
From source file:org.bonitasoft.console.client.user.cases.view.AbstractOverviewFormMappingRequester.java
License:Open Source License
public void searchFormMappingForInstance(final String processId) { final String processIdFilter = URL.encodeQueryString(PageItem.ATTRIBUTE_PROCESS_ID + "=" + processId); final String mappingTypeFilter = URL .encodeQueryString(ATTRIBUTE_FORM_MAPPING_TYPE + "=" + PROCESS_OVERVIEW_FORM_MAPPING_TYPE); final RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, "../API/form/mapping?c=1&p=0&f=" + processIdFilter + "&f=" + mappingTypeFilter); requestBuilder.setCallback(new FormMappingCallback(processId)); try {// ww w.ja va 2 s . co m requestBuilder.send(); } catch (final RequestException e) { GWT.log("Error while creating the from mapping request", e); } }
From source file:org.bonitasoft.console.client.user.process.action.CheckFormMappingAndDisplayProcessInstanciationFormAction.java
License:Open Source License
protected void searchFormMappingForProcess(final TreeIndexed<String> parameters) { final String processId = parameters.getValue(ProcessItem.ATTRIBUTE_ID); final String processIdFilter = URL.encodeQueryString(PageItem.ATTRIBUTE_PROCESS_ID + "=" + processId); final String mappingTypeFilter = URL .encodeQueryString(ATTRIBUTE_FORM_MAPPING_TYPE + "=" + PROCESS_START_FORM_MAPPING); final RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, "../API/form/mapping?c=10&p=0&f=" + processIdFilter + "&f=" + mappingTypeFilter); requestBuilder.setCallback(new FormMappingCallback(processId, parameters)); try {// ww w. ja va 2s. c o m requestBuilder.send(); } catch (final RequestException e) { GWT.log("Error while creating the from mapping request", e); } }
From source file:org.bonitasoft.console.client.user.task.action.CheckFormMappingAndDisplayPerformTaskPageAction.java
License:Open Source License
protected void searchFormMappingForTask(final TreeIndexed<String> parameters) { RequestBuilder requestBuilder;//from www.ja v a2 s . c o m final String processIdFilter = URL .encodeQueryString(PageItem.ATTRIBUTE_PROCESS_ID + "=" + processDefinitionId); final String taskNameFilter = URL.encodeQueryString(ATTRIBUTE_FORM_MAPPING_TASK + "=" + taskName); requestBuilder = new RequestBuilder(RequestBuilder.GET, "../API/form/mapping?c=10&p=0&f=" + processIdFilter + "&f=" + taskNameFilter); requestBuilder.setCallback(new FormMappingCallback(parameters)); try { requestBuilder.send(); } catch (final RequestException e) { GWT.log("Error while creating the from mapping request", e); } }