Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C88C711CB4 for ; Fri, 25 Apr 2014 05:34:56 +0000 (UTC) Received: (qmail 57746 invoked by uid 500); 25 Apr 2014 05:34:18 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 57546 invoked by uid 500); 25 Apr 2014 05:34:14 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 57046 invoked by uid 99); 25 Apr 2014 05:34:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Apr 2014 05:34:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5689A992C57; Fri, 25 Apr 2014 05:34:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Fri, 25 Apr 2014 05:34:26 -0000 Message-Id: <675d9e82cbe84ae2b61db51cc04f1700@git.apache.org> In-Reply-To: <740c3ca311404cb1806d7c27ec493188@git.apache.org> References: <740c3ca311404cb1806d7c27ec493188@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [28/51] [partial] BlazeDS Donation from Adobe Systems Inc http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/samples/main.css ---------------------------------------------------------------------- diff --git a/apps/samples/main.css b/apps/samples/main.css new file mode 100755 index 0000000..5470820 --- /dev/null +++ b/apps/samples/main.css @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +body { + font-family: Verdana, Arial, Helvetica, sans-serif; + margin-top: 30px; + margin-top: 30px; + margin-left: 8%; + margin-right: 8%; + font-size: 0.8em; + color: #333333; + background-color:#FFFFFF; +} + +h1, h2, h3 { + font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif; + font-weight: bold; +} + +h1 { + font-weight: bold; + margin-top: 4px; + margin-bottom: 12px; + font-size: 2em; +} + +h2 { + padding-top: 12px; + margin-bottom: 0px; + font-size: 1.6em; + color: #333333; +} + +h3 { + margin-top: 0px; + font-size: 1.3em; + color: #004477; +} + +h4 { + margin-top: 20px; + margin-bottom: 8px; + font-size: 12px; + color: #333333; +} + +.item { + border-bottom: 1px solid #CCCCCC; + padding-top: 12px; + padding-bottom: 0px; +} + +.highlight { + border: 1px solid #CCCCCC; + padding-top:10px; + padding-left:10px; + padding-right:10px; + padding-bottom:0px; + border-color: #2080B3; + margin-top:20px; + margin-bottom:20px; +} + +.footer { + color: #666666; + margin-top: 20px; + font-size: 0.75em; +} + +ul { + margin-top:8px; + margin-bottom:8px; +} + +li { + padding-bottom:8px; +} + +code { + color: #000099; + font-family: "Courier New", Courier, monospace; + font-size:1.1em; +} + +img { + border: 0; +} + +#col1{ + float:left; + width: 20%; + padding-right: 24px; +} + +#col2{ + float: left; + width: 55%; +} + +#col3{ + float: right; + width: 20%; + margin: 0px; + padding: 0px; +} + +a:link { + color: #006699; + text-decoration: none; +} + +a:visited { + text-decoration: none; + color: #006699; +} + +a:hover { + text-decoration: underline; + color: #006699; +} + +a:active { + text-decoration: none; + color: #006699; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/samples/testdrive.htm ---------------------------------------------------------------------- diff --git a/apps/samples/testdrive.htm b/apps/samples/testdrive.htm new file mode 100755 index 0000000..072c404 --- /dev/null +++ b/apps/samples/testdrive.htm @@ -0,0 +1,254 @@ + + + + + +BlazeDS Test Drive + + + + +

BlazeDS Test Drive

+

In this test drive, you run a series of short sample applications that demonstrate the key features of BlazeDS. We walk you through the source code of each application to highlight the key points of its implementation. The source code for the Test Drive applications is available in samples\WEB-INF\flex-src\flex-src.zip. +

    +
  • If you want to examine the source code using your favorite code editor, unzip flex-src.zip anywhere on your file system.
  • +
  • If you want to open the source code in Flex Builder, unzip flex-src.zip in the root folder of your Flex Builder workspace, and read these instructions to set up your Flex Builder projects.
  • +
+

+ +
+

Sample 1: Accessing data using HTTPService

+ +

Run the sample:

+
    +
  1. Click here to run the application
  2. +
  3. Click "Get Data": The DataGrid is populated with XML data returned by catalog.jsp
  4. +
  5. Also notice some of the built-in DataGrid features:
  6. +
      +
    • Sortable columns (click on a column header)
    • +
    • Moveable columns (click on a column header and, with the mouse button pressed, move the column to a new position)
    • +
    +
+

Code walkthrough:

+

Open main.mxml in the testdrive-httpservice/src directory to look at the source code of the application.

+

Using HTTPService, you can send HTTP requests to a server, and consume the response. Although the HTTPService can be used to consume different types of responses, it is typically used to consume XML. You can use the HTTPService with any kind of server-side technology: JSP, Servlet, ASP, Ruby on Rails, PHP, etc. You specify the target service in the url property of HTTPService.

+

Flex provides sophisticated data binding capabilities. You can bind the value of a property to the value of another property, or to an expression in general. In this example, the dataProvider property of the DataGrid is bound (using the curly braces notation) to the lastResult property of the HTTPService.

+

HTTPService calls are asynchronous. The result event is triggered on the HTTPService when the data becomes available to the client application. The fault event is triggered if an error occurs at the server-side, or if the network becomes unavailable.

+

By default, the XML document retrieved from the server is deserialized into an object graph. This allows you to navigate through the result using the dot notation. You can also get the result as an XML document by specifying resultFormat="e4x" on the HTTPService. In that case, you can parse the document using E4X (ECMAScript for XML).

+

The BlazeDS server is not required to use the HTTPService: By default, the application tries to connect directly to the domain specified in the HTTPService url attribute. This will work if one of the two conditions below is satisfied:

+
    +
  1. The domain specified in the HTTPService url attribute is the domain from where your application was downloaded.
  2. +
  3. A crossdomain.xml file granting access to your application's originating domain is available on the domain specified in the HTTPService url attribute. More information on crossdomain.xml is available here.
  4. +
+

If you want your application to access services available on another domain without deploying a crossdomain.xml file on that domain (for example, because you may not own the target domain), you can set the useProxy attribute of the HTTPService to "true" like in this example. In this case, the request is sent to the BlazeDS proxy which makes the request to the target domain on the client application's behalf. This configuration also provides more control over the access to the service. For example, you may configure the proxy to require authentication before accessing a service, log access to the service, etc.

+

When using the proxy, you can specify a logical name in the HTTPService destination attribute instead of specifying a hardcoded value in the url attribute. You then map this logical name to an actual URL in WEB-INF\flex\proxy-config.xml. Open WEB-INF\flex\proxy-config.xml to see how the catalog destination is configured.

+

More info:

+
    +
  • Both HTTP and HTTPS are supported
  • +
+
+
+
+

Sample 2: Accessing data using Web Services

+

Run the sample:

+
    +
  1. Click here to run the application +

    NOTE: Since this application accesses a live web service, you must have a connection to the internet to run it.

  2. +
  3. Click "Get Data": The DataGrid is populated with data returned by the MXNA 2.0 web service hosted on feeds.adobe.com.
  4. +
+

Code walkthrough:

+

Open main.mxml in the testdrive-webservice/src directory to look at the source code of the application.

Access the wsdl file for the web service used in this example:

+ +

Using the WebService tag, you can invoke SOAP-based web services deployed in your application server or on the internet. Objects returned by a web service are automatically deserialized into ActionScript objects. Similarly ActionScript objects passed as arguments to a web service operation are serialized according the wsdl description.

+

Notice that we also added DataGrid column definitions (using DataGridColumn) in this example.

+

The BlazeDS server is not required to use the WebService: By default, the application tries to connect directly to the domain specified in the WebService wsdl attribute. This will work if one of the two conditions below is satisfied:

+
    +
  1. The domain specified in the WebService wsdl attribute is the domain from where your application was downloaded.
  2. +
  3. A crossdomain.xml file granting access to your application's originating domain is available on the domain specified in the WebService wsdl attribute. More information on crossdomain.xml is available here.
  4. +
+

If you want your application to access services available on another domain without deploying a crossdomain.xml file on that domain (for example, because you may not own the target domain), you can set the useProxy attribute of the WebService to "true" like in this example. In this case, the request is sent to the BlazeDS proxy which makes the request to the target domain on the client application's behalf. This configuration also provides more control over the access to the service. For example, you may configure the proxy to require authentication before accessing a service, log access to the service, etc.

+

When using the proxy, you can specify a logical name in the WebService destination attribute instead of specifying a hardcoded value in the wsdl attribute. You then map this logical name to an actual URL in WEB-INF\flex\proxy-config.xml. Open WEB-INF\flex\proxy-config.xml to see how the ws-catalog destination is configured.

+

More Info:

+
    +
  • Flex supports both RPC-encoded and document-literal web services
  • +
  • Like HTTPService, WebService calls are asynchronous: You can code result and fault event handlers
    +
  • +
+ +
+
+ +
+

Sample 3: Accessing data using Remoting

+

Run the sample:

+
    + +
  1. Click here to run the application
  2. +
  3. Click "Get Data": The DataGrid is populated with data returned by the getProducts() method of the ProductService Java class.
  4. +
+

Code walkthrough:

+

Open main.mxml in the testdrive-remoteobject/src directory to look at the source code of the application.

+

Open the following files in a text editor to look at the source code for the server side of the application:

+
    +
  • {context-root}\WEB-INF\src\flex\samples\product\ProductService.java
  • + +
  • {context-root}\WEB-INF\flex\remoting-config.xml
  • +
+

Using RemoteObject, you can directly invoke methods of Java objects deployed in your application server, and consume the return value. The return value can be a value of a primitive data type, an object, a collection of objects, an object graph, etc.

+

The value of the destination property of RemoteObject is a logical name that is mapped to a fully qualified java class in remoting-config.xml.

+

Java objects returned by server-side methods are deserialized into either dynamic or typed ActionScript objects. In this example, we don't have an explicit ActionScript version of the Product Java class. Product objects are therefore deserialized into dynamic objects. In sample 5, we work with an explicit Product class in ActionScript.

+

More info:

+
    +
  • Like HTTPService and WebService, RemoteObject calls are asynchronous. You use the result and fault events of the RemoteObject to handle results and errors.  
    + +
  • +
+ +
+
+ +
+

Sample 4: Flex Programming Model 101

+

Run the sample:

+
    +
  1. Click here to run the application
  2. + +
  3. Click a phone in the list: the details for the selected phone appear in the right panel
  4. +
+

Code walkthrough:

+

Open the following files in the testdrive-101/src directory to look at the source code of the application:

+
    +
  • main.mxml
  • +
  • Thumb.mxml
  • +
  • ProductView.mxml
  • +
+

Like in any other object-oriented programming language, a Flex application is made of a collection of classes. Using Flex, you can create classes using MXML or ActionScript. You typically create view classes in MXML, and Model and Controller classes in ActionScript.

+

When you create an mxml file, you are actually creating a class. The root node of the mxml document indicates the class you extend. For example, creating a file named MasterDetail.mxml with an <Application> root node is equivalent to creating an ActionScript class with the following signature:

+
+

public class MasterDetail extends Application {

+

}

+
+ +

Similarly, creating a file named ProductView.mxml with a <Panel> root node is similar to creating a class with the following signature:

+
+

public class ProductView extends Panel {

+

}

+
+

Once you have defined a class, you can use it programatically or declaratively (as a tag in MXML) without the need for an additional descriptor file. Public properties are automatically available as tag attributes. For example, in MasterDetail.mxml, we define the <ProductView> tag and bind its product attribute to the selected item in the product list.

+ +

Also notice the support for CSS style sheets.

+ +
+
+ +
+

Sample 5: Updating Data

+

Run the sample:

+
    +
  1. Click here to run the application
  2. + +
  3. Select a phone
  4. +
  5. Modify some data in the right panel. For example, the price.
  6. +
  7. Click Update: changes are sent to the back-end and persisted in the database by the ProductService class.
  8. +
+

Code walkthrough:

+

Open the following files in the testdrive-update/src directory to look at the source code of the application:

+
    +
  • main.mxml
  • +
  • ProductForm.mxml
  • +
  • Product.as
  • +
+

Open the following files in a text editor to look at the source code for the server-side of the application:

+
    +
  • WEB-INF\src\flex\samples\product\ProductService.java
  • +
  • WEB-INF\flex\remoting-config.xml
  • +
+

In Product.as we use the [RemoteClass(alias="flex.samples.product.Product")] annotation to map the ActionScript version of the Product class (Product.as) to the Java version (Product.java). As a result, Product objects returned by the getProducts() method of ProductService are deserialized into instances of the ActionScript Product class. Similarly, the instance of the ActionScript Product class passed as an argument to the update method of the RemoteObject is deserialized into an instance of the java version of the Product class at the server-side.

+ +
+
+ + +
+

Sample 6: Publish/Subscribe Messaging (Data Push Use Case)

+

Run the sample:

+

In this example, a Java component publishes simulated real time values to a message queue. The Flex client subscribes to that queue and displays the values in real time.

+
    + +
  1. To start the feed component at the server-side, access: testdrive-datapush/startfeed.jsp
  2. +
  3. Click here to run the application
  4. +
  5. Click the "Subscribe to 'feed' destination" button: Pushed values appear in the text field
  6. +
  7. To stop the feed when you are done experimenting with the application, access: testdrive-datapush/stopfeed.jsp
  8. +
+

Code walkthrough:

+

Open FeedClient.mxml in the testdrive-datapush/src directory to look at the source code of the application.

+

Open the following files in a text editor to look at the source code for the server-side of the application:

+
    +
  • WEB-INF\src\flex\samples\feed\Feed.Java
  • +
  • WEB-INF\flex\messaging-config.xml
  • +
+

Flex supports publish/subscribe messaging through the BlazeDS Message Service. The Message Service manages a set of destinations that Flex clients can publish and subsribe to. Flex provides two components, Producer and Consumer, that you use to respectively publish and subscribe to a destination. To subscribe to a destination, you use the subscribe() method of the Consumer class. When a message is published to a destination you subscribed to, the message event is triggered on the Consumer.

+

In Feed.java, the BlazeDS Java API (MessageBroker, AsyncMessage) is used to publish messages to the destination. Another option to exchange messages between Flex and Java applications is to map destinations to JMS topics, essentially allowing a Flex client to publish and subscribe to JMS topics. In addition to JMS, the Message Service adapter architecture allows you to integrate with any kind of messaging system.

+

Messaging destinations are configured in messaging-config.xml. A key element of a destination configuration is the channel used to exchange data between the client and the server. Using BlazeDS, a messaging destination typically uses a streaming or a polling channel.

+
    +
  • Using a streaming channel, the server response is left open until the channel connection is closed, allowing the server to send down incremental chunks of data to the client. HTTP connections are not duplex. This means that a single streaming AMF or HTTP channel actually requires two browser HTTP connections in order to send data in both directions. One for the streamed response from the server to the client that the channel hangs on to, and a second transient connection, drawn from the browser pool only when data needs to be sent to the server. This second transient connection is immediately released back to the browser’s connection pool.
  • +
  • A polling channel can be configured with a simple interval or with a sever wait if data is not immediately available (long polling). In either case, each poll response completes the request. Browser HTTP 1.1 connections are persistent by default, so the browser will likely recycle existing HTTP connections to send subsequent poll requests which lowers the overhead for polling.
  • +
+

The streaming channel is the best option when near real time communication is required.

+ +

Difference between IE and FireFox:

+

Browsers have a limited number of connections that they can maintain per session. The maximum number of connections allowed, as well as the way sessions are handled are browser specific.

+

In IE, the maximum number of connections per session is two, but if you start multiple IE instances from an operating system menu or shortcut, each instance is started in a different process and maintains its own session. However, if you start a new IE window using CTRL+N in an existing IE instance, that new window shares the same session as the IE instance that created it. In other words, you can have an unlimited number of applications using HTTP streaming to get data from the server as long as these applications are started in different IE processes. If you start multiple IE windows using CTRL+N, you are limited to the maximum number of connections per session (2).

+

In Firefox, the maximum number of connections per session is eight. If you start multiple Firefox instances from an operating system menu or shortcut, all the instances are started in the same process and share a single session. Since the browser will typically need one connection for traditional HTTP requests, you can theoretically have a maximum of seven HTTP streaming connections with the server across all your browser instances.

+

In either case, if the limit of connections per session is reached, the next attempt to connect to the server using a streaming channel will fail. BlazeDS provides an elegant fall back mechanism to handle such situations: The client always tries to connect using the first channel in the list of channles defined for the destination in messaging-config.xml. If that connection fails, the client automatically falls back to the next channel in the list. In this example, we defined the following default channelset for all the messaging destinations:

+

<default-channels>
+     <channel ref="my-streaming-amf"/>
+     <channel ref="my-polling-amf"/>
+ </default-channels>
+

+

In other words, the client application will try to connect using a streaming channel first and will fall back to a polling channel if the streaming connection fails.

+
+
+ +
+

Sample 7: Publish/Subscribe Messaging (Collaboration Use Case)

+

Run the sample:

+
    + +
  1. Click here to run the application
  2. +
  3. Open the same URL in another browser session to open a second instance of the chat application
  4. +
  5. Type a message in one of the chat clients and click "Send": the message appears in the two chat clients
  6. +
+

Code walkthrough:

+

Open Chat.mxml in the testdrive-chat/src directory to look at the source code of the application.

+ +

Open the following files in a text editor to look at the source code for the server-side of the application:

+
    +
  • WEB-INF\flex\messaging-config.xml
  • +
+

This sample builds on the concepts and APIs introduced in the previous example. To publish a message from a client, you use the send() method of the Producer class.

+

The messaging and real time infrastructure available in BlazeDS enables collaboration and data push applications to be built in a scalable and reliable manner while preserving the lightweight web deployment model.

+ +
+
+ + + http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/WEB-INF/activemq.xml ---------------------------------------------------------------------- diff --git a/apps/team/WEB-INF/activemq.xml b/apps/team/WEB-INF/activemq.xml new file mode 100755 index 0000000..2da9ae5 --- /dev/null +++ b/apps/team/WEB-INF/activemq.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/WEB-INF/flex/global.css ---------------------------------------------------------------------- diff --git a/apps/team/WEB-INF/flex/global.css b/apps/team/WEB-INF/flex/global.css new file mode 100755 index 0000000..f13e300 --- /dev/null +++ b/apps/team/WEB-INF/flex/global.css @@ -0,0 +1,17 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* global style sheet */ http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/WEB-INF/flex/messaging-config.xml ---------------------------------------------------------------------- diff --git a/apps/team/WEB-INF/flex/messaging-config.xml b/apps/team/WEB-INF/flex/messaging-config.xml new file mode 100755 index 0000000..86208b7 --- /dev/null +++ b/apps/team/WEB-INF/flex/messaging-config.xml @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + java:comp/env/jms/flex/TopicConnectionFactory + Topic + java:comp/env/jms/topic/flex/simpletopic + javax.jms.TextMessage + + + + + + + + + java:comp/env/jms/flex/TopicConnectionFactory + Topic + java:comp/env/jms/topic/flex/simpletopic + javax.jms.TextMessage + + + + + + + + + java:comp/env/jms/flex/QueueConnectionFactory + Queue + java:comp/env/jms/queue/flex/simplequeue + javax.jms.TextMessage + + + + + + + + + + java:comp/env/jms/flex/TopicConnectionFactory + Topic + java:comp/env/jms/topic/flex/simpletopic + javax.jms.TextMessage + + + + + + + + + java:comp/env/jms/flex/QueueConnectionFactory + Queue + java:comp/env/jms/queue/flex/simplequeue + javax.jms.TextMessage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + . + + + + + + + + true + . + + + + + + + + + + true + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/WEB-INF/flex/proxy-config.xml ---------------------------------------------------------------------- diff --git a/apps/team/WEB-INF/flex/proxy-config.xml b/apps/team/WEB-INF/flex/proxy-config.xml new file mode 100755 index 0000000..60be1f4 --- /dev/null +++ b/apps/team/WEB-INF/flex/proxy-config.xml @@ -0,0 +1,47 @@ + + + + + + + 100 + 2 + + true + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/WEB-INF/flex/remoting-config.xml ---------------------------------------------------------------------- diff --git a/apps/team/WEB-INF/flex/remoting-config.xml b/apps/team/WEB-INF/flex/remoting-config.xml new file mode 100755 index 0000000..4a28a1e --- /dev/null +++ b/apps/team/WEB-INF/flex/remoting-config.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + features.remoting.EchoService + + + + + + features.remoting.EchoService + + + + + + + features.messaging.serverpush.ServerPushService + application + + + + + + + features.remoting.EchoService + + + + + + + + + + features.remoting.EchoService + + + + + + + + + + features.runtimeconfig.RuntimeConfigurator + + + + + + + features.remoting.EchoService + + + + + + features.remoting.EchoService + + + + + http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/WEB-INF/flex/services-config.xml ---------------------------------------------------------------------- diff --git a/apps/team/WEB-INF/flex/services-config.xml b/apps/team/WEB-INF/flex/services-config.xml new file mode 100755 index 0000000..42c2296 --- /dev/null +++ b/apps/team/WEB-INF/flex/services-config.xml @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + + + Basic + + + sampleusers + + + + + Custom + + sampleusers + + + + + + + + + + + + + false + + false + true + + false + --> + + + + + + + + + + false + + + + + + + + false + true + + + + + + + + true + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + 0 + 10 + -1 + 3000 + + + + + + + + + + + true + 0 + 10 + -1 + 3000 + + + + + + + + + + + true + 0 + 10 + -1 + 3000 + + + + + + + + 2 + 10 + 5000 + + + + + + + + + + + 0 + 10 + 5000 + + + + + + + + + + + + + + false + + + + + + + + + false + + + + + + + + false + true + + + + + + + + true + 3 + + + + + + + + true + 0 + 10 + -1 + 3000 + + + + + + + + + + + + 10 + 5000 + + + + + + + + + + + + + + true + 3 + + + + + + + + + true + 3 + + + + + + + + + false + true + 3 + + + + + + + + + false + true + 3 + + + + + + + + false + true + + + + + + + + + [BlazeDS] + false + false + true + true + + + + + + + + + + true + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/WEB-INF/flex/user_classes/add_your_as_and_swc_files_here.txt ---------------------------------------------------------------------- diff --git a/apps/team/WEB-INF/flex/user_classes/add_your_as_and_swc_files_here.txt b/apps/team/WEB-INF/flex/user_classes/add_your_as_and_swc_files_here.txt new file mode 100755 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/flex-blazeds/blob/7a58369c/apps/team/WEB-INF/src/features/bootstrapservices/HTTPProxyBootstrapService.java ---------------------------------------------------------------------- diff --git a/apps/team/WEB-INF/src/features/bootstrapservices/HTTPProxyBootstrapService.java b/apps/team/WEB-INF/src/features/bootstrapservices/HTTPProxyBootstrapService.java new file mode 100755 index 0000000..b0dbc38 --- /dev/null +++ b/apps/team/WEB-INF/src/features/bootstrapservices/HTTPProxyBootstrapService.java @@ -0,0 +1,254 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package features.bootstrapservices; + +import flex.messaging.config.ConfigMap; +import flex.messaging.services.AbstractBootstrapService; +import flex.messaging.services.Service; +import flex.messaging.services.http.ExternalProxySettings; +import flex.messaging.services.http.HTTPConnectionManagerSettings; +import flex.messaging.services.http.HTTPProxyAdapter; +import flex.messaging.services.http.HTTPProxyDestination; +import flex.messaging.services.http.SOAPProxyAdapter; + +/** + * This BootstrapService is used to dynamicaly create a HTTPProxy Service along + * with its HTTPProxy Destinations without the need for any configuration files. + */ +public class HTTPProxyBootstrapService extends AbstractBootstrapService +{ + + /** + * Called by the MessageBroker after all of the server + * components are created but right before they are started. This is + * usually the place to create dynamic components. + * + * @param id Id of the AbstractBootstrapService. + * @param properties Properties for the AbstractBootstrapService. + */ + public void initialize(String id, ConfigMap properties) + { + Service httpProxyService = createService(); + createDestination1(httpProxyService); + createDestination2(httpProxyService); + createDestination3(httpProxyService); + } + + /** + * Called by the MessageBroker as server starts. Useful for + * custom code that needs to run after all the components are initialized + * and the server is starting up. + */ + public void start() + { + // No-op. + } + + /** + * Called by the MessageBroker as server stops. Useful for + * custom code that needs to run as the server is shutting down. + */ + public void stop() + { + // No-op. + } + + /* + + + + + + + + 100 + 2 + + + + true + + + 10.10.10.10 + 3128 + mycompany + flex + flex + + + + + + + + + + + + + + + + */ + private Service createService() + { + String serviceId = "proxy-service"; + String serviceClass = "flex.messaging.services.HTTPProxyService"; + Service httpProxyService = broker.createService(serviceId, serviceClass); + + // Note that are not set on the service since they are + // adapter related properties and will be configured at adapter level + + httpProxyService.registerAdapter("http-proxy", "flex.messaging.services.http.HTTPProxyAdapter"); + httpProxyService.registerAdapter("soap-proxy", "flex.messaging.services.http.SOAPProxyAdapter"); + httpProxyService.setDefaultAdapter("http-proxy"); + + httpProxyService.addDefaultChannel("my-http"); + httpProxyService.addDefaultChannel("my-amf"); + + return httpProxyService; + } + + /* + + + + http://{server.name}:/{context.root}/ + + + + + + + + http://www.mycompany.com/services/myservlet + + + http://www.mycompany.com/services/* + + + */ + public void createDestination1(Service service) + { + String destinationId = "DefaultHTTP"; + HTTPProxyDestination destination = (HTTPProxyDestination)service.createDestination(destinationId); + + destination.addDynamicUrl("http://{server.name}:*/{context.root}/*"); + + String adapterId = "http-proxy"; + HTTPProxyAdapter adapter = (HTTPProxyAdapter)destination.createAdapter(adapterId); + addProperties(adapter); + } + + /* + + + + + http://www.mycompany.com/services/myservlet + + + http://www.mycompany.com/services/* + + + */ + private void createDestination2(Service service) + { + String destinationId = "myHTTPService"; + HTTPProxyDestination destination = (HTTPProxyDestination)service.createDestination(destinationId); + + destination.setDefaultUrl("http://www.mycompany.com/services/myservlet"); + destination.addDynamicUrl("http://www.mycompany.com/services/*"); + + String adapterId = "http-proxy"; + HTTPProxyAdapter adapter = (HTTPProxyAdapter)destination.createAdapter(adapterId); + addProperties(adapter); + } + + /* + + + + + http://{server.name}:{server.port}/myapp/echo?wsdl + + + http://{server.name}:/myapp/echo + + + + + + */ + private void createDestination3(Service service) + { + String destinationId = "echoSoapService"; + HTTPProxyDestination destination = (HTTPProxyDestination)service.createDestination(destinationId); + + destination.setDefaultUrl("http://{server.name}:{server.port}/myapp/echo?wsdl"); + destination.addDynamicUrl("http://{server.name}:/myapp/echo"); + + String adapterId = "soap-proxy"; + SOAPProxyAdapter adapter = (SOAPProxyAdapter)destination.createAdapter(adapterId); + addProperties(adapter); + } + + /* + + + 100 + 2 + + + + true + + + 10.10.10.10 + 3128 + mycompany + flex + flex + + + */ + private void addProperties(HTTPProxyAdapter adapter) + { + HTTPConnectionManagerSettings cms = new HTTPConnectionManagerSettings(); + cms.setMaxTotalConnections(100); + cms.setDefaultMaxConnectionsPerHost(2); + adapter.setConnectionManagerSettings(cms); + + adapter.setAllowLaxSSL(true); + + ExternalProxySettings eps = new ExternalProxySettings(); + eps.setProxyServer("10.10.10.10"); + eps.setProxyPort(3128); + eps.setNTDomain("mycompany"); + eps.setUsername("flex"); + eps.setPassword("flex"); + adapter.setExternalProxySettings(eps); + } +}