You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2008/07/10 20:40:32 UTC

svn commit: r675670 - in /cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url: src/demo/hw/server/Server.java src/demo/hw/server/applicationContext.xml staticContent/HelloWorld.html

Author: bimargulies
Date: Thu Jul 10 11:40:32 2008
New Revision: 675670

URL: http://svn.apache.org/viewvc?rev=675670&view=rev
Log:
This now (a) works and (b) is useless.

Added:
    cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/applicationContext.xml   (with props)
Modified:
    cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/Server.java
    cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/staticContent/HelloWorld.html

Modified: cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/Server.java?rev=675670&r1=675669&r2=675670&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/Server.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/Server.java Thu Jul 10 11:40:32 2008
@@ -19,15 +19,21 @@
 
 package demo.hw.server;
 
-import javax.xml.ws.Endpoint;
+
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.ClassPathResource;
 
 public class Server {
+	private GenericApplicationContext applicationContext;
 
     protected Server() throws Exception {
         System.out.println("Starting Server");
-        Object implementor = new GreeterImpl();
-        String address = "http://localhost:9000/JSDemoService/JSDemoPort";
-        Endpoint.publish(address, implementor);
+        
+        applicationContext = new GenericApplicationContext();
+        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(applicationContext);
+        reader.loadBeanDefinitions(new ClassPathResource("applicationContext.xml", this.getClass()));
+        applicationContext.refresh();
     }
 
     public static void main(String args[]) throws Exception {

Added: cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/applicationContext.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/applicationContext.xml?rev=675670&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/applicationContext.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/applicationContext.xml Thu Jul 10 11:40:32 2008
@@ -0,0 +1,61 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xmlns:jaxws="http://cxf.apache.org/jaxws"
+      xmlns:cxf="http://cxf.apache.org/core"
+      xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+
+      xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+">
+
+<!--  standard CXF support files. -->
+ <import resource="classpath:META-INF/cxf/cxf.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-javascript-client.xml"/>
+ 
+<httpj:engine-factory bus="cxf">
+ <!-- The static content runs on port 9001 -->
+ <httpj:engine port="9001">
+  <httpj:handlers>
+    <bean class="org.mortbay.jetty.handler.ContextHandler">
+     <property name="contextPath" value="/" />
+     <property name="handler">
+      <bean class="org.mortbay.jetty.handler.ResourceHandler">
+       <property name="baseResource">
+        <bean class="org.mortbay.resource.FileResource">
+         <constructor-arg value="file:staticContent" />
+        </bean>
+        </property>
+      </bean>
+     </property>
+    </bean>
+    <bean class="org.mortbay.jetty.handler.DefaultHandler"/>
+  </httpj:handlers>
+ </httpj:engine>
+</httpj:engine-factory>
+
+ <jaxws:endpoint
+        id="hello_world"
+        implementor="demo.hw.server.GreeterImpl"
+        address="http://localhost:9000/hello_world">
+                <jaxws:features>
+ 		    <bean class="org.apache.cxf.feature.LoggingFeature"/>
+                </jaxws:features>
+    </jaxws:endpoint>
+    <!--  to force the server to start on 9001, we have an extra copy of the endpoint... -->
+    
+     <jaxws:endpoint
+        id="hello_world_9001"
+        implementor="demo.hw.server.GreeterImpl"
+        address="http://localhost:9001/hello_world_9001">
+                <jaxws:features>
+ 		    <bean class="org.apache.cxf.feature.LoggingFeature"/>
+                </jaxws:features>
+    </jaxws:endpoint>
+    
+</beans>

Propchange: cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/applicationContext.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/src/demo/hw/server/applicationContext.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/staticContent/HelloWorld.html
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/staticContent/HelloWorld.html?rev=675670&r1=675669&r2=675670&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/staticContent/HelloWorld.html (original)
+++ cxf/trunk/distribution/src/main/release/samples/js_browser_client_cross_url/staticContent/HelloWorld.html Thu Jul 10 11:40:32 2008
@@ -20,26 +20,13 @@
 <head>
 <title>Hello World JavaScript Client Sample</title>
 <!-- Generate and retrieve a JavaScript client for the server. -->
-<!--
-<script type="text/javascript" src="/JSDemoService/JSDemoPort?js"></script>
--->
-<script type="text/javascript">
+<script type="text/javascript" src="http://localhost:9001/hello_world_9001?js"></script>
 <!-- To simulate loading from a URL that isn't on the same host
      we dynamically construct the script. Note that in the real world
      you could hardcode a script element. -->
+<script type="text/javascript">
 
-function loadjs(filename) {
- if (filetype=="js"){ //if filename is a external JavaScript file
-  var fileref=document.createElement('script')
-  fileref.setAttribute("type","text/javascript")
-  fileref.setAttribute("src", filename)
-}
-
-var jsurl = 'http://' + window.location.hostname + ':9000/JSDemoService/JSDemoPort?js';
-
-loadjs(jsurl);
-
-var Greeter = new apache_org_hello_world_soap_http_Greeter();
+var Greeter = null;
 
 var responseSpan;
 
@@ -61,6 +48,7 @@
 {
     responseSpan = document.getElementById('sayHiResponse');
     responseSpan.firstChild.nodeValue = " - pending - ";
+    Greeter = new apache_org_hello_world_soap_http_Greeter();
     Greeter.sayHi(sayHiResponse, sayHiError);
 }
 </script>