WebRatio Generated Web Applications Characteristics

From WebRatio WebML Wiki

Jump to: navigation, search


Contents

Introduction

Once the project has been modeled with WebML, it is possible to launch the generation process. This process automatically generates the web application starting from the model creating the jsp pages, the xml configuration, the java files files and copying the needed resources. By default these elements are collected in a specific directory in the webapps application server folder Usually the name of this folder is the same name of the Web Project and its location is <applicationServer>/webapps/projectName. However it's possible to change these settings modifing the WebRatio variables.

Deploy Folder Structure

Generated Web application is the union between the projects concern WebRatio application.


Folders and files are the main structure used to organize codes, informations, configurations and objects. For each Web application there is a set of default and a set of specific folders.

Default folders contain the necessary elements used by WebRatio. They must be in all the WebRatio generated applications. Default folders are:

  • WEB-INF
  • WRResources

Instead specific folders are all the directories which collect elements used specially for a precise Web application. These folders can be:

  • WebRatio default style folders (Resources, wr-css, wrdefault, wr-images)
  • style folders which differ from the default WebRatio style
  • custom folders created during the modelling phase by WebRatio user in order to store files
  • folders aimed to recive uploaded content
  • folders containing custom units


In order to describe content of a generated Web application we can use, as guidline, the Acme Web application sample.

To download Acme sample, in WebRatio:

  1. click on Help menu
  2. click on WebRatio Samples
  3. select Acme and click on Next button
  4. click on Finish button

Once download is ended Acme Web project will be loaded and opened. Click on Generate Full Web Project button.

Generated Folders

Open the webapps directory where generated Acme sample has been deployed, it's possible to see the following structure: Image:LivelTree2.png

This application presents the WEB-INF and WRResources standard folders, and other specific ones regarding WebRatio style's elements and uploaded users' content.

Together with listed folders, in this directory are collected also the generated java server pages (JSP) which regard:

  • index page: page that redirects users to the home page of the Web application (or to a specifed one).
  • modelled pages:
- jsp pages: during the generation process, for each model's page is created a corresponding jsp page
- ajax jsp pages: if the generated Web application presents ajax features, jsp pages which include ajax components, have an ajax relative version. These pages can be recognized by the suffix "_ajax". For example corresponding ajax page for page1.jsp is page1_ajax.jsp
  • login page: when a non logged-in user try to access a protected area of the Web application, if no custom login page is set, the implicit login page is shown. In Acme example implicit login page is the WrDefault_Default.login.jsp. For further information on the argument please refer to the article : The Login
  • errors page: page that is shown in case of runtime Web application error. In Acme example error page is the WrDefault_Default.error.jsp. This is a static page and it can be modified

WEB-INF

Image:levelWebInf.png "WEB-INF" folder is the main folder of the webapps deploy directory. It contains all the Web application configuration files and the "web.xml" file .

"web.xml" file provides configuration and deployment information for the Web components that include a Web application. Examples of Web components are servlet parameters, servlet and JavaServer Pages (JSP) definitions, and Uniform Resource Locators (URL) mappings.

As shown in the image above, WEB-INF folder contains five sub-directories:

  • classes: classes is a directory containing configurations and properties files for hibernate, log4j and the localization bundles.
  1. com/webratio/webapps: collects the java classes and hibernate files regarding entities of the data model.
  2. log4j.properties: is the configuration file for log4j [1].
  3. db1.hibernate.cfg.xml is the Hibernate configuration file for the used DBMS. It presents mapping for parameters about:
    • Database connection settings
    • JDBC connection pool (use the built-in)
    • LOB persisters
    • SQL dialect
    • Hibernate's automatic session context management
    • Hibernate's second-level cache
    • Echo all executed SQL to stdout
    Note: if a Web application uses more than one database there will be an equal number of Hibernate configuration files.
  4. ApplicationResources_localizedCode.properties: is file where is defined the translation, in a certain language, for labels and system messages which Struts is able to manage through bean messages. The translation language is indicated by the name's suffix (here called _localizedCode) that stands for the language ISO code. As an example for the american english language: file's name will be ApplicationResources_en_US.properties.
  5. Note: because it is possible for a Web application has more than one localization there will be an equal numbers of ApplicationResources files.
    Note: system messages includes also the error messages.


  • conf: conf is the folder containing the Struts configuration files and the Web application log files.
  1. struts-config.xml is the file where are set the application information, such as multiple data sources and general redirection links; where are defined the components used to represent most of the application state, the ActionForm beans, and where is defined and fully described the actions to be performed by the application.
  2. struts-config-properties.xml is a WebRatio configuration file for Struts. Its properties can be set in WebRatio through the project's properties tab.
    • Http Request Helper: the class that manages the HTTP Request. It is able to extract the request parameters and to control the CRC, if any.
    • Http port: the port of the deployment host where the HTTP server is installed.
    • Https port: the port of the deployment host where the HTTPS server is installed.
    • Default Application Encoding: the default encoding of the application
    • Default Server Encoding: the default encoding used by the application server for the application being developed.
    • Server Name: the server name where the application is published. The name is used to compute absolute URLs.
    • Use of Absolute URL (boolean): if checked, the URLs are generated as absolute URLs. (i.e.: http://ServerName:Port/ApplicationName)
    • Use of Default URL Encoding (boolean): if checked, the default encoding of the application is used.
    Image:StrutsconfigpropParam.png
  3. RTXLogConfig.properties and StrutsLogConfig.properties are the files specifying the log modes which will be applyed to the Web application at runtime level and at Struts level. For further information on the argument please refer to the article: Set the Log level


  • descr: descr is the folder containing the descriptors files and the quartz.jobs xml configuration file.
Image:LevelDescr.png
  • Descriptors files are the xmls mapping for WebRatio elements used inside the Web project. They are named with the id of the WebRatio object they representing.
  • Quartz.jobs is the xml file for the configuration of Quartz Framework. Quartz is a full-featured, open source job scheduling system that can be integrated with, or used along side virtually any J2EE or J2SE application. For further information on the argument please refer to the article: (Getting started with Jobs)


  • lib: lib is the folder where all libraries used by WebRatio application are stored.
The most relevant standard WebRatio libraries are:
wr-rtx.jar Jar containing the WebRatio runtime
wr-struts.jar Jar containing the Struts extension for WebRatio
wr-units.jar Jar containing all the custom units used in the Web applcation
WebRatio users may have the need to use non standard components which require external libraries. These libraries, as the standard ones, have to be deployed in this directory. However, the right moment in which the adding operation has to take place is the modelling phase. WebContent/WEB-INF/lib is the directory where users have to copy the needed libraries.


  • log: log folder contains all the log files created during WebRatio application navigation.
WebRatio proposes four log files by default:
  • RTX.log: runtime WebRatio logs
  • RTXError.log: runtime WebRatio errors logs
  • WRStruts.log: Struts logs
  • WRStrutsError.log: Struts errors logs
For further information on the argument please refer to the article about: Debugging with application's logs
Note: this folder is not available until the first code generation is applied.


  • validation: validation folder contains the GlobalValidators xml file and the validation xmls for each site view and relative localizations.



For further information on the argument please refer to the article: Validation Rules

WRResources

WRResources collects the logic needed by WebRatio standard components, ajax basic source scripts and objects like Calendar and FCKeditor.



ajax: Ajax folder contains all javascript scripts and graphical resources which are needed as base for ajax features implemented in the Web application.

Image:LevWRREsAjax.png
  • prototype [2]: is a JavaScript framework created by Sam Stephenson which provides an Ajax framework and other utilities. It is implemented as a single file of JavaScript code, usually named prototype.js. Prototype is distributed standalone, but also as part of larger projects, such as Ruby on Rails, script.aculo.us and Rico.
  • prototypextensions [3]: is a JavaScript library based on the frameworks Prototype.js and Script.aculo.us. The objective of this library is to provide an extension "low level" composed of useful methods and basic components, and components "high level", more dedicated to the user interface.
  • scriptaculous [4]: is a JavaScript library built on the Prototype JavaScript Framework, providing dynamic visual effects and user interface elements via the Document Object Model.
  • webratio: is a collection of JavaScript libraries needed in order to manage ajax requests.
  • window: is a collection of JavaScript libraries and graphical resources used to render ajax popup windows.

Calendar: Calendar folder contains skins and javascripts code's files for the WebRatio Calendar component.


Image:LevWRREsCalendar.png Calendar [5] is a free ajax feature that allow to render next to date, timestamp or time field, a 2D calendar object. This in order to select and automatically import the date chosen. Actually WebRatio supports version 1.0


CKEditor [6]: CKEditor folder contains all the resources needed in order to use the rich text editor and render it over a text-area field. As for Calendar component also CKEditor is a free resource. Version supported is 3.5.2.


upload

"Upload" folder is an optional folder. It depends from the possibility for WebRatio application users to manage BLOB files (images, videos, documents). In Acme's example, the administrator can upload new images for the product's catalogue. Those images are collected in the upload folder.

Upload folder can present one or more sub-folders.

Technologies

Generated WebRatio applications are based on java J2EE technology and are structured through the Struts architectural pattern. As interface between business layer and persistence data is used the Hibernate framework. Graphical layouts support: HTML, CSS, AJAX, Javascript, and even complex Web 2.0 interfaces. Generated Web applications can be immediately integrated into SOA environments thanks to native support of Web Services.

Ajax

Ajax, sometimes written as AJAX (shorthand for asynchronous JavaScript and XML), is a group of interrelated web development techniques used on the client-side to create interactive web applications or rich Internet applications. With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page.**

Example of WebRatio ajax functionalities are:

  • drag & drop
  • selective page refresh
  • cascade select management
  • periodic page refresh
  • dynamic form events management
  • tooltip
  • fields auto-completion

Hibernate

Hibernate is an object/relational persistence and query service. Hibernate lets develop persistent classes following object-oriented idiom - including association, inheritance, polymorphism, composition, and collections. Hibernate allows to express queries in its own portable SQL extension (HQL), as well as in native SQL, or with an object-oriented Criteria and Example API.*


MVC Apache Struts

Apache Struts is a free open-source framework for creating Java web applications. Web applications differ from conventional websites in that web applications can create a dynamic response. Many websites deliver only static pages. A web application can interact with databases and business logic engines to customize a response. Web applications based on JavaServer Pages sometimes commingle database code, page design code, and control flow code. In practice, unless these concerns are separated, larger applications become difficult to maintain. One way to separate concerns in a software application is to use a Model-View-Controller (MVC) architecture. The Model represents the business or database code, the View represents the page design code, and the Controller represents the navigational code.

The Struts framework provides three key components:

A "request" handler provided by the application developer that is mapped to a standard URI.

A "response" handler that transfers control to another resource which completes the response.

A tag library that helps developers create interactive form-based applications with server pages.

The framework's architecture and tags are compliant.*


SOA

In computing, service-oriented architecture (SOA) provides a set of principles of governing concepts used during phases of systems development and integration. Such an architecture will package functionality as interoperable services: software modules provided as a service can be integrated or used by several organizations, even if their respective client systems are substantially different. An implementation of SOA is called a Service Oriented Architecture implementation. It is an attempt to develop yet another means for software module integration. Rather than defining an API, SOA defines the interface in terms of protocols and functionality. An endpoint is the entry point to such an SOA implementation.

Service-orientation requires loose coupling of services with operating systems, and other technologies that underlie applications. SOA separates functions into distinct units, or services, which developers make accessible over a network in order that users can combine and reuse them in the production of applications. These services communicate with each other by passing data from one service to another, or by coordinating an activity between two or more services.**


SOAP

SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks. It relies on Extensible Markup Language (XML) as its message format, and usually relies on other application Layer protocols (most notably Remote Procedure Call (RPC) and HTTP) for message negotiation and transmission. SOAP can form the foundation layer of a web services protocol stack, providing a basic messaging framework upon which web services can be built. The SOAP architecture consists of several layers of specifications for message format, message exchange patterns (MEP), underlying transport protocol bindings, message processing models, and protocol extensibility.**


WSDL

WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint. Related concrete endpoints are combined into abstract endpoints (services). WSDL is extensible to allow description of endpoints and their messages regardless of what message formats or network protocols are used to communicate, however, the only bindings described in this document describe how to use WSDL in conjunction with SOAP 1.1, HTTP GET/POST, and MIME.***


* Definition by Hybernate.org [7] ** Definitions by Wikipedia [8] *** Definition by w3.org [9]


Related articles:
Category Difficulty Refers
Adding the Start Tomcat plugin Customizing the Environment Beginner WebRatio
CVS Common Problems Team Work Intermediate WebRatio
CVS Compare Overview Team Work Intermediate WebRatio
Can I download new plugins for Eclipse from WebRatio?How? Customizing the Environment Beginner WebRatio
How can I increase memory in WebRatio? Customizing the Environment Beginner WebRatio
… further results












Did you find this article useful? Please rate it!

Rating: 0.0/5 (0 votes cast)