![]() |
Administration area |
version 7.1 feedback: 2step@zentense.com |
![]() |
1. Accessing administration area |
|
Administration area is accessed through the subdirectory 2step of application's webspace.
For instance, for entering into tutorial's administration area we would open a browser and would go to
http://localhost:8080/tutorial/2step
Administration area has two modes of execution: development and production. Development server is an scenarion where changes occur continually, application is compiled lots of times, tests are done, errors happen, and speed is not important because this is an internal server only accessed by developers. On the other hand there is the production server, where application must be reliable, robust, very fast and efficient because it will be accessed by all users at the same time, and updates are rare. By default it is executed in development mode, and in general setup it can be changed to production. These are differences between the two modes:
|
![]() |
2. State |
|
This group of menu items shows you different aspects of the state of 2step, as the logs, and mainly,
statistics.
2.1. Status This is the first page you see in development mode (in production mode your first page is always login). It shows you some useful information about your application. You can see server current time, log level (normal, verbose or very verbose), at which time this application was started, number of request served, wrong requests (are the ones with wrong parameters that does not reference any application's action or template), dropped requests (the ones that are not answered due to server overload), sessions received, number of actions and templates (metrics) of this application, load averages (amount of time rendering pages and amount of time a request has been waiting for a database connection), database connection timeouts (if your application is generating timeouts then the system is heavily loaded or the executed application is doing something nasty with database connections), and a approximated calculated performance (it is not very accurated, and the first requests are always slower untill the Java virtual machine has 'warmed out' and performs at its full capacity). At the bottom of the page there are three small pie charts. The first one (left) shows you the number of active sessions (different users browsing your page) against the maximum number of active sessions, the one at the middle shows you how many request have been served concurrently (at the same time) versus the size of database connections pool (which is the maximum concurrency allowed for this application), and the last one (right), shows you the amount of heap memory used versus the total heap size (as Java 'garbages collect' heap memory automatically this is not very useful). You can change the Java maximum heap size specifying the -Xmx parameter when invoking Java virtual machine that runs Tomcat and 2step. If you don't see the three pie charts graphs at the bottom of this page, then it means that the jCharts library (it is distributed in the 2step package or you can get it directly from Sourceforge) is not properly installed. Copy jCharts.jar file to the $TOMCAT_HOME/shared/libs directory. 2.1.1. System properties This page shows the complete list of Java system properties. 2.1.2. Load averages This page shows you the load averages. Load averages are calculated through the database connection pool usage, so, if 2step is not connected to a database, no load averages will be shown. This method does not give exact values, specially under heavy loads, but you will get an idea of how much this web application is occuping your CPU. The performance shown in the status page is based on these load averages. Load averages are calculated this way: each time a request is received, a connection from the database pool is assigned to the request, and when the response is fully rendered, the connection is freed and is ready for being assigned to another request. The time elapsed between these two events (assign and free connection) is taken as the time needed to render the page. This is true if the CPU is only rendering this page and there are not other processes spending the CPU time. If there are a lot of requests being rendered concurrently, the load averages calculated this way will give distorted results, but at least, you will see that if the server is too heavily loaded (that is the main purpose of this screen). The graph shows the load averages for the last minute, 5 minutes and 15 minutes. Suppose that server receives a request that takes 1 second to be rendered. And one of this request is received each second for a minute. Then the graph will show the 1 minute load average raising up to 100%. Notice that the load averages can be higher than 100% (more than one request being executed concurrently). But, what happens if we receive 10 of these requests per second? (remember that each one takes an entire second in this example... in the real world, depending on the complexity of the page and the power of your server, a request can take from 1 hundredth of a second to several seconds). Suppose that we have a pool of 10 database connections (so that we can serve up to 10 requests simultaneously). The first ten requests will be assigned to the 10 database connections. But there will not be any available connection to the eleventh request. Then the eleventh requests will be blocked until any requests frees its connection. The requests blocked time is shown as a red area in the graph. When requests are blocked it means that your server is overloaded. And finally, when there are too much requests blocked (in this release, just 10 of them), the subsequent requests are dropped away (a 503 response code is sent to the browser that originated the requests, informing that the server is temporarily overloaded). 2.2. Activity This pages shows you an axis chart showing pages, sessions and unique IPs that have visited our application on a daily basis. The first time you look at it you will see an empty graph, and this page is not really useful during development of your application. But when the application is put in production, then this page gives you a lot of information. Below the image there is the table of values shown in the graph. You can click on the days and you will see two detailed (probably empty if you are just trying it) bar charts of that day showing the length of received sessions in time (right) and number of pages visited (left). The arrows in the top of the page let you see the same graphs for the previous and the next day respectively. These arrows are in all the statistics pages and let you move through time. Now, return to the first page with the axis chart. In the top, between the aforementioned arrows, there is the time basis selector (hourly, daily, weekly or monthly) for the graphs. Hourly, Daily and Weekly are exactly identical, but you have more monthly information (see next point). All the information needed for generating these graphs is gathered from log files. 2.3. Statistics You should have been seeing the same bar charts as when you clicked on a day, but now you have a graph selector (sessions, agents, languages, domains and pages). Sessions are two bar charts telling you about the length of the sessions. The rest of the graphs are pie charts. Agents let you see which browsers (Explorer, Mozilla, Opera, etc) are visiting this applications and which operating systems (Linux, Windows, MacOS...) are running, languages tells you which lenguages are selected by the browsers (this only have sense if you are running a multi-language application), countries (if GeoIP is enabled) of the host addresses that are visiting us, and finally pages wich shows which templates and actions are the most visited. You can also reach this pages if you go to the previos menu item, select monthly graph, and click on a month. As in the previous point, all the information is gathered from log files. |
![]() |
3. Tools |
![]() |
4. Setup |
|
Finally, in the last menu group, there are some useful actions as reloading, clearing logs or compiling
application.
4.1. General Here you can set up some general application parameters. Let's see in detail each one of the parameters, that are subdivided in the next blocks: 4.1.1. General
4.1.2. Access control
4.1.3. Java compiler
4.1.4. Database
4.1.5. Internationalization
4.2. Access control This screen is quite complex. It is divided in four parts, so we will present here each part separately. But first, some words about 2step's access control. By default, all actions and templates are public and can be accessed without authentication. But if you put the modifier auth in the declaration of the action or template, 2step will render login page if session is not authenticated yet. Here you can define users and passwords, groups of users, modules. For each name or module, you can define several allow or deny rules, granting or denying access to the resource identified by that name. The access control configuration is saved in the file access.properties, located in the application directory (this file is automatically created if it does not exist). 4.2.1. Users At the top of the screen, there is the list of users. Users and their passwords can be stored in the access.properties file as well as in a database table. First kind of users are shown grey, while the ones at database, in black. Here you see all the users stored in the properties file, and the users from the database that appears in any group or rule. This is this way because database users table may have thousands of users. Clicking on a user you can change its password, and clicking on the minus sign at the left of the name, the user is deleted. New users can be created and you can select where to store it (properties or database). 4.2.2. Groups Next, is the list of groups. A group is a list of users, and a group cannot contain other groups. You can create, edit and delete groups at your own will. 4.2.3. Modules Below the groups, you find the modules section. A module is a list of unit names. Each name identifies a unit, that is, a template or an action (you cannot differentiate in access control a action called foo from a template called foo as both are referred by the same name foo. You can assign rules to this modules and they are applied to all the names of that module. When you create a module, you see the list of all available units that are not assigned to another module. Check the ones that you want in this module and name them. You can edit and delete modules as expected. 4.2.4. Allow / Deny rules Finally there are the rules. There are two types of rules, ones that allow the access to the resource, and ones that deny it. A rule has two sides: the resource (a unit, a module name or a method) where the rule is applied (shown at the left), and the entity (the user or the group) for who this rule applies. There are some wildcard rules. Rules for the resource all are wildcard rules that allow or deny access to all the resources. And rules for the entity all are wildcard rules that allow or deny access to all users. So, the rule allow(all, admin) grants access to all the resources to user admin, while the rule allow(common, all) grants access to resource common to all users. The rule allow(all, all) grants all resources to all users, and deny(all, baduser) denies any access to user baduser. 4.2.4.1. Method invocation rules 2step allow to invoke methods on session objects remotely. This leads to security risks that must be taken into account. Invoke remotely a method is denied by default, but you can add rules for allowing some methods to be executed remotely (an URL like /webapp?bean=var&method=setFilterState&par1=name would try to execute method setFilterState with one parameter on variable var). A method invocation rule is as the other ones, but the resource is formed by the name of the session variable and the name of a method separated by a dot. Wilcards are also allowed, so that allowing a entity to execute all.all is the same as allowing it to execute everything, allowing a entity to execute var.all is the same as allowing it to execute any method on variable called var, or allowing a entity to execute all.setFilterState is the same as allowing it to execute the method setFilterState on any variable. 4.2.5. Rule precedence Checking if an entity has access to a resource is a matter of applying the rules in a determinated order. In the box below you can see in which order rules are applied. The first line means: Is there any allow rule for the resource name and current user? If the answer is true, then we know that the user is allowed to access that resource. Otherwise, we check second rule: Is there any deny rule for resource and name? If the answer is true, access is denied, or otherwise we go to the third rule. If we arrive to the 12th rule, then access is implicitly denied.
4.3. Constants In this screen you can manage application constants. A constant is a key that has a value. You can access constants from your application using the keyword constant |
![]() |
5. Log out |
| Ends this administration session. This options is only visible in production mode, because in development there is no authentication, and has no much sense to log out. |