Author: paperwing
Date: 2012-06-18 11:51:16 -0700 (Mon, 18 Jun 2012)
New Revision: 29601
Modified:
core3/impl/trunk/app-impl/api-notes.txt
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/AppGetResponder.java
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalHttpServer.java
Log:
Local server no longer responds with code 500 "internal error" when remote app
installation fails, but responds with "install-failed" under the key
"install_status", as noted in updated API.
Modified: core3/impl/trunk/app-impl/api-notes.txt
===================================================================
--- core3/impl/trunk/app-impl/api-notes.txt 2012-06-18 18:50:48 UTC (rev
29600)
+++ core3/impl/trunk/app-impl/api-notes.txt 2012-06-18 18:51:16 UTC (rev
29601)
@@ -44,6 +44,9 @@
{
"app_name": The name of the install app
"install_status": The result of the installation. Values could be: success,
-app-not-found, version-not-found.
+app-not-found, version-not-found, install-failed. "install-failed" is for when
an app
+matching the given name and version was found, but there was an error while
attempting
+to install it, such as a malformed manifest, or some other error preventing
successful
+install.
}
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/AppGetResponder.java
===================================================================
---
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/AppGetResponder.java
2012-06-18 18:50:48 UTC (rev 29600)
+++
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/AppGetResponder.java
2012-06-18 18:51:16 UTC (rev 29601)
@@ -4,6 +4,9 @@
import java.util.HashMap;
import java.util.Map;
+import org.cytoscape.app.internal.exception.AppDownloadException;
+import org.cytoscape.app.internal.exception.AppInstallException;
+import org.cytoscape.app.internal.exception.AppParsingException;
import org.cytoscape.app.internal.manager.App;
import org.cytoscape.app.internal.manager.AppManager;
import org.cytoscape.app.internal.net.WebApp;
@@ -99,18 +102,28 @@
if (appFoundInStore) {
// Download app
- File appFile =
appManager.getWebQuerier().downloadApp(
+ File appFile = null;
+ try {
+ appFile =
appManager.getWebQuerier().downloadApp(
appToDownload, version,
new File(appManager.getDownloadedAppsPath()));
+ } catch (AppDownloadException e) {
+ }
// Attempt to install app
if (appFile == null) {
installStatus =
"version-not-found";
} else {
- App app =
appManager.getAppParser().parseApp(appFile);
+ installStatus = "success";
- appManager.installApp(app);
-
- installStatus = "success";
+ try {
+ App app =
appManager.getAppParser().parseApp(appFile);
+
+
appManager.installApp(app);
+ } catch (AppParsingException e)
{
+ installStatus =
"install-failed";
+ } catch (AppInstallException e)
{
+ installStatus =
"install-failed";
+ }
}
}
Modified:
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalHttpServer.java
===================================================================
---
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalHttpServer.java
2012-06-18 18:50:48 UTC (rev 29600)
+++
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/server/LocalHttpServer.java
2012-06-18 18:51:16 UTC (rev 29601)
@@ -250,13 +250,21 @@
final String method =
request.getRequestLine().getMethod().toLowerCase();
DebugHelper.print("Request received. Method: " + method);
- if (method.equals("options")) {
- httpResponse.addHeader("Access-Control-Allow-Origin", "*");
- httpResponse.addHeader("Access-Control-Allow-Methods",
"POST, GET, OPTIONS");
- httpResponse.addHeader("Access-Control-Max-Age", "1");
- httpResponse.addHeader("Access-Control-Allow-Headers",
"origin, x-csrftoken, accept");
- return;
- }
+ /*
+ System.out.println("Headers: ");
+ for (int i = 0; i < request.getAllHeaders().length; i++) {
+ System.out.println("Header name: " +
request.getAllHeaders()[i].getName());
+ System.out.println("Header value: " +
request.getAllHeaders()[i].getValue());
+ }
+ */
+
+ if (method.equals("options")) {
+
httpResponse.addHeader("Access-Control-Allow-Origin", "*");
+
httpResponse.addHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
+ httpResponse.addHeader("Access-Control-Max-Age",
"1");
+
httpResponse.addHeader("Access-Control-Allow-Headers", "origin, x-csrftoken,
accept");
+ return;
+ }
// loop thru responders and see if any of them produce a
response
Response response = null;
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.