Author: bfitzpat
Date: 2010-05-25 17:19:09 -0400 (Tue, 25 May 2010)
New Revision: 22312
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
Log:
JBIDE-6328 - updating some error handling
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2010-05-25 21:06:40 UTC
(rev 22311)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2010-05-25 21:19:09 UTC
(rev 22312)
@@ -32,7 +32,9 @@
Export-Package: org.jboss.tools.ws.ui,
org.jboss.tools.ws.ui.messages,
org.jboss.tools.ws.ui.preferences,
- org.jboss.tools.ws.ui.utils
+ org.jboss.tools.ws.ui.utils,
+ org.jboss.tools.ws.ui.views,
+ org.jboss.tools.ws.ui.wizards
Bundle-Vendor: %PLUGIN_PROVIDER
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.jst.javaee.web,
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-05-25
21:06:40 UTC (rev 22311)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-05-25
21:19:09 UTC (rev 22312)
@@ -107,6 +107,8 @@
public static String JAXRSWSTestView_Action_URL_Label;
public static String JAXRSWSTestView_Configure_Monitor_Button;
public static String JAXRSWSTestView_CopyResultsMenu;
+ public static String JAXRSWSTestView_Error_Msg_Starting_Monitor;
+ public static String JAXRSWSTestView_Error_Title_Starting_Monitor;
public static String JAXRSWSTestView_Exception_Status;
public static String JAXRSWSTestView_HTTP_Method_Label;
public static String JAXRSWSTestView_Invoke_Label;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java 2010-05-25
21:06:40 UTC (rev 22311)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester.java 2010-05-25
21:19:09 UTC (rev 22312)
@@ -16,6 +16,7 @@
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
@@ -23,6 +24,7 @@
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.transport.http.HTTPConstants;
/**
* Tester class for JAX-WS services
@@ -112,13 +114,23 @@
// Get back the response HTTP headers and pass back as a Map
if (call != null && call.getMessageContext() != null) {
MessageContext mc = call.getMessageContext();
- if (mc.getMessage() != null && mc.getMessage().getMimeHeaders() != null) {
- MimeHeaders mh = mc.getMessage().getMimeHeaders();
- Iterator<?> iter = mh.getAllHeaders();
+ if (mc != null){
+ String statusCode = mc.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE).toString();
+ String statusMessage =
mc.getProperty(HTTPConstants.MC_HTTP_STATUS_MESSAGE).toString();
+ String protocol = mc.getTransportName();
resultHeaders = new HashMap<String, String>();
- while (iter.hasNext()) {
- MimeHeader next = (MimeHeader)iter.next();
- resultHeaders.put(next.getName(), next.getValue());
+ resultHeaders.put(null, protocol + " " + statusCode + " " +
statusMessage); //$NON-NLS-1$//$NON-NLS-2$
+// System.out.println(protocol + " " + statusCode + " " +
statusMessage);
+ SOAPMessage sm = mc.getResponseMessage();
+ if (sm != null){
+ MimeHeaders mh = sm.getMimeHeaders();
+ if (mh != null){
+ Iterator<?> iter = mh.getAllHeaders();
+ while (iter.hasNext()) {
+ MimeHeader next = (MimeHeader)iter.next();
+ resultHeaders.put(next.getName(), next.getValue());
+ }
+ }
}
}
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java 2010-05-25
21:06:40 UTC (rev 22311)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java 2010-05-25
21:19:09 UTC (rev 22312)
@@ -28,6 +28,7 @@
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
@@ -122,6 +123,8 @@
private MenuItem openResponseTagInXMLEditor;
private Menu resultsTextMenu;
private MenuItem copyMenuAction;
+
+ private boolean showSampleButton = true;
/**
* The constructor.
@@ -291,7 +294,7 @@
Button sampleButton = new Button(buttonBar, SWT.PUSH);
sampleButton.setText(JBossWSUIMessages.JAXRSWSTestView_Set_Sample_Data_Label);
- sampleButton.setVisible(false);
+ sampleButton.setVisible(showSampleButton);
sampleButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
@@ -401,11 +404,6 @@
public void focusGained(FocusEvent arg0) {
setMenusForCurrentState();
-// if (resultsText.getText().trim().length() > 0){
-// resultsTextMenu.setVisible(true);
-// } else {
-// resultsTextMenu.setVisible(false);
-// }
}
});
@@ -524,23 +522,26 @@
if (!monitor.isRunning()) {
try {
monitor.start();
+ int port = monitor.getLocalPort();
+ int remotePort = monitor.getRemotePort();
+ String host = monitor.getRemoteHost();
+ String newUrl = null;
+ if (oldUrl.contains(host + ":" + remotePort)) { //$NON-NLS-1$
+ newUrl = oldUrl.replace(host + ":" + remotePort, "localhost:"
+ port); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ newUrl = oldUrl.replace(host, "localhost:" + port); //$NON-NLS-1$
+ }
+ urlCombo.setText(newUrl);
} catch (CoreException e) {
- // if we hit an error, put it in the results text
- resultsText.setText(e.toString());
- e.printStackTrace();
+ // if we hit an error, open a dialog
+ ErrorDialog dialog = new ErrorDialog(this.getSite().getShell(),
+ JBossWSUIMessages.JAXRSWSTestView_Error_Title_Starting_Monitor,
+ JBossWSUIMessages.JAXRSWSTestView_Error_Msg_Starting_Monitor,
+ new Status(IStatus.ERROR, JBossWSUIPlugin.PLUGIN_ID,
+ e.getLocalizedMessage(), e), IStatus.ERROR);
+ dialog.open();
}
}
-
- int port = monitor.getLocalPort();
- int remotePort = monitor.getRemotePort();
- String host = monitor.getRemoteHost();
- String newUrl = null;
- if (oldUrl.contains(host + ":" + remotePort)) { //$NON-NLS-1$
- newUrl = oldUrl.replace(host + ":" + remotePort, "localhost:" +
port); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- newUrl = oldUrl.replace(host, "localhost:" + port); //$NON-NLS-1$
- }
- urlCombo.setText(newUrl);
}
}
}