List of usage examples for com.google.gwt.http.client RequestBuilder GET
Method GET
To view the source code for com.google.gwt.http.client RequestBuilder GET.
Click Source Link
From source file:org.overlord.gadgets.web.client.widgets.Portlet.java
License:Open Source License
public Portlet(WidgetModel model, final int width, String portalId) { this(String.valueOf(model.getWidgetId()), portalId); title.setText(model.getName());/*from www . j av a2 s. c o m*/ wmodel = model; RestfulInvoker.invoke(RequestBuilder.GET, URLBuilder.getPreferenceValuesURL(Long.valueOf(widgetId)), null, new RestfulInvoker.Response() { public void onResponseReceived(Request request, Response response) { Map<String, String> defaultValues = JSOParser.getPreferenceValues(response.getText()); generateUserPref(wmodel, defaultValues); generatePreferenceValuesString(defaultValues); gadgetSpec.getElement().setAttribute("scrolling", "auto"); gadgetSpec.getElement().setAttribute("frameborder", "0"); gadgetSpec.setWidth(width - 20 + "px"); gadgetSpec.setHeight("250px"); gadgetSpec.setUrl(urlBase + "gadget-server/gadgets/ifr?url=" + wmodel.getSpecUrl() + "&" + getHomeView() + "&" + userPreferenceValues); } }); }
From source file:org.ow2.proactive_grid_cloud_portal.common.client.LoginPage.java
License:Open Source License
/** * Creates the layout and add it to the page *//*from ww w .j a va2 s . com*/ private void buildAndShow() { Img logo = new Img(controller.getLogo350Url(), 349, 75); // contains the forms for authentication final VLayout auth = new VLayout(); auth.setBackgroundColor("#f0f0f0"); auth.setBorder("1px solid #ccc"); auth.setWidth(350); auth.setHeight(140); auth.setAlign(VerticalAlignment.CENTER); auth.setPadding(10); authSelLayout = new HLayout(); authSelLayout.setAlign(Alignment.CENTER); //authSel.setMargin(5); authSelLayout.setWidth100(); authSelLayout.setHeight(20); final SelectItem sl = new SelectItem("Mode"); sl.setValueMap("Basic", "Credentials"); sl.setValue("Basic"); authTypeSelectForm = new DynamicForm(); authTypeSelectForm.setNumCols(1); authTypeSelectForm.setFields(sl); authSelLayout.addMember(authTypeSelectForm); authSelLayout.setVisible(false); optsLabel = new Label( "<nobr style='color:#003168;font-size: 1.2em;cursor:pointer'>" + "more options</nobr>"); optsLabel.setHeight(30); optsLabel.setIcon(Images.instance.expand_16().getSafeUri().asString()); optsLabel.setAlign(Alignment.RIGHT); optsLabel.setValign(VerticalAlignment.TOP); optsLabel.setWidth100(); final Layout plainLayout = getPlainAuth(); final Layout credLayout = getCredAuth(); credLayout.hide(); Label label = new Label("<nobr style='color:#003168;font-size:1.2em;'><strong>" + Config.get().getApplicationName() + "</strong> login</nobr>"); label.setHeight(30); label.setValign(VerticalAlignment.TOP); Canvas filler = new Canvas(); filler.setWidth100(); HLayout labelLayout = new HLayout(); labelLayout.setWidth100(); labelLayout.setHeight(30); labelLayout.setMembers(label, optsLabel); motdCanvas = new HLayout(); motdCanvas.setPadding(5); motdCanvas.setMembersMargin(5); //motdCanvas.setBackgroundColor("#ddd"); Img img = new Img(Images.instance.info_32().getSafeUri().asString(), 32, 32); img.setLayoutAlign(Alignment.CENTER); motdLabel = new Label("wait"); motdLabel.setBackgroundColor("#e8e8e8"); motdLabel.setWidth100(); motdCanvas.addMember(img); //motdCanvas.addMember(separator); motdCanvas.addMember(motdLabel); motdMargin = new Canvas(); motdMargin.setHeight(10); motdCanvas.setVisible(false); motdMargin.setVisible(false); auth.addMember(motdCanvas); auth.addMember(motdMargin); String motdUrl = URL.encode(GWT.getModuleBaseURL() + "motd"); RequestBuilder rqb = new RequestBuilder(RequestBuilder.GET, motdUrl); try { rqb.sendRequest(null, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { String content; if (response.getStatusCode() == 200) { content = response.getText(); if (content.trim().length() == 0) { return; } } else if (response.getStatusCode() == 0) { return; } else { content = "Failed to get MOTD (" + response.getStatusCode() + " " + response.getStatusText() + ")"; } motdLabel.setContents( "<div style='color:#003168;font-size: 1.2em;border-left:5px solid #ccc;padding-left:5px'>" + content + "</div>"); motdCanvas.setVisible(true); motdMargin.setVisible(true); } @Override public void onError(Request request, Throwable exception) { System.out.println(exception); } }); } catch (RequestException e) { // not much we can do here... // not really important enough to display a trace on screen } auth.addMember(labelLayout); auth.addMember(authSelLayout); auth.addMember(plainLayout); auth.addMember(credLayout); switchPlainCredForm = new Runnable() { @Override public void run() { if (sl.getValueAsString().equals("Basic")) { plainLayout.animateShow(AnimationEffect.FLY); credLayout.animateHide(AnimationEffect.FLY); } else { credLayout.animateShow(AnimationEffect.FLY); plainLayout.animateHide(AnimationEffect.FLY); } } }; sl.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { switchPlainCredForm.run(); } }); this.errorLabel = new Label(); errorLabel.setBorder("1px solid red"); errorLabel.setBackgroundColor("#fff0f0"); //errorLabel.setMargin(5); errorLabel.setPadding(5); errorLabel.setHeight(30); errorLabel.setAlign(Alignment.CENTER); // contains the logo and the forms VLayout vlayout = new VLayout(); vlayout.setMembersMargin(15); // 350(auth) + 2*10(padding) = 370 vlayout.setWidth(370); // 140(auth) + 15(membersMargin) + 88(logo) + 2*10(padding) = 263 vlayout.setHeight(263); vlayout.setPadding(10); vlayout.setBackgroundColor("#fafafa"); vlayout.setBorder("1px solid #ccc"); vlayout.setShowShadow(true); vlayout.setShadowSoftness(8); vlayout.setShadowOffset(3); vlayout.addMember(logo); vlayout.addMember(errorLabel); vlayout.addMember(auth); vlayout.hideMember(errorLabel); // dummy box for horizontal centering HLayout hlayout = new HLayout(); hlayout.setWidth100(); hlayout.setHeight(263); hlayout.setAlign(Alignment.CENTER); hlayout.addMember(vlayout); // dummy box for vertical centering this.layout = new VLayout(); this.layout.setHeight100(); this.layout.setWidth100(); this.layout.setAlign(VerticalAlignment.CENTER); this.layout.addMember(hlayout); this.layout.draw(); }
From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.CatalogRequestBuilder.java
License:Open Source License
public void sendRequestToCatalog(String endpoint, RequestCallback callback) { RequestBuilder request = new RequestBuilder(RequestBuilder.GET, this.catalogUrl + "/" + endpoint); request.setHeader(CatalogConstants.SESSION_ID_PARAM, LoginModel.getInstance().getSessionId()); request.setCallback(callback);/*from w w w . ja va 2 s . co m*/ try { request.send(); } catch (RequestException e) { this.importFromCatalogPanelFeeder.setNodeSourceWindowLabelWithError("Request sent to catalog failed", e); } }
From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.export.catalog.ExportToCatalogConfirmWindow.java
License:Open Source License
private void fillBucketList() { this.bucketList.setEnabled(false); this.bucketList.addItem(SELECT_A_BUCKET_OPTION); this.bucketList .addChangeHandler(event -> requestCatalogObjectsAndRevisions(this.bucketList.getSelectedValue())); RequestBuilder request = new RequestBuilder(RequestBuilder.GET, new CatalogUrlBuilder().getCatalogUrl() + "/buckets"); request.setHeader("sessionId", LoginModel.getInstance().getSessionId()); request.setCallback(fillBucketListWithRequestCallback()); try {//from ww w . j a v a 2 s . c o m request.send(); } catch (RequestException e) { String errorMessage = "Request sent to catalog failed"; LogModel.getInstance().logCriticalMessage(errorMessage); this.windowLabel.setContents(errorMessage); } }
From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.ExportToCatalogConfirmWindow.java
License:Open Source License
private void fillBucketList() { this.bucketList.setEnabled(false); this.bucketList.addItem(SELECT_A_BUCKET_OPTION); this.bucketList.addChangeHandler(event -> requestNodeSourceInBucket(this.bucketList.getSelectedValue())); RequestBuilder request = new RequestBuilder(RequestBuilder.GET, new CatalogUrlBuilder().getCatalogUrl() + "/buckets"); request.setHeader("sessionId", LoginModel.getInstance().getSessionId()); request.setCallback(fillBucketListWithRequestCallback()); try {/*from w w w . j ava2 s . c om*/ request.send(); } catch (RequestException e) { String errorMessage = "Request sent to catalog failed"; GWT.log(errorMessage, e); this.windowLabel.setContents(errorMessage); } }
From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.ImportFromCatalogPanel.java
License:Open Source License
private void requestNodeSourceConfiguration() { String selectedNodeSourceInList = this.nodeSourceListBox.getSelectedValue(); if (!selectedNodeSourceInList.equals(SELECT_NODE_SOURCE_GENERIC_ENTRY)) { String nodeSourceConfigurationRequestUrl = new CatalogUrlBuilder().getCatalogUrl() + "/buckets/" + this.importFromCatalogPanelFeeder.getBucketNameForNodeSource(selectedNodeSourceInList) + "/resources/" + selectedNodeSourceInList + "/raw"; RequestBuilder nodeSourceConfigurationRequest = new RequestBuilder(RequestBuilder.GET, nodeSourceConfigurationRequestUrl); nodeSourceConfigurationRequest.setHeader(CatalogConstants.SESSION_ID_PARAM, LoginModel.getInstance().getSessionId()); nodeSourceConfigurationRequest.setCallback(getNodeSourceConfigurationRequestCallback()); try {//from w ww .j a v a 2s . c o m nodeSourceConfigurationRequest.send(); } catch (RequestException e) { setNodeSourceWindowLabelWithError("Request sent to catalog failed", e); } } }
From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.load.catalog.ImportFromCatalogPanel.java
License:Open Source License
private void requestNodeSourceConfiguration() { String selectedNodeSourceInList = this.nodeSourceListBox.getSelectedValue(); if (!selectedNodeSourceInList.equals(this.selectItemGenericEntry)) { String nodeSourceConfigurationRequestUrl = new CatalogUrlBuilder().getCatalogUrl() + "/buckets/" + this.importFromCatalogPanelFeeder.getBucketNameForNodeSource(selectedNodeSourceInList) + "/resources/" + selectedNodeSourceInList + "/raw"; RequestBuilder nodeSourceConfigurationRequest = new RequestBuilder(RequestBuilder.GET, nodeSourceConfigurationRequestUrl); nodeSourceConfigurationRequest.setHeader(CatalogConstants.SESSION_ID_PARAM, LoginModel.getInstance().getSessionId()); nodeSourceConfigurationRequest.setCallback(nodeSourceConfigurationRequestCallback); try {//w w w.j av a 2 s . c o m nodeSourceConfigurationRequest.send(); } catch (RequestException e) { throw new IllegalStateException("GET " + nodeSourceConfigurationRequestUrl + " failed", e); } } }
From source file:org.ow2.proactive_grid_cloud_portal.scheduler.client.CalendarInfoWindow.java
License:Open Source License
private void build() { pane.setWidth100();/*from w ww .java2 s .c om*/ pane.setHeight(340); pane.setBackgroundColor("#ffffff"); buttons.setAlign(Alignment.RIGHT); buttons.setWidth100(); buttons.setHeight(20); buttons.setMargin(10); text.setWidth100(); text.setStyleName("paddingLeftAndRight"); root.setBackgroundColor("#dddddd"); root.setWidth100(); root.setHeight100(); window.setTitle("Calendar Integration"); window.setShowMinimizeButton(false); window.setShowShadow(true); window.setIsModal(true); window.setShowModalMask(true); window.setWidth(729); window.setHeight(415); window.centerInPage(); window.setCanDragReposition(false); ok.setIcon(Images.instance.cancel_16().getSafeUri().asString()); ok.setID("csok"); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { CalendarInfoWindow.this.hide(); } }); buttons.addMember(ok); regenerateBt.setIcon(Images.instance.ok_16().getSafeUri().asString()); regenerateBt.setID("csregenerateBt"); regenerateBt.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { loadWindowsContent(RequestBuilder.PUT); } }); deleteBt.setIcon(Images.instance.clear_16().getSafeUri().asString()); deleteBt.setID("csdeleteBt"); deleteBt.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { loadWindowsContent(RequestBuilder.DELETE); } }); createBt.setIcon(Images.instance.ok_16().getSafeUri().asString()); createBt.setID("cscreateBt"); createBt.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { loadWindowsContent(RequestBuilder.POST); } }); loadWindowsContent(RequestBuilder.GET); }
From source file:org.pentaho.commons.metadata.mqleditor.editor.gwt.GwtMqlEditor.java
License:Open Source License
private void loadContainer(String xul) { try {//from ww w .j av a 2s .c om if (xul == null || xul.indexOf(AsyncXulLoader.NS_KEY) < 0) { Window.alert("Error loading XUL Application. Your session may have timed out."); } GwtXulLoader loader = new GwtXulLoader(); com.google.gwt.xml.client.Document gwtDoc = XMLParser.parse(xul); if (bundle != null) { container = loader.loadXul(gwtDoc, bundle); } else { container = loader.loadXul(gwtDoc); } final GwtMqlMessages messages = new GwtMqlMessages( (ResourceBundle) container.getResourceBundles().get(0)); Workspace.setMessages(messages); try { RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, GWT.getModuleBaseURL() + "mainFrame-gwt-overlay.xul"); try { Request response = builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { // Code omitted for clarity } public void onResponseReceived(Request request, Response response) { loadOverlay(response.getText()); } }); } catch (RequestException e) { // Code omitted for clarity } } catch (Exception e) { e.printStackTrace(); } } catch (Exception e) { Window.alert("Error Loading MQLEditor Xul file: " + e.getMessage()); e.printStackTrace(); } }
From source file:org.pentaho.commons.metadata.mqleditor.editor.gwt.GwtMqlEditor.java
License:Open Source License
public void bundleLoaded(String bundleName) { try {/*from w ww .jav a2 s . co m*/ RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, GWT.getModuleBaseURL() + "mainFrame.xul"); try { Request response = builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { Window.alert("could not find main Xul file"); } public void onResponseReceived(Request request, Response response) { loadContainer(response.getText()); } }); } catch (RequestException e) { Window.alert("could not find main Xul file"); } } catch (Exception e) { e.printStackTrace(); Window.alert("Unknown error loading main Xul file"); } }