Author: keith
Date: Wed Apr 30 04:28:53 2008
New Revision: 16391
Log:
Adding support for system.endpointURL
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/SystemHostObject.java
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
Wed Apr 30 04:28:53 2008
@@ -168,6 +168,7 @@
public static final String QUESTION_MARK = "?";
public static final String FORWARD_SLASH = "/";
public static final String DOT = ".";
+ public static final String EMPTY_STRING = "";
// The value that is used by the javascript init annotation. e.g this.init
= function (){}
public static final String INIT_ANNOTATION = "init";
Modified:
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/SystemHostObject.java
==============================================================================
---
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/SystemHostObject.java
(original)
+++
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/system/SystemHostObject.java
Wed Apr 30 04:28:53 2008
@@ -19,7 +19,9 @@
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.util.UUIDGenerator;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisConfiguration;
@@ -144,6 +146,28 @@
/**
* <p/>
+ * Get the string representing the request address.
+ * </p>
+ * <p/>
+ * <pre>
+ * var endpointURL = system.endpointURL;
+ * </pre>
+ */
+ public String jsGet_endpointURL() throws MashupFault {
+ Object object = Context.getCurrentContext()
+
.getThreadLocal(JavaScriptEngineConstants.AXIS2_MESSAGECONTEXT);
+ if (object instanceof MessageContext) {
+ MessageContext messageContext = (MessageContext) object;
+ EndpointReference to = messageContext.getTo();
+ if (to != null) {
+ return to.getAddress();
+ }
+ }
+ return MashupConstants.EMPTY_STRING;
+ }
+
+ /**
+ * <p/>
* Imports the external scripts given as the arguments, to the java script
* run time. Paths of the scripts to be imported can be given using a comma
* separated list as arguments. Imported script files needs to be placed in
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev