saoj
Joined: 22/12/2007 07:20:02
Messages: 22
Offline
|
The Mentawai Debug Mode is an useful feature that lets you know and see what is happening when your action, together with all its filters, gets executed. As we saw in the previous chapter, a filter can alter the action input and output before and after the action gets executed. Wouldn't it be great to see all the filters that are being executed before the action as well as how the input and output look like after each step? That's exactly what the Mentawai Debug Mode will do for you. You can even choose to show the debug information at the bottom of your JSP page or inside your HTML code as a HTML comment. Here is how you set up and turn on the debug mode.
First you need to configure the DebugServletFilter as a servlet filter. This is a servlet filter (from the Servlet API) and not a Mentawai Filter, so we need to get inside the web.xml file. Luckily all you have to do is paste some XML code inside this file. Below is the web.xml file from the example in the previous chapter:
After you setup the DebugServletFilter inside the web.xml file, all you have to do is turn it on in your application manager:
This will make the debug text appears in the bottom of your HTML pages. Not something that you would want in a production site, for example. So you can also output the debug mode as a comment inside your HTML page:
Run your application again and now you will see the debug information of your actions. For the web site http://www.secretcrushonline.com I see the following:
- - - - - - - - - - - - - - - - Mentawai DEBUG - - - - - - - - - - - - - - - -
ActionName = CupidoAction
InnerAction = answerArrow
ActionClass = com.amorsecreto.action.CupidoAction
Browser Locale = en_US
Action Locale = pt_BR
Default Locale = pt_BR
Input:
empty
Output:
empty
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Filter = org.mentawai.filter.AuthenticationFilter@145eca6
Input:
empty
Output:
empty
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Filter = org.mentawai.filter.ValidatorFilter@1b3c169
Input:
empty
Output:
empty
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Filter = org.mentawai.filter.ConnectionFilter@108fbd4
Input:
empty
Output:
empty
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Filter = IoCFilter
Input:
empty
Output:
empty
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Filter = DIFilter: tryField=true
Input:
empty
Output:
empty
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Filter = org.mentawai.filter.InjectionFilter@dcc20c
Input:
conn = com.mchange.v2.c3p0.impl.NewProxyConnection@efa9fb
loc = pt_BR
userDAO = com.amorsecreto.dao.mysql.MySQLUserDAO@179fb8d
Output:
empty
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Action = answerArrow()
Input:
conn = com.mchange.v2.c3p0.impl.NewProxyConnection@efa9fb
loc = pt_BR
userDAO = com.amorsecreto.dao.mysql.MySQLUserDAO@179fb8d
Output:
empty
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Result = jsp
Consequence = Forward to /answerArrow.jsp
Total Time = 1ms
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mentawai Web Framework - Version:1.11 Build:20070911
|