Author: tyrell
Date: Mon Jan 14 07:52:26 2008
New Revision: 12224
Log:
Removing referrer locks, since there is no point in having them.
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
trunk/mashup/java/modules/coreservices/servicemetadatalister/src/org/wso2/mashup/coreservices/servicemetadatalister/ServiceMetaDataListerService.java
trunk/mashup/java/modules/www/editor.jsp
trunk/mashup/java/modules/www/js/mashup-utils.js
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
Mon Jan 14 07:52:26 2008
@@ -16,6 +16,7 @@
package org.wso2.mashup.utils;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.transport.http.util.URIEncoderDecoder;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.deployment.DeploymentEngine;
import org.apache.axis2.description.AxisService;
@@ -43,6 +44,7 @@
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Hashtable;
@@ -360,4 +362,44 @@
return serviceUiSource;
}
+
+ public static String isPossibleToCreateService(String servicePath) {
+ String success = "OK";
+
+ String decodedServicePath = "";
+ String serviceName = "";
+
+ //Validating the service name
+ try {
+ decodedServicePath = URIEncoderDecoder.decode(servicePath);
+
+ //Extracting the real path from the registry path provided
+ String[] pathContents = decodedServicePath.split("/");
+ decodedServicePath = "";
+ for (int x = 2; x < pathContents.length; x++) {
+ decodedServicePath = decodedServicePath + "/" +
pathContents[x];
+ }
+
+ serviceName = pathContents[3];
+ MashupUtils.validateName(serviceName, "ServiceName");
+ } catch (MashupFault e) {
+ success = e.getMessage();
+ } catch (UnsupportedEncodingException e) {
+ success = e.getMessage();
+ }
+
+ //Validating the possibility to create a new service file.
+ ServerManager serverManager = ServerManager.getInstance();
+ ConfigurationContext configContext = serverManager.configContext;
+
+ File serviceJs = new
File(configContext.getRealPath(configContext.getContextRoot()) +
+ "/scripts/" + decodedServicePath + ".js");
+
+ if (serviceJs.exists()) {
+ success = "A service with the name you specified (" + serviceName +
+ ") already exists. Please use a new name or use the 'edit'
option to edit the existing service.";
+ }
+
+ return success;
+ }
}
Modified:
trunk/mashup/java/modules/coreservices/servicemetadatalister/src/org/wso2/mashup/coreservices/servicemetadatalister/ServiceMetaDataListerService.java
==============================================================================
---
trunk/mashup/java/modules/coreservices/servicemetadatalister/src/org/wso2/mashup/coreservices/servicemetadatalister/ServiceMetaDataListerService.java
(original)
+++
trunk/mashup/java/modules/coreservices/servicemetadatalister/src/org/wso2/mashup/coreservices/servicemetadatalister/ServiceMetaDataListerService.java
Mon Jan 14 07:52:26 2008
@@ -377,42 +377,7 @@
public String isPossibleToCreate(String servicePath) {
- String success = "OK";
-
- String decodedServicePath = "";
- String serviceName = "";
-
- //Validating the service name
- try {
- decodedServicePath = URIEncoderDecoder.decode(servicePath);
-
- //Extracting the real path from the registry path provided
- String[] pathContents = decodedServicePath.split("/");
- decodedServicePath = "";
- for (int x = 2; x < pathContents.length; x++) {
- decodedServicePath = decodedServicePath + "/" +
pathContents[x];
- }
-
- serviceName = pathContents[3];
- MashupUtils.validateName(serviceName, "ServiceName");
- } catch (MashupFault e) {
- success = e.getMessage();
- } catch (UnsupportedEncodingException e) {
- success = e.getMessage();
- }
-
- //Validating the possibility to create a new service file.
- ServerManager serverManager = ServerManager.getInstance();
- ConfigurationContext configContext = serverManager.configContext;
-
- File serviceJs = new
File(configContext.getRealPath(configContext.getContextRoot()) +
- "/scripts/" + decodedServicePath + ".js");
-
- if(serviceJs.exists()){
- success = "A service with the name you specified (" + serviceName
+ ") already exists. Please use a new name or use the 'edit' option to edit the
existing service.";
- }
-
- return success;
+ return MashupUtils.isPossibleToCreateService(servicePath);
}
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 14 07:52:26 2008
@@ -18,16 +18,14 @@
<%@ page import="org.wso2.mashup.utils.MashupUtils" %>
<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
<%@ page import="org.wso2.registry.Registry" %>
-<%@ page import="org.wso2.registry.Resource" %>
<%@ page import="java.net.URLDecoder" %>
+<%@ page import="java.util.Enumeration" %>
<%
//Disabling browser caching
response.setHeader("Cache-Control", "no-cache"); //HTTP 1.1
response.setHeader("Pragma", "no-cache"); //HTTP 1.0
response.setDateHeader("Expires", 0); //prevents caching at the proxy
server
- String currentReferer = request.getHeader("Referer");
-
Registry registry = RegistryUtils.getRegistry(request);
String bounceback = request.getParameter("bounceback");
@@ -65,17 +63,6 @@
String[] validReferers = { "mashup.jsp" };
boolean validReferer = false;
- for (int x = 0; x < validReferers.length; x++) {
- if (currentReferer.contains(validReferers[x])) {
- validReferer = true;
- }
- }
-
- if (!validReferer) {
- throw new Exception(
- "Sorry. Unable to launch the editor. Please try using the
links provided in the ui to edit a mashup.");
- }
-
if (pathContents.length < 4) {
throw new Exception("Sorry. The path specified for the mashup is
invalid.");
} else {
@@ -92,22 +79,11 @@
"Sorry. A request was made to create a mashup without
providing a valid name.");
} else if ((action.equalsIgnoreCase("new")) && (mashup != null)) {
author = currentUser;
-
- //Restricting new mashup creation for particular referer pages
- String[] validReferers = { "user.jsp", "mashup.jsp" };
- boolean validReferer = false;
-
- for (int x = 0; x < validReferers.length; x++) {
- if (currentReferer.contains(validReferers[x])) {
- validReferer = true;
- }
- }
-
- if (!validReferer) {
- throw new Exception(
- "Sorry. Unable to launch the editor. Please try using the
links provided in the ui to create a new mashup.");
+ String serviceValidationResult =
+ MashupUtils.isPossibleToCreateService("/mashups/" + author +
"/" + mashup);
+ if (!(serviceValidationResult.equalsIgnoreCase("ok"))) {
+ throw new Exception(serviceValidationResult);
}
-
}
%>
<html>
Modified: trunk/mashup/java/modules/www/js/mashup-utils.js
==============================================================================
--- trunk/mashup/java/modules/www/js/mashup-utils.js (original)
+++ trunk/mashup/java/modules/www/js/mashup-utils.js Mon Jan 14 07:52:26 2008
@@ -366,6 +366,8 @@
lblStatusMessages.setAttribute("id", "lblStatus");
parent.appendChild(lblStatusMessages);
+ parent.appendChild(document.createElement("br"))
+
var cmdSubmit = document.createElement("input");
cmdSubmit.setAttribute("type", "button");
cmdSubmit.setAttribute("id", "cmdSubmit");
@@ -398,7 +400,7 @@
if (response == "OK") {
//Redirecting to the actual editor
- window.location = "editor.jsp?action=new&mashup=" + this.params[1]
+ window.location.href = "editor.jsp?action=new&mashup=" +
this.params[1]
} else {
this.params[0].innerHTML = response;
}
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev