Author: tyrell
Date: Mon Jan 21 07:17:31 2008
New Revision: 12646
Log:
Cleaning up the error handling, so that it will be more user friendly.
Added:
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/MashupUiFault.java
Modified:
trunk/mashup/java/modules/www/editor.jsp
trunk/mashup/java/modules/www/error.jsp
Added:
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/MashupUiFault.java
==============================================================================
--- (empty file)
+++
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/MashupUiFault.java
Mon Jan 21 07:17:31 2008
@@ -0,0 +1,10 @@
+package org.wso2.mashup.webapp;
+
+import javax.servlet.ServletException;
+
+public class MashupUiFault extends ServletException {
+
+ public MashupUiFault(String message){
+ super(message);
+ }
+}
Modified: trunk/mashup/java/modules/www/editor.jsp
==============================================================================
--- trunk/mashup/java/modules/www/editor.jsp (original)
+++ trunk/mashup/java/modules/www/editor.jsp Mon Jan 21 07:17:31 2008
@@ -15,11 +15,10 @@
--%>
<%@ page isErrorPage="true" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ page import="org.wso2.mashup.utils.MashupUtils" %>
-<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
-<%@ page import="org.wso2.registry.Registry" %>
-<%@ page import="java.net.URLDecoder" %>
-<%@ page import="java.util.Enumeration" %>
+<%@ page import="org.wso2.mashup.webapp.MashupUiFault" %>
+<%@ page import="org.wso2.registry.RegistryConstants" %>
+<%@ page import="org.wso2.registry.RegistryException" %>
+<%@ page import="org.wso2.registry.Resource" %>
<!--Required to keep a user logged in if 'Remember Me' option is selected-->
<%@ include file="validate_login.jsp" %>
@@ -55,10 +54,10 @@
//Sanity check. Immediately terminate further processing if this fails.
if (action == null) {
- throw new Exception("Sorry. An action was not specified in the
request.");
+ throw new MashupUiFault("Mashup Editor validation failure. An action
was not specified in the request.");
} else if ((action.equalsIgnoreCase("edit")) && (mashup == null)) {
- throw new Exception(
- "Sorry. An edit request was made without a valid mashup being
named for editing.");
+ throw new MashupUiFault(
+ "Mashup Editor validation failure. An edit request was made
without a valid mashup being named for editing.");
} else if ((action.equalsIgnoreCase("edit")) && (mashup != null)) {
String[] pathContents = mashup.split("/");
@@ -67,26 +66,28 @@
boolean validReferer = false;
if (pathContents.length < 4) {
- throw new Exception("Sorry. The path specified for the mashup is
invalid.");
+ throw new MashupUiFault("Mashup Editor validation failure. The
path specified for the mashup is invalid.");
} else {
author = pathContents[2];
mashupName = pathContents[3];
}
if (!((author.equalsIgnoreCase(currentUser) ||
RegistryUtils.isAdminRole(registry)))) {
- throw new Exception(
- "Sorry. You are not authorized to perform this
operation.");
+ throw new MashupUiFault(
+ "Mashup Editor validation failure. You are not authorized
to perform this operation.");
}
} else if ((action.equalsIgnoreCase("new")) && (mashup == null)) {
- throw new Exception(
- "Sorry. A request was made to create a mashup without
providing a valid name.");
+ throw new MashupUiFault(
+ "Mashup Editor validation failure. A request was made to
create a mashup without providing a valid name.");
} else if ((action.equalsIgnoreCase("new")) && (mashup != null)) {
author = currentUser;
String serviceValidationResult =
MashupUtils.isPossibleToCreateService("/mashups/" + author +
"/" + mashup);
if (!(serviceValidationResult.equalsIgnoreCase("ok"))) {
- throw new Exception(serviceValidationResult);
+ throw new MashupUiFault(serviceValidationResult);
}
+ } else {
+ throw new MashupUiFault("Not enough data provided to fulfil this
request");
}
%>
<html>
@@ -96,18 +97,19 @@
<meta http-equiv="expires" content=<%= new java.util.Date() %>>
<title><%= bundle.getString("main.title")%> - Editing <%=mashupName%> by
<%=RegistryUtils
- .getFullName(request, author)%></title>
+ .getFullName(request, author)%>
+</title>
<!-- Required CSS -->
<link href="css/styles.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
-
+
.panel {
/*border: solid 1px black;*/
background-color: white; /* padding: 5px;*/
height: 95%;
overflow: auto;
clear: left;
- border-top:3px solid #CEE171;
+ border-top: 3px solid #CEE171;
}
</style>
@@ -130,13 +132,13 @@
{
selectedTab.style.color = '';
//selectedTab.style.fontWeight = '';
- selectedTab.style.textDecoration = '';
+ selectedTab.style.textDecoration = '';
}
selectedTab = tab;
selectedTab.style.color = 'black';
// selectedTab.style.fontWeight = 'bold';
- selectedTab.style.textDecoration = 'none';
+ selectedTab.style.textDecoration = 'none';
for (var i = 0; i < panels.length; i++)
{
@@ -254,15 +256,19 @@
%>
<div id="mashup_editor" style="height: 80%;">
-<div id="editor" >
-<ul class="user">
- <li class="tab"><a href="" onmousedown="return
event.returnValue = showPanel(this, 'mashup_code');"
- id="tab1"
- onclick="return false;">Mashup Code</a></li><li class="tab-right"><img
src="images/blank.gif" width="8"/></li>
- <li class="tab"><a href=""
onmousedown="return event.returnValue = showPanel(this, 'ui_code');"
- onclick="return false;">Custom UI Code</a></li><li
class="tab-right"><img src="images/blank.gif" width="8"/></li>
- </ul>
-
+<div id="editor">
+ <ul class="user">
+ <li class="tab"><a href=""
+ onmousedown="return event.returnValue =
showPanel(this, 'mashup_code');"
+ id="tab1"
+ onclick="return false;">Mashup Code</a></li>
+ <li class="tab-right"><img src="images/blank.gif" width="8"/></li>
+ <li class="tab"><a href=""
+ onmousedown="return event.returnValue =
showPanel(this, 'ui_code');"
+ onclick="return false;">Custom UI Code</a></li>
+ <li class="tab-right"><img src="images/blank.gif" width="8"/></li>
+ </ul>
+
</div>
<div class="panel" id="mashup_code" style="display: block">
<%
Modified: trunk/mashup/java/modules/www/error.jsp
==============================================================================
--- trunk/mashup/java/modules/www/error.jsp (original)
+++ trunk/mashup/java/modules/www/error.jsp Mon Jan 21 07:17:31 2008
@@ -126,7 +126,7 @@
<br>
<div>You can try going back to the <a href="index.jsp">home page</a>
and starting over. If
- the problem persists, please bear with us since our team is
already looking into it.
+ the problem persists, please contact the administrator for
assistance.
</div>
</div>
<%@ include file="footer.jsp" %>
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev