Thread Rating:
  • 602 Vote(s) - 2.77 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Serving Content1:Launching a Curl Applet
06-15-2011, 05:12 PM, (This post was last modified: 06-20-2011, 04:42 PM by kino.)
#1
Serving Content1:Launching a Curl Applet
The design and development is complete and now you are ready to deploy your Curl application on a server. Storing the files on your local machine allows you to easily build and test the application and now all the Curl and supporting files must be moved to the server. The first item is to identify the server and move the files over. Next, you must configure your server to accept Curl application requests.


Server Requests
Each time a user selects a link to navigate to a new Web page, the browser sends request to the server. The server receives the request and sends the requested information back to the browser. The browser then interprets and displays the information to the user.


When the requested information contains Curl content, the browser receives the information and launches the Curl runtime environment if it is not previously loaded. The processing of the applet is performed on the client and the content is presented to the user in the browser window.


Server Configuration
How does the server know about Curl? When you are ready to deploy a Curl application, you will need to configure your server to work with Curl files.

•The first step is to take the application files and place them on your server

•Next, allow access to files

•Finally, configure the MIME type


We'll go through all the steps in more detail.


Placing Files on your Server
In addition to your application and data files, you will need to put a server license file on your server. The Curl RTE will not execute a curl applet from an http:// or https:// location unless there is a valid license file on the server.


There are two kinds of server licenses, the free personal license and a paid license for commercial use.


•A Curl/Personal Server License unlocks most features of the Curl platform, excepting several features whose primary value is for enterprise applications. You can get a Curl/Personal Server License at no charge for your Web site if you are a noncommercial user.

•A Curl/Pro Server License unlocks the full capabilities of the Curl platform. If you are an enterprise, you need to use a Curl/Pro license.


Each kind of server license takes the form of a file called curl-license-5.dat that you obtain from Curl and place on your Web server to indicate that you are licensed to deploy Curl applications on the Web. In the simplest case, you put this file in the root directory of your Web server. Other options are also available such as placing the server license in the same directory as your Curl applet files.



For more information regarding server licenses, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Configuring Your Web Server > License Keys

Allowing Applets to Access Files
The curl-access.txt file contains directives that define which Curl applets can access the Web site's files. Applets are restricted based on their home site, which is the Web site from which they were downloaded. Using curl-access.txt, a server administrator can allow all Curl applets to access files on that server, or can restrict access so that, for example, only Curl applets hosted on other servers in the same domain, or only Curl applets from that server, can access the files. Generally, a Curl applet will access at least some files on the same server where the applet is deployed, so it is usually necessary to have some form of curl-access.txt file on that server.


The directives in the curl-access.txt file declare which Curl applets are authorized to access its files. The following curl-access.txt file grants access to applets from all servers:

Code:
#Allow applets free access
version: 2.0
allow-all:


The next curl-access.txt file grants access to Curl applets from specific sites and can selectively filter access to the server from publicly deployed applets:

Code:
#Allow applets free access
version: 2.0
allow: *.mydomain.com, test.mysupplier.com
except: public-ftp.mydomain.com



The curl-access.txt mechanism does not override any other protections that your Web site has in place to restrict access to files. If the user could not access a file directly using a browser, then an applet on his or her system will not be able to access the file either. This is true even with a curl-access.txt file that grants the applet access to files on that server.



You can either place this file in the root directory of your Web server or in the same directory as the data files whose accessibility you want to control. When placed at the root of the Web site, the curl-access.txt directives will override all other directives found in the subdirectories of that Web site. Consequently, this method will subject all the files on your Web site to the same rules. When the curl-access.txt file is placed at the local directory level, it controls the access to just the files contained in that directory.



For more information regarding Curl access, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Configuring Your Web Server > Allowing Applets to Access Files

Configure Mime Type
In order to serve Curl applets from your Web site, you also need to add MIME type definitions for Curl source files and package files to your Web server's configuration. The MIME type is how the server tells the browser that a file should be handled by the Curl runtime environment.



The .dcurl and .car file types are used for specialized purposes. .dcurl files are used for detached applets, which run outside of a browser window as standalone applications. .car files are used when deploying an applet that can be used offline as well as online.




For more information regarding MIME Types, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Configuring Your Web Server > Source MIME Types for Curl files



Launching a Curl applet
Now you are all ready to serve Curl content. The easiest way to launch a Curl applet from a server is to type the url location of the start file (start.curl) of the application. The following Curl applet can be accessed by directly selecting the link. (Select the back button in the browser window to return to Curl Cues.)


Select this link to launch a Curl applet


Launching a Curl applet from a Curl applet
It is common to have one Curl applet launch another Curl applet. One example is login capability in which the "login applet" launches another Curl applet based on the required authentication.


The browse-url method in the Applet class allows you to load a given url; it has the same effect as selecting a link. The browser's history will be updated appropriately.

Code:
{curl 6.0, 7.0 applet}
{applet {compiler-directives careful? = true}}

{value
let my-applet:Applet = {get-the-applet}

let browse-button:CommandButton =
{CommandButton
label = "Launch Applet",
{on Action do
{my-applet.browse-url
{url "./launch-1.curl"},
target = "_blank"
}
}
}

{VBox
{bold The following button launches another Curl applet},
browse-button
}
}

The above example launches a Curl applet when the CommandButton is pressed. The browse-url method is associated with the action of the CommandButton. The target specified in browse-url ("_blank") will open a new browser window. The default behavior is to use the same window as the running applet ("_self").



Other ways to run Curl applets...

•Embedding Curl applets in HTML. Please see http://developers.curl.com/docs/DOC-1127.

•Generating Curl using PHP or similar scripts. Please see http://developers.curl.com/docs/DOC-1128.



Attached Files
.jpg   Launching a Curl Applet1.JPG (Size: 19.91 KB / Downloads: 1,534)


Possibly Related Threads...
Thread Author Replies Views Last Post
  Getting Started1:Creating a Simple Applet: Hello World kino 2 6,323 08-15-2016, 03:50 PM
Last Post: dyoshida
  Styling1:Curl Styles kino 0 5,246 06-16-2011, 09:14 AM
Last Post: kino
  Serving Content3:Dynamically Generating Curl Content kino 0 5,191 06-15-2011, 05:19 PM
Last Post: kino
  Serving Content2:Launching and Embedding Curl in HTML kino 0 9,466 06-15-2011, 05:15 PM
Last Post: kino
  Getting Started3:Top-level Applet Specifications kino 0 3,448 06-15-2011, 02:42 PM
Last Post: kino
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('23')