List of usage examples for com.google.gwt.http.client RequestCallback RequestCallback
RequestCallback
From source file:ecplugins.ec2.client.ConfigurationList.java
License:Apache License
@SuppressWarnings("OverlyComplexAnonymousInnerClass") private void waitForJob(final String jobId) { CgiRequestProxy cgiRequestProxy = new CgiRequestProxy(ComponentBaseFactory.getPluginName(), "ec2Monitor.cgi"); Map<String, String> cgiParams = new HashMap<String, String>(); cgiParams.put("jobId", jobId); // Pass debug flag to CGI, which will use it to determine whether to // clean up a successful job if ("1".equals(getGetParameter("debug"))) { cgiParams.put("debug", "1"); }/*from ww w. ja va2 s. c o m*/ try { cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { // noinspection HardCodedStringLiteral addErrorMessage("CGI request failed:: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); if (getLog().isDebugEnabled()) { getLog().debug("CGI response received: " + responseString); } if (responseString.startsWith("Success")) { // We're done! Location.reload(); } else { @SuppressWarnings({ "HardCodedStringLiteral", "StringConcatenation" }) SimpleErrorBox error = getUIFactory().createSimpleErrorBox( "Error occurred during configuration deletion: " + responseString); CommanderUrlBuilder urlBuilder = CommanderUrlBuilder.createUrl("jobDetails.php") .setParameter("jobId", jobId); // noinspection HardCodedStringLiteral error.add(new Anchor("(See job for details)", urlBuilder.buildString())); addErrorMessage(error); } } }); } catch (RequestException e) { // noinspection HardCodedStringLiteral addErrorMessage("CGI request failed:: ", e); } }
From source file:ecplugins.ec2.client.CreateConfiguration.java
License:Apache License
@SuppressWarnings("OverlyComplexAnonymousInnerClass") private void waitForJob(final String jobId) { CgiRequestProxy cgiRequestProxy = new CgiRequestProxy(getPluginName(), "ec2Monitor.cgi"); Map<String, String> cgiParams = new HashMap<String, String>(); cgiParams.put("jobId", jobId); // Pass debug flag to CGI, which will use it to determine whether to // clean up a successful job if ("1".equals(getGetParameter("debug"))) { cgiParams.put("debug", "1"); }/*from www . ja v a 2s . co m*/ try { cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { // noinspection HardCodedStringLiteral addErrorMessage("CGI request failed: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); if (getLog().isDebugEnabled()) { getLog().debug("CGI response received: " + responseString); } if (responseString.startsWith("Success")) { // We're done! cancel(); } else { @SuppressWarnings({ "HardCodedStringLiteral", "StringConcatenation" }) SimpleErrorBox error = getUIFactory().createSimpleErrorBox( "Error occurred during configuration creation: " + responseString); CommanderUrlBuilder urlBuilder = createUrl("jobDetails.php").setParameter("jobId", jobId); // noinspection HardCodedStringLiteral error.add(new Anchor("(See job for details)", urlBuilder.buildString())); addErrorMessage(error); } } }); } catch (RequestException e) { // noinspection HardCodedStringLiteral addErrorMessage("CGI request failed: ", e); } }
From source file:ecplugins.ec2.client.EC2ConfigListLoader.java
License:Apache License
@SuppressWarnings("OverlyComplexAnonymousInnerClass") private void loadConfigs(Map<String, String> cgiParams) { try {/*w w w. j a va2 s.co m*/ String request = m_cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError( @SuppressWarnings("AnonymousClassVariableHidesContainingMethodVariable") Request request, Throwable exception) { // noinspection HardCodedStringLiteral ((HasErrorPanel) m_component).addErrorMessage("Error loading EC2 configuration list: ", exception); } @Override public void onResponseReceived( @SuppressWarnings("AnonymousClassVariableHidesContainingMethodVariable") Request request, Response response) { @NonNls String responseString = response.getText(); // if HTML returned we never made it to the CGI Boolean isHtml = responseString.contains("DOCTYPE HTML"); String error; if (isHtml) { error = responseString; } else { error = m_configList.parseResponse(responseString); } if (m_component.getLog().isDebugEnabled()) { m_component.getLog().debug("Recieved CGI response: " + responseString + " isHTML:" + isHtml + " error:" + error); } if (error == null) { if (StringUtil.isEmpty(m_editorName) || m_configList.isEmpty()) { // We're done! if (m_callback != null) { m_callback.onComplete(); } } else { loadEditors(); } } else { ((HasErrorPanel) m_component).addErrorMessage(error); } } }); if (m_component.getLog().isDebugEnabled()) { m_component.getLog().debug("Issued CGI request: " + request); } } catch (RequestException e) { if (m_component instanceof HasErrorPanel) { // noinspection HardCodedStringLiteral ((HasErrorPanel) m_component).addErrorMessage("Error loading EC2 configuration list: ", e); } else { m_component.getLog().error(e); } } }
From source file:ecplugins.esx.client.ConfigurationList.java
License:Apache License
private void waitForJob(final String jobId) { CgiRequestProxy cgiRequestProxy = new CgiRequestProxy(getPluginName(), "esxMonitor.cgi"); Map<String, String> cgiParams = new HashMap<String, String>(); cgiParams.put("jobId", jobId); // Pass debug flag to CGI, which will use it to determine whether to // clean up a successful job if ("1".equals(getGetParameter("debug"))) { cgiParams.put("debug", "1"); }// w w w.j ava 2 s . c om try { cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { addErrorMessage("CGI request failed:: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); if (getLog().isDebugEnabled()) { getLog().debug("CGI response received: " + responseString); } if (responseString.startsWith("Success")) { // We're done! Location.reload(); } else { SimpleErrorBox error = getUIFactory().createSimpleErrorBox( "Error occurred during configuration deletion: " + responseString); CommanderUrlBuilder urlBuilder = CommanderUrlBuilder.createUrl("jobDetails.php") .setParameter("jobId", jobId); error.add(new Anchor("(See job for details)", urlBuilder.buildString())); addErrorMessage(error); } } }); } catch (RequestException e) { addErrorMessage("CGI request failed:: ", e); } }
From source file:ecplugins.esx.client.CreateConfiguration.java
License:Apache License
private void waitForJob(final String jobId) { CgiRequestProxy cgiRequestProxy = new CgiRequestProxy(getPluginName(), "esxMonitor.cgi"); Map<String, String> cgiParams = new HashMap<String, String>(); cgiParams.put("jobId", jobId); // Pass debug flag to CGI, which will use it to determine whether to // clean up a successful job if ("1".equals(getGetParameter("debug"))) { cgiParams.put("debug", "1"); }/* ww w. j av a 2 s . c o m*/ try { cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { addErrorMessage("CGI request failed: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); if (getLog().isDebugEnabled()) { getLog().debug("CGI response received: " + responseString); } if (responseString.startsWith("Success")) { // We're done! cancel(); } else { SimpleErrorBox error = getUIFactory().createSimpleErrorBox( "Error occurred during configuration creation: " + responseString); CommanderUrlBuilder urlBuilder = createUrl("jobDetails.php").setParameter("jobId", jobId); error.add(new Anchor("(See job for details)", urlBuilder.buildString())); addErrorMessage(error); } } }); } catch (RequestException e) { addErrorMessage("CGI request failed: ", e); } }
From source file:ecplugins.esx.client.ESXConfigListLoader.java
License:Apache License
private void loadConfigs(Map<String, String> cgiParams) { try {//from w w w. j av a 2s . c o m String request = m_cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { ((HasErrorPanel) m_component).addErrorMessage("Error loading ESX configuration list: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); // if HTML returned we never made it to the CGI Boolean isHtml = (responseString.indexOf("DOCTYPE HTML") != -1); String error; if (!isHtml) { error = m_configList.parseResponse(responseString); } else { error = responseString; } if (m_component.getLog().isDebugEnabled()) { m_component.getLog().debug("Recieved CGI response: " + responseString + " isHTML:" + isHtml + " error:" + error); } if (error != null) { ((HasErrorPanel) m_component).addErrorMessage(error); } else { if (StringUtil.isEmpty(m_editorName) || m_configList.isEmpty()) { // We're done! if (m_callback != null) { m_callback.onComplete(); } } else { loadEditors(); } } } }); if (m_component.getLog().isDebugEnabled()) { m_component.getLog().debug("Issued CGI request: " + request); } } catch (RequestException e) { if (m_component instanceof HasErrorPanel) { ((HasErrorPanel) m_component).addErrorMessage("Error loading ESX configuration list: ", e); } else { m_component.getLog().error(e); } } }
From source file:ecplugins.helloworld.client.ConfigurationList.java
License:Apache License
private void waitForJob(final String jobId) { CgiRequestProxy cgiRequestProxy = new CgiRequestProxy(getPluginName(), "helloworldMonitor.cgi"); Map<String, String> cgiParams = new HashMap<String, String>(); cgiParams.put("jobId", jobId); // Pass debug flag to CGI, which will use it to determine whether to // clean up a successful job if ("1".equals(getGetParameter("debug"))) { cgiParams.put("debug", "1"); }// ww w. j av a2 s. c o m try { cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { addErrorMessage("CGI request failed:: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); if (getLog().isDebugEnabled()) { getLog().debug("CGI response received: " + responseString); } if (responseString.startsWith("Success")) { // We're done! Location.reload(); } else { SimpleErrorBox error = getUIFactory().createSimpleErrorBox( "Error occurred during configuration deletion: " + responseString); CommanderUrlBuilder urlBuilder = CommanderUrlBuilder.createUrl("jobDetails.php") .setParameter("jobId", jobId); error.add(new Anchor("(See job for details)", urlBuilder.buildString())); addErrorMessage(error); } } }); } catch (RequestException e) { addErrorMessage("CGI request failed:: ", e); } }
From source file:ecplugins.helloworld.client.CreateConfiguration.java
License:Apache License
private void waitForJob(final String jobId) { CgiRequestProxy cgiRequestProxy = new CgiRequestProxy(getPluginName(), "helloworldMonitor.cgi"); Map<String, String> cgiParams = new HashMap<String, String>(); cgiParams.put("jobId", jobId); // Pass debug flag to CGI, which will use it to determine whether to // clean up a successful job if ("1".equals(getGetParameter("debug"))) { cgiParams.put("debug", "1"); }//from w ww .j a va2s.co m try { cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { addErrorMessage("CGI request failed: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); if (getLog().isDebugEnabled()) { getLog().debug("CGI response received: " + responseString); } if (responseString.startsWith("Success")) { // We're done! cancel(); } else { SimpleErrorBox error = getUIFactory().createSimpleErrorBox( "Error occurred during configuration creation: " + responseString); CommanderUrlBuilder urlBuilder = createUrl("jobDetails.php").setParameter("jobId", jobId); error.add(new Anchor("(See job for details)", urlBuilder.buildString())); addErrorMessage(error); } } }); } catch (RequestException e) { addErrorMessage("CGI request failed: ", e); } }
From source file:ecplugins.helloworld.client.HelloWorldConfigListLoader.java
License:Apache License
private void loadConfigs(Map<String, String> cgiParams) { try {// ww w . j av a 2s . co m String request = m_cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { ((HasErrorPanel) m_component).addErrorMessage("Error loading HelloWorld configuration list: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); // if HTML returned we never made it to the CGI Boolean isHtml = (responseString.indexOf("DOCTYPE HTML") != -1); String error; if (!isHtml) { error = m_configList.parseResponse(responseString); } else { error = responseString; } if (m_component.getLog().isDebugEnabled()) { m_component.getLog().debug("Received CGI response: " + responseString + " isHTML:" + isHtml + " error:" + error); } if (error != null) { ((HasErrorPanel) m_component).addErrorMessage(error); } else { if (StringUtil.isEmpty(m_editorName) || m_configList.isEmpty()) { // We're done! if (m_callback != null) { m_callback.onComplete(); } } else { loadEditors(); } } } }); if (m_component.getLog().isDebugEnabled()) { m_component.getLog().debug("Issued CGI request: " + request); } } catch (RequestException e) { if (m_component instanceof HasErrorPanel) { ((HasErrorPanel) m_component).addErrorMessage("Error loading HelloWorld configuration list: ", e); } else { m_component.getLog().error(e); } } }
From source file:ecplugins.openstack.client.ConfigurationList.java
License:Apache License
private void waitForJob(final String jobId) { CgiRequestProxy cgiRequestProxy = new CgiRequestProxy(getPluginName(), "openstackMonitor.cgi"); Map<String, String> cgiParams = new HashMap<String, String>(); cgiParams.put("jobId", jobId); // Pass debug flag to CGI, which will use it to determine whether to // clean up a successful job if ("1".equals(getGetParameter("debug"))) { cgiParams.put("debug", "1"); }/*from www . ja v a 2 s.c o m*/ try { cgiRequestProxy.issueGetRequest(cgiParams, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { addErrorMessage("CGI request failed:: ", exception); } @Override public void onResponseReceived(Request request, Response response) { String responseString = response.getText(); if (getLog().isDebugEnabled()) { getLog().debug("CGI response received: " + responseString); } if (responseString.startsWith("Success")) { // We're done! Location.reload(); } else { SimpleErrorBox error = getUIFactory().createSimpleErrorBox( "Error occurred during configuration deletion: " + responseString); CommanderUrlBuilder urlBuilder = CommanderUrlBuilder.createUrl("jobDetails.php") .setParameter("jobId", jobId); error.add(new Anchor("(See job for details)", urlBuilder.buildString())); addErrorMessage(error); } } }); } catch (RequestException e) { addErrorMessage("CGI request failed:: ", e); } }