From: <kea...@na...> - 2003-03-04 21:14:41
|
Error handling is now configurable by setting the EvaluationExceptionHandler implementation in the WebMacro.properties. The default is: ExceptionHandler: org.webmacro.engine.DefaultEvaluationExceptionHandler other options are the CrankyEvaluationExceptionHandler and the DebugEvaluationExceptionHandler. Or you can easily create your own. See http://www.webmacro.org/EvaluationExceptionHandler for more info. The DefaultEEH is actually pretty lenient, and should behave pretty much like the old WM. One area where things are more strict is with parsing exceptions. This may be what you are seeing. I think you pretty much have to fix these. Most other errors can be suppressed by the EEH. There is an Ant task that included in the distro to help find compile time errors in your templates. It's called org.webmacro.tools.WMTemplateAntTask. See: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/webmacro/webmacro/src/org/web macro/tools/WMTemplateAntTask.java?rev=1.4&content-type=text/vnd.viewcvs-mar kup Good luck. Keats -----Original Message----- From: Dario Liberman [mailto:lib...@in...] Sent: Tuesday, March 04, 2003 3:53 PM To: kea...@na...; web...@li... Subject: Re: [Webmacro-devel] special characters - now slash directory separator problem Keats , thank you a lot for your help. the special characters work fine now. as of point 2), "session is invalid"... I managed to overcome it by asking the WebContext the HttpServletRequest, and then asking it the session instead of taking it directly. It seems to be working now. I guess that the WebContext beheaves differently, or something, perhaps it does not create a new one if there isnt one. The only problem I am facing now, is the error handling. Before, there was a silent <!-- error description --> pattern. Now I get the whole page thown away and instead I get an error page. even with simple errors. I know I should correct them, but I would like them to behave quietly, and also get them appended in a log file. Is it posible? ----- Original Message ----- From: kea...@na... To: lib...@in... ; web...@li... Cc: ar...@ci... Sent: Tuesday, March 04, 2003 13:59 Subject: RE: [Webmacro-devel] special characters Dario, Finally getting around to upgrading, huh? I can barely remember back that far but I think I may be able to help you out. 1) WM now uses UTF-8 as its default input file encoding. This was a controversial decision, since most Westerners use ISO8859_1 (aka Latin-1). Most likely your files are stored using Latin-1, so you should set the TemplateEncoding in your WebMacro.properties: TemplateEncoding: ISO8859_1 Alternatively you could set this as a parameter in your templates: #param $TemplateEncoding="ISO8859_1" 2) I'm not sure about this one, but I'm guessing that your $Session tool is not getting loaded properly. Crank your logging up do DEBUG and check your log to see if this is the case. Usually these kinds of problems are due to old WebMacro.properties files. Most of the settings have been moved into the jar file now (in WebMacro.defaults) so you should need few if any settings in the properties file. Hope this helps. Keats > Hello, > > I am moving from a previous webmacro version. One that had the sintax > "implements Handler" instead of the new "extends WMServlet". > I moved to jsdk1.3 and changed the class name from > "org.webmacro.servlet.Reactor" to my servlet name in the > servlets definition > of my Jrun 3.1 > > And I am having 2 problems now that do not let me make the full move: > > 1) acentuated characters seem to make the parser crash: > -- secondary stack trace -- > sun.io.MalformedInputException > at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:152) > at > java.io.InputStreamReader.convertInto(InputStreamReader.java:137) > at java.io.InputStreamReader.fill(InputStreamReader.java:186) > at java.io.InputStreamReader.read(InputStreamReader.java:249) > at java.io.BufferedReader.fill(BufferedReader.java:139) > at java.io.BufferedReader.read1(BufferedReader.java:187) > at java.io.BufferedReader.read(BufferedReader.java:261) > at > org.webmacro.parser.BackupCharStream.FillBuff(BackupCharStream > .java:95) > > Here is somebody with a similar problem, but I havent found > there any answer > to the problem. > http://spitfire.velocet.net/pipermail/webmacro/2001-April/005210.html > > 2) I get a "session is invalid" exception whenever I want to use the > httpsession, a code that run for years with no problem with > the previous > webmacro. > Does anybody have a clue to what this may be? > > The stack trace: > > :Exception!!! > java.lang.IllegalStateException: Session is invalid > at > allaire.jrun.session.JRunSession.checkSessionValidity(../sessi > on/JRunSession > .java:318) > at > allaire.jrun.session.JRunSession.removeValue(../session/JRunSe > ssion.java:251 > ) > at > com.ineba_servletframework.CServletApp.handle(CServletApp.java:543) > at > org.webmacro.servlet.WMServlet.doRequest(WMServlet.java:255) > > > The code is: > > // Get the user session if it exists. If it doesn't, this > creates a new one. > HttpSession session = c.getSession(); > > // if the "userinfo" key exits, that means the > user should be > logged > CUserDataInSession userdata = > (CUserDataInSession)retValues.get("userinfo"); > if(userdata != null) { > > session.putValue(getSessionPrefix()+CUserDataInSession.ID_STRI > NG, userdata); > }else { > // Ensure the user is not logged > // NOTE: We do NOT detroy the session. > Instead, we remove > the CUserDataInSession object > // from the session. > > session.removeValue(getSessionPrefix()+CUserDataInSession.ID_STRING); > } > if(session.isNew()) { > int maxInactiveInterval = > CUtils.parseInt(getProperty("user.sessionMaxInactiveInterval") > ,600000); > session.setMaxInactiveInterval(maxInactiveInterval); > } > > > > Please Help!!! > > Best regards, > Dario Liberman. > |