> Appendices C, D and References
< Maintenance in the application, your reflection in the interface and Conclusion
Migration of Applications for Web Environment - A Practical Approach
Below are shown the various resources used in the solution. The understanding of these resources will allow, for example, the understanding that the Java Script may, in certain circumstances, be replaced by Java, and so on.Clearly as our focus is to Web interface, features such Html hardly can be replaced by another.
Bash
The Bash, "GNU-Bourne Again Shell," (BASH, 2007), is an interpreter of commands, or "shell", as it is known in operating systems such as Unix and Linux. There are several different types of interpreters, the Bash , Sh, Csh, KornShell, among others.Each of these types has its specificity, but there is a set of standard commands to which all serve. The interpreter of commands most used in Linux is the Bash, in addition, there are currently versions of the interpreter for Windows systems, a common example is the CygWin, a distribution free, easy to install, which currently uses the version 3.2 of Bash and can be obtained in http://www.cygwin.com/
The Bash is a program that allows the user to interact with the operating system using commands entered on the keyboard. Whit its use is possible tocreate scripts, or sequences of commands edited in a text file, which can be executed as if they had been typed by the user, through reference to the file name, for example:
#!/bin/bash
# Program Hello World
echo “Hello World"
In addition to running the system commands, the Bash incorporates a language itself with commands such as if, for, while and definition of variables, functions, tables, among others, as most programming languages.
The Bash is versatile and complete enough for different types of programmes are made with him. It has a natural interaction with the operating system and its programs, giving conditions to be developed interactive interfaces with the user, calculations programs, Cgi programs, installers of software, database handlers, backup routines, among others.
Exemplo de script: Sample script:
#!/bin/bash
# Tests the environment variable Cgi GATEWAY_INTERFACE
# and depending on your existence decide the type of interface to be executed
if [ "$GATEWAY_INTERFACE" ] ; then
echo "Run Web interface"
else echo “Run interface character"; fi
More information about the Bash can be found on the site of the project http://tiswww.tis.case.edu/ ~ chet / bash / bashtop.html or the Bash's manual, "man bash," available in most Linux distributions.
Http
Http, (HTTP, 2007), which means "HyperText Transfer Protocol", or hypertext transfer protocol, is the most used protocol for the transmission of data in the Web environment Each time a user triggers a particular link, their browser performs a communication with a server pages through this protocol.
This protocol transfers data of images, sounds and texts and is to feature the use of language Html, (HTML, 2007), "Hipertext Markup Language," in Hypertext Markup Language, to carry out their services.
Html
The concept of hypertext is based on the fact of having access another document from the current document through the connection information that link a document to another, and so on. These documents are in a pre-determined location, usually called a "site" and who has access to them due to enter their URL address, called "Universal Resource Indentifier"; for example, www.google . com.br.
The Html, in addition to incorporate the concept of hypertext, is a language specialist in the construction of pages and the presentation of information in a Web browser by the user. It consists of a common text, edited in files usually with suffix ". htm or . html". It is a language with markings, known as "tags". All tags used are predefined and have each of them a particular use. When a site is a query to a database, the servers of Web applications results in Html format to be presented later by the user's browser. See example of Html page below:
<html>
<head>
<title>Html</title>
</head>
<body>
<form method="post" action="tst_html?receive">
<input type="text" name="field">
</form>
</body>
</html>
There is for example, tags such as "<title>, </ title>" indicating the title of the page, "<form>, </ form>" that allow the definition of a form and finally "<input. ..> "which is specified in a box of text to be edited.
If the previous text is edited on file with the name "tst_html.html" then copied to a folder of documents from a server pages and open through a browser such as Mozilla Firefox, stating "http://localhost/htdocs/folder_name/tst_html.html " as a result will be obtained to display the page as Figure 42:
Figure 42 - Example of html page
The Html is a language specializing in the presentation of information in the Web environment, through user's browser.Despite its relative simplicity, it is possible to display information to users in a way quite presentable, including texts formatted in various patterns of letters, colors, pictures and photos.
Cgi
The Cgi, "Common Gateway Interface" is a form of communication that a server pages used to send information between the user's browser and a computer program on a server. It is the interface between a server protocol of hypertext, Http and other resources of the server computer. (WEINMAN, 1997).
The Cgi is not really a language or protocol, but rather a set of variables and conventions for sending and receiving information between the browser and the program on the computer server, usually called "Cgi program." Similarly, a "Cgi program" is not Cgi alone depends on other factors. Moves to act as a Cgi program, send and receive information from the browser, when it is installed in an appropriate place, generally called a directory or folder Cgi and in this condition, running through the server pages, and always depending on him, as exemplified in the script Bash below:
#!/bin/bash
# cgi
# verify if form exist
if test $1 ; then read form ;fi
# displays the Cgi-Bin page
echo "Content-type: text/html" ;echo
echo "<html>" ; echo "<head>"
echo "<title>Cgi-Bin</title>"
echo "</head>" ; echo "<body>"
echo "<form method=\"post\" action=\"tst_cgi-bin?receive\">"
echo "<input type=\"text\" name=\"field\">"
echo "</form>" ; echo "</body>" ; echo "</html>"
Assuming that the name of the file containing the script Bash is "tst_cgi-bin", its implementation in a common folder, the command line "> tst_cgi-bin," in the terminal will result in the display of html text as shown in Figure 43:
Figure 43 - Example of cgi script run at a terminal
But if the same script is copied to a folder Cgi a server pages and opened in a browser, entering the following address; "http://localhost/cgi-bin/folder_name/tst_cgi-bin" at the moment he act as Cgi program, and the result shown in Figure 44 will be displayed in the browser.
Figure 44 - Example of html page generated in environment Cgi
That is, the same script, now running through the server pages, the information showed that at the moment were captured and sent to the user's browser. The display of source code is presented as Figure 45:
Figure 45 - Source of html page generated in environment Cgi
When observing the result produced and is compared with the initial situation where manually editing the text Html getting only a static page a new range of poss1ibilities is presented.
A program that operates as Cgi, be prepared with the Bash, Java, or any other language that has equivalent conditions, can create pages dynamically. Additionally, it contains a logic built, allows some "intelligence", for example, receive information by any means and generate, based on a "protocol" pre-established, pages that change constantly, performing a function of interface.
Css
When thinking in interface, presentation of the issues are always present. The Css, (CSS, 2007), Cascading Style Sheets, comes as its name says deals of the style of the page.For style should be considered a lot of features, such as colors, types and sizes of text, positioning, finally, a set of parameters that allow refinement in the presentation and the behavior of the components of the page.
There are two basic ways to embed elements on a page Css Html. One way to issues that are specific to the page, is in the actual text file html, such as:
<input type="text" size=18 value="Name______________"
style="position: absolute; top: 140px; left: 9px; width: 166px;">
In this example it is observed that the tag "<input" are placed the attributes of style, "style =" for absolute positioning type in pixels, in the coordinates 140 for 9 with width of 166.
The second way to more general issues, there is a text file with attributes Css and reference is made to it in the text html, as the example that follows:
On file "tst_css.css"
<!--
body {background-color: lightgrey;}
-->
To reference, in "tst_html.html"
<html>
<head>
<title>Html</title>
<link href="tst_css.css" rel="stylesheet">
</head>
<body>
- - - -- - --
In the text Css general, is informed that the tag "<body>" shall have the background color light gray, then this feature will apply to all bodies of page that make reference to it, as can be seen in the second tag "<href link =...".
The main advantage to use this type of action is to be necessary change this attribute, simply to amend the text of Css general characteristics and this is so automatic reflect on all pages involved, whether static or dynamic.
Running through a browser, entering the following address; "http://localhost/htdocs/folder_name/tst_html.html", the result will be as shown in Figure 46:
Figure 46 - Example of html page with Css changing the background color
JavaScript
JavaScript, (FLA, 2002), is a language to be used in Web pages, developed by Netscape.With this language, it is possible to implement logic to adding pages dynamic resources, improving the look and especially controlling the actions executed by the user.The fact does not require the installation of special software for their implementation, as occurs with other languages to more sophisticated Web environment, makes it of great usability, as any page can contain their resources. Everything depends on the ability of the browser to understand their instructions and currently, virtually all browsers have this condition.
In its essence, the language acts inserted in the middle of the Html code of web pages. This integration can be done in various ways, from the inclusion of code in a certain area, at various points of the page, if referencing an external file to the page or any combination of forms earlier. The way to use depends on issues such as general or specificity of the code.The language allows use variables, create functions, using pictures, monitor events mouse and keyboard, and have, as any other language commands to control flow, as if, while among others, as exemplified in the following, in the file tst_javascript . Html:
<html>
<head>
<title>JavaScript</title>
</head>
<body>
<script language="Javascript">
document.write ("Text written with JavaScript")
</script>
</body>
</html>
As you can see, inserted in the text Html, between the tags "<script>" and "</ script>" are commands JavaScript, and in this instance, the "document.write" which displays the text "Text written with JavaScript" .
His execution in a browser, informing the address, for example, "http://localhost/htdocs/folder_name/tst_javascript," will result shown in the Figure 47:
Figure 47 - Example of html page with the browser running JavaScript code
As with the Css, it is possible to use the code referring to an external file.
On file "tst_javascript.jsc":
function write () {
document.write ("Text generico written with JavaScript") }
To reference in, "tst_javascript.html"
<html>
<head>
<title>JavaScript</title>
<script language="javascript" src="tst_javascript.jsc">
</script>
</head>
<body onload="write ()">
</body>
</html>
There is some differences in relation to prior use:
The command to write appears in a function named "write," with its actions are among the characters" {}", as html in the text, the reference is through the parameter "src =" that points the place in which the script, and finally the tag "<body", which instructs from the event load, "onload", to perform the "write".
Initially, it seems that everything has become more complex, but when considering issues such as generic codes, which can be used for several pages, this context becomes quite applicable. Running up again in a browser, there is the same result up, as shown in Figure 48:
Figure 48 - Navigator running JavaScript code with code referenced
As already explained, the Engine Access consists of the main components in accordance with the figure 49:
Components.
Figure 49 - Components of engine access
Continuing presented to the different stages of implementation, the initailization, processing and finalization as well as the performance of its main components:
Initialization phase.
Figure 50 - Components of the initialization
Following the performance of the components in the initalization phase, as can be seen in Figure 50:
1. User sends information to the selected application to web server, and this runs the client's application on condition of initialization.
2. The client's application on condition of initialization, asks the server applications the implementation selected and then enter in a state of waiting, waiting for new pages to return to send.
3. The server applications effectively starts the application selected in the background, or on a standalone, it is by hanging up after a request for its implementation and returns to the state of waiting, waiting for another request.
4. The application selected continue its normal implementation until such time that needs information Interface, and this, detecting environment Web, send page to the client's application that was in your await, logging itself in a state of waiting.
5. The client's application, until then in a state of waiting, detecting that page to be send, displays the information for the web server and exit.
This sequence occurs only once, and is followed by the next phase.
Processing phase.
Figure 51 - Components of the processing
Anyway, the performance of the components in the stage of processing, as can be seen in Figure 51:
1. User, through interaction with the application sends form information to the web server, and this runs the client's application now in the condition of processing.
2. The client's application detecting the condition of processing, translates the information form on file, so that it can be read by the application running, until then await in the new information and then enter in a state of waiting, waiting to return on new pages to send.
3. The application selected, noticing details of interaction through its Web interface, runs internally all necessary procedures until such time that needs new information from the interface, and this, detecting environment Web, send page generated to client's application which was in I await her, entered again in a state of waiting.
4. The client's application, which was in a state of waiting, detects that page to be sent, displays the information to the web server and exit.
This cycle continues indefinitely, until the user requests the finalization of the application, which will be explained in the next stage.
Finalization phase.
Figure 52 - Components of the finalization
Finally, the performance of the components in the stage of the finalization, as can be seen in Figure 52:
1. The user, ending the interaction with the application, send a request form for finalization to the web server, and this runs the client's application yet on the condition of processing, because the situation of finalization is transparent for this module.
2. The client application of detecting the condition of processing, translates the information form on file, so that it can be read by the application running, until then await in the new information and then enter in a state of waiting, waiting to return on new pages to send.
3.The application selected, noticing details of interaction through its Web interface, runs internally its procedures and detects the request for finalization, moment that informs its interface which carries its own finalization. The interface in turn sends a end page to the client's application which was in its look forward, finally closing its activities.
4. The client's application, after closing the state of waiting and finding that page to be sent, displays the information to the web server and exit.
After the execution of this sequence, all processes, except of course the application server, is closing.
> Appendices C, D and References
< Maintenance in the application, your reflection in the interface and Conclusion
Migration of Applications for Web Environment - A Practical Approach