Re: [Mav-user] Character encoding patch?
Hi Peter, I had the same problem last summer and made two modifications to Maverick. My app must be able to adjust to any charset based on locale. I'm pasting in the changes I made below. If someone can commit them to the maverick source that would be even better!! Anyway, let me know how you find these changes. Good luck, Dan In AbstractTransformStep.java, change to public HttpServletResponse getResponse() throws IOException, ServletException { log.debug(Getting fake response); // Should be ok to wrap the real mccoy here. if (this.fakeResponse == null) { this.fakeResponse = new FakeHttpServletResponse(this.getTransformCtx().getRealResponse()); // added by DF 7/26/05 // allows propogating character encoding on to response fakeResponse.setContentType(text/html; charset= + getTransformCtx().getRequest().getCharacterEncoding()); } return this.fakeResponse; } In Dispatcher.java, change to public void init() throws ServletException { // Make us available in the application attribute collection this.getServletContext().setAttribute(MAVERICK_APPLICATION_KEY, this); // Get defaultRequestCharset from init parameter, null is ok // CLOWN added by DF 7/26/05 -- allows pulling default char set from app defaultRequestCharset = (String)this.getServletContext().getAttribute(INITPARAM_DEFAULT_REQUEST_CHARSET); if(defaultRequestCharset == null) { this.defaultRequestCharset = this.getInitParameter(INITPARAM_DEFAULT_REQUEST_CHARSET); } // Get limitTransformsParam from init parameter, null is ok this.limitTransformsParam = this.getInitParameter(INITPARAM_LIMIT_TRANSFORMS_PARAM); // Get reuseMaverickContext from init parameter, null is ok this.reuseMaverickContext = true.equals(this.getInitParameter(INITPARAM_REUSE_CONTEXT)); At 09:05 AM 1/5/2006, Peter Chase wrote: Is anything wrong with the following patch, to make Maverick transforms automatically pick up the character encoding? public FakeHttpServletResponse(HttpServletResponse wrapMe) { super(wrapMe); if (log.isDebugEnabled()) log.debug(Creating fake response, original buffer size is + wrapMe.getBufferSize()); this.charset = wrapMe.getCharacterEncoding(); // THIS IS THE NEW LINE } --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click [INVALID FOOTER] --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click [INVALID FOOTER]
[Mav-user] Incorrect char encoding with $wrapper
Hi -- I am just trying to add some internalization support to my Maverick application, which has been running flawlessly for years (!), and I ran into a problem. What seems to happen is that the page that is to be inserted into $wrapper goes through some undesired transformation. I have configured Maverick to use UTF-8 via the defaultRequestCharset parameter. I also configured Velocity to use UTF-8 for reading templates with input.encoding=UTF-8 and for writing output with output.encoding=UTF-8. All this works perfectly in the page1.m case below and I see the desired output (the french characters) in my browsers. But in the page2.m case, The $wrapped text hasn't been converted correctly. Interestingly, any text in the surrounding frame (i.e., frame.vm) is displayed correctly. I came across some other posts in the past that eluded to a similar problem but I'm stumped at this point. Any ideas? Thanks, Dan from maverick.xml --- command name=page1 controller class=General /controller view name=success path=content.vm /view /command command name=page2 controller class=General /controller view name=success path=content.vm transform path=frame.vm/ /view /command content.vm (stored as UTF-8) -- Content: from french: frame.vm (stored as UTF-8) --- html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 /head body h1 Header: from french: /h1 $wrapped /body /html output from page1.m - Content: from french: (NOTE This was displayed correctly) output from page2.m - Header: from french: (NOTE This was displayed correctly) Content: from french: Ã Ã Ã Ã (NOTE This was displayed INCORRECTLY)
Re: [Mav-user] Help - falling into 'jar hell' with Mav and JDOM
Hi -- I think upgrading the jdom library is a good idea -- keeping up-to-date with libraries is a worthy goal. Velocity 1.4 has a dependency on the older jdom as well. This means that us Mav/Velocity users must simultaneously upgrade Velocity to an as of yet unreleased Velocity 1.5. -- Dan At 01:22 AM 11/27/2004, Mike Moulton wrote: Responses inline... I've had a look at changing Maverick to use jdom 1.0, but as I've never used jdom myself, I am unsure what the changes should be and their implications. I've identified the three place in the Maverick code that need altered. #1 should be fine but I need help on #2 and #3. See below for what I've done so far, with some in-line comments. I gleaned most information from changes.txt in the jdom 1.0 distribution. #1 and #3 look good. See notes by #2. #2 org.infohazard.maverick.util.XML.java public static Map getParams(Element node) { ... if (value == null) { /* OLD CODE: Checks for presence of children if no value present * getChildren() now removed from v1.0 if (paramNode.hasChildren()) value = paramNode.getChildren(); else value = paramNode.getTextTrim(); */ /* NEW CODE: Since this method expects what the name/value pair * param nodes should look like (from this methods javadoc), is there * actually any need to check for child elements? */ value = paramNode.getTextTrim(); } Though the javadocs say the that a param should only look like param name= value=/, there has been support for child elements inside a param/ for a while. Not sure about others, but I know I have used this 'feature' many times in the past. With that being the case I would do something like this for #2. List paramChildren = paramNode.getChildren(); if (!paramChildren.isEmpty()) value = paramChildren; else value = paramNode.getTextTrim(); What are the thoughts of updating the jdom dependency of maverick? If there are no objections I will do the updates and do a 2.2.4 release. -- Mike : mike moulton : meltmedia : 1429 north 1st street : phoenix az 85004 : : [EMAIL PROTECTED] : mmoulton66| aim : 602.340.9440 | ofc : 602.432.2568 | cel : 602.340.1003 | fax : : meltmedia.com --- SF email is sponsored by - The IT Product Guide Read honest candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ [INVALID FOOTER] --- SF email is sponsored by - The IT Product Guide Read honest candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ [INVALID FOOTER]
RE: [Mav-user] How to suppress Velocity Transforms?
Thanks Jeff, Doug and Johan, That fix worked like a champ!! It's funny how this issue was really centered around Velocity, not Maverick... Thanks again -- really appreciate the quick and accurate replies, Dan At 11:44 AM 8/25/2003 -0700, Schnitzer, Jeff wrote: It should be possible to call $response.setContentType() anywhere near the top of the template. Without Maverick transforms (which can change the output flow considerably), this works the same way that JSP works: . The servlet container provides a buffer of some size into which output is written. . When the buffer becomes full, it is committed and flushed to the output stream; all output after that is sent directly to the output stream. . Until the buffer is committed, any changes can be made to the http response headers, but afterwards it's illegal - the headers have already been written. The standard JSP (and Velocity) pattern is to set the content-type in the template itself. For XSLT this is not really an option, so an output-type attribute on the maverick config node is used. Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Johan Lundberg [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 11:27 AM To: [EMAIL PROTECTED] Subject: Re: [Mav-user] How to suppress Velocity Transforms? Hi Dan Jeff told me about the following trick some time ago. I needed to get the SVG plugin to understand that SVG content was coming instead of html. Below is the first line of my velocity template: $response.setContentType(image/svg+xml)?xml version=1.0? the rest of my SVG document... /johan - Original Message - From: Dan Finkelstein [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, August 24, 2003 10:49 PM Subject: [Mav-user] How to suppress Velocity Transforms? Hi -- I know this is a really dumb question, esp considering that I've been using and relying on Maverick for over 1 1/2 years, but here goes anyway... Maverick transforms my Velocity templates (the .vm files) and these are displayed without any problem. What I want to do is, in one particular place, is to apply the Velocity transform, and then return it as a text/plain file instead of html. In, maverick.xml, the section looks like: command name=RemoteAccess controller class=blah.controllers.admin.RemoteAccess/ view name=success content-type=text/plain path=admin/remoteAccessResponse.vm/ /command When I run RemoteAccess.m, it is identified to the browser as html Any ideas? Thanks a lot, Dan --- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 [INVALID FOOTER] --- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 [INVALID FOOTER] --- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 [INVALID FOOTER] --- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 [INVALID FOOTER]
[Mav-user] How to suppress Velocity Transforms?
Hi -- I know this is a really dumb question, esp considering that I've been using and relying on Maverick for over 1 1/2 years, but here goes anyway... Maverick transforms my Velocity templates (the .vm files) and these are displayed without any problem. What I want to do is, in one particular place, is to apply the Velocity transform, and then return it as a text/plain file instead of html. In, maverick.xml, the section looks like: command name=RemoteAccess controller class=blah.controllers.admin.RemoteAccess/ view name=success content-type=text/plain path=admin/remoteAccessResponse.vm/ /command When I run RemoteAccess.m, it is identified to the browser as html Any ideas? Thanks a lot, Dan --- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 [INVALID FOOTER]
RE: [Mav-user] Updates to maverick
Jeff, The new feature of specifying an external-to-war mav.xml file works great. My dream of separation of engine (war) and content is one step closer to reality!! The strength of a war is that everything can be bundled together, but in an application where you want to have one engine with multiple personalities or skins, it doesn't quite work. Thanks so much, Dan At 02:52 PM 2/19/2003 -0800, you wrote: The separated param collections and the absolute config path features are checked in. Take a look. I'll get to the remaining issues soon. Jeff From: Schnitzer, Jeff [EMAIL PROTECTED] Separating the three different param collections (controller, view, transform). Allowing file:, http:, ftp: in the maverick config file (and config transform) path. Need to check to see if I can detect absolute vs relative URLs just by creating a URL and checking for MalformedURLException. Oterhwise just explicit checks for those strings will work. Review John-Mason's controller chaining code and figuring out how this can be morphed into a pluggable Controller framework. Adding a link to Roman's Tiers sample. Sorry about the lag. Both work and life switched into high-gear at the same time. Jeff Schnitzer [EMAIL PROTECTED] --- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge [INVALID FOOTER] --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf [INVALID FOOTER]
RE: [Mav-user] Specifying external maverick.xml
Thanks for the update, but I couldn't get the new code to work, maybe that's what you meant by not supporting the file stuff yet ! grin I was trying to set enter something like: getServletContext().setAttribute(Dispatcher.KEY_CONFIG_FILE, file:///whatever/maverick.xml); I think that if you add a check for the string starting with file://, and then call new URL(filepath) instead of getResource(), it would be fine. Make sense? Best, Dan (Hope you had fun skiing ... I'm going up next week!) At 03:42 PM 2/6/03 -0800, you wrote: Actually I was thinking of the application attribute context. A servlet initialized prior to the dispatcher could do something like this: this.getServletContext().setAttribute(Maverick.CONFIG_FILE_APPLICATION_KEY, /WEB-INF/somethingelse.xml); Of course the value could be obtained from anywhere (jndi, database, http request, etc). Sound good? I'm confused about your confusion over the file:// issue :-) Right now all config file paths are loaded from inside the WAR using getResource(). You want to be able to load config files which are located somewhere else in the filesystem, right? Maverick needs some way of determining whether to use getResource() or to create a URL and load that directly. Some way of determining if the path is a fully-specified URL seems like the natural way. I'm leaving tonight for a ski trip so I'm not sure I'll be able to do anything about it until Monday, but I'll get this into CVS soon. Jeff -Original Message- From: Dan Finkelstein [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 4:23 PM To: [EMAIL PROTECTED] Subject: RE: [Mav-user] Specifying external maverick.xml Hi Jeff, Correct -- those are the two goals of this exercise! To be clear, when you speak of app-context, you mean using JNDI to pull the property from the servlet.xml file, something like this: Context context = new InitialContext(); Context envContext = (Context) context.lookup(java:comp/env); maverickFile = (String)envContext.lookup(maverickFile); I suppose that would work. As far as the ':', Windows uses that in a drive specifier, so that might be avoided. If I understand right, you're trying to let the user specify one of: file:///home/whatever/mav.xml or /WEB-INF/mav.xml and have it work either way? I think the user needn't enter the file:// part -- in fact, it is kind of confusing and would commonly be left off by mistake anyway. I think you could just assume the property is a file -- why would anyone enter a resource path from _outside_ the war file? It doesn't make sense, that's what the init parameter is for!! Regardless, what you're suggesting is reasonable and will certainly address the two concerns. Can you commit it in cvs? Thanks a lot, Dan At 03:17 PM 2/5/2003 -0800, you wrote: There are two goals, right? 1) To let your webapp determine at runtime what config file to use. 2) To be able to use a configuration file outside of the WAR. The use of a static is a little weirdhow about checking an app context variable instead? Here is what I propose: If app-context parameter exists, use that If init parameter exists, use that Otherwise use maverick.xml In addition, the logic: If value contains a :in the first 8 characters, treat it as an absolute URL. Otherwise treat it as something to look up using getResource(). That seems to cover the two requirements. Is there a better way to identify absolute URLs than checking for a :? Jeff -Original Message- From: Dan Finkelstein [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:51 PM To: [EMAIL PROTECTED] Subject: Re: [Mav-user] Specifying external maverick.xml Jeff, Can you chime in on what you think of this change? Does it seem reasonable (enuf!) to add to the source or is there a better way of incorporating this feature? Thanks, Dan At 07:52 AM 1/26/03 -0800, you wrote: Howdy, Yourazlin, I think you and I are thinking the same way in terms of wanting access to changing maverick.xml from outside the war/ear file. An init parameter, that is specified is web.xml, doesn't apply to our situations since web.xml is inside the war file. My suggestion is that Maverick allow an application to override the file name in any way it chooses. For example, in my application, this would allow me to put the file name in my application-specific properties file. What follows is my suggestion on how to enhance Maverick to handle this: To Dispatcher.java, add: private static String _overriddenMaverickXmlFile = null; public static void setMaverickXmlFile(String name) { _overriddenMaverickXmlFile = name; } Also, to Dispatcher.java, modify loadConfigDocument() so that first part looks like this: /** * @return a loaded JDOM document containing
Re: [Mav-user] Work Flow
I thought I'd throw in my 2 cents worth on this workflow issue in relation to Maverick. I have developed a fairly large application under Maverick and have found the maverick.xml file to have grow somewhat unwieldy. I think that with some sort of abstractions added to the maverick.xml features, it could be pared down quite a bit -- some of this might fall under what you're calling workflow. Here's what I mean: 1. All my commands include the following two views: view name=noSession ref=noSession/ view name=systemError ref=systemError/ These two lines are repeated many times through my mav.xml file. It would be nice if when a command were run, that if the view wasn't specified, it would look in some default place. Since putting code in one and only one place is a desirable, then this would help with the understandability and maintenance of the codebase. 2. If I happen to be missing a view, I don't know about it until the program is run and happens across this issue. It would be nice if the controller had an ability to accept a list of views that it needs. We can create this list for each of our controllers -- that's no big deal. Then Maverick could on startup, check that no views are missing from the mav.xml file. Maybe a method like String [] getRequiredViews(). 3. Some sort of namespace convention might also be nice. For example, I have two main areas in my mav.xml file, one area for the main site and another for admin. The admin stuff is intermingled with the main site stuff and it is only through naming conventions that I keep them separate, but it has been the source of a few bugs. I have thought of separating these two areas into two different war files, which would solve the problem, but perhaps there is a structure within mav.xml that can encourage separation also. 4. Regarding workflow in particular, I also have come across cases where I would have liked to remember state as I go through a sequence so I can return to it. For example, it a visitor or guest tries to access a page that requires logging in, I would like to take them to the login workflow, and at the end of that workflow return them to the page they wanted to access in the first place. This would be such a cool and powerful feature. I haven't figured out a way to do this within the current system. Please take these comments within the context they are given: I am a very happy and satisfied Maverick user, and would make the same decision to go with mav today even knowing these limitations! Dan At 07:19 PM 7/18/02 -0400, you wrote: Hello Scott.. I'm going to try to throw a skeleton together so that it can be added to the CVS, so people can help out as they wish. Hopefully early next week (?) there'll be enough for people to follow what's going on and see where they can help. -Roy - Original Message - From: Scott Bechtel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 18, 2002 4:20 PM Subject: [Mav-user] Work Flow Hey guys, I'm very interested in the work flow system since I am ready to create a web site that requires one. If you need any assistance in coding or testing be in touch. Scott Bechtel [EMAIL PROTECTED] www.newconquest.com --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user Archives are available at http://www.mail-archive.com/ --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user Archives are available at http://www.mail-archive.com/ --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user Archives are available at http://www.mail-archive.com/
Re: [Mav-user] Work Flow
Good points. On 2, I've noticed that I end up with lots of controllers, and there are a whole slew of named views which might be called. When I'm writing a controller, it's pretty clear to me which views are actually used, so I could easily enumerate them. On the other hand, trying to go through one controller manually after the fact (let alone 50) and weed out which views are used is error-prone. You know, some views could come from inherited classes or whereever. Without this feature, my tendency is to add in views left, right and center in the hopes of not missing one. I'm just suggesting that each controller has n different exit paths, and ensuring a one-to-one mapping is error-prone. I'll look forward to your workflow system, Dan At 01:41 PM 7/22/02 -0400, you wrote: From: Dan Finkelstein [EMAIL PROTECTED] I thought I'd throw in my 2 cents worth on this workflow issue in relation to Maverick. I have developed a fairly large application under Maverick and have found the maverick.xml file to have grow somewhat unwieldy. I think that with some sort of abstractions added to the maverick.xml features, it could be pared down quite a bit -- some of this might fall under what you're calling workflow. Here's what I mean: 1. All my commands include the following two views: view name=noSession ref=noSession/ view name=systemError ref=systemError/ These two lines are repeated many times through my mav.xml file. It would be nice if when a command were run, that if the view wasn't specified, it would look in some default place. Since putting code in one and only one place is a desirable, then this would help with the understandability and maintenance of the codebase. I agree with you on this, but I don't think it's in the scope of what I'm working on. When I first started using Mav, I figured that since I'm specifying global views with the views tag, then they shouldn't need to be referenced in each command. I believe that something like this would require a patch to the current source, and not an addon, but it would be nice to have. 2. If I happen to be missing a view, I don't know about it until the program is run and happens across this issue. It would be nice if the controller had an ability to accept a list of views that it needs. We can create this list for each of our controllers -- that's no big deal. Then Maverick could on startup, check that no views are missing from the mav.xml file. Maybe a method like String [] getRequiredViews(). I don't follow you on this one. If you're going through the trouble of making a list of views per controller, can't you just check your xml file to make sure that each controller has it's appropriate views? Seems like double work, if I'm understanding you correctly. 3. Some sort of namespace convention might also be nice. For example, I have two main areas in my mav.xml file, one area for the main site and another for admin. The admin stuff is intermingled with the main site stuff and it is only through naming conventions that I keep them separate, but it has been the source of a few bugs. I have thought of separating these two areas into two different war files, which would solve the problem, but perhaps there is a structure within mav.xml that can encourage separation also. So each command would have a name and an optional namespace? I can understand your need for that, but again, that's out of the scope of the project I'm working on. After working on huge projects using Struts, I've gotten very good at creating naming conventions for my commands and views, and grouping them in the XML file. Given Mav's philosophy, adding a namespace might add unnecessary complications. 4. Regarding workflow in particular, I also have come across cases where I would have liked to remember state as I go through a sequence so I can return to it. For example, it a visitor or guest tries to access a page that requires logging in, I would like to take them to the login workflow, and at the end of that workflow return them to the page they wanted to access in the first place. This would be such a cool and powerful feature. I haven't figured out a way to do this within the current system. This is the kind of functionality you'll be able to get (and more!!) with the project I'm working on. A command generates a call to a workflow (in this case, the workflow handles logging in a user) and after that workflow does it's thing, it returns to where it's told. I'm trying to make it as flexible and extendable as possible, so people who have special needs from a workflow can create their own and plug it in. Please take these comments within the context they are given: I am a very happy and satisfied Maverick user, and would make the same decision to go with mav today even knowing these limitations! Dan At 07:19 PM 7/18/02 -0400, you wrote
RE: [Mav-user] 2.0rc works fine and a preDiscard question
Right, I think that's the right approach. You know, the creation of the connection to the database can be handled through the current architecture using the controller's constructor. But to keep things symmetric, maybe ModelLifetime could expose two methods: something like setup() and teardown(). This notification on initialization and finalization would make clear the tasks. Thanks for your attention to this, Best, Dan PS. Have fun at Maxis. I worked for a few years at Berkeley Systems, which was a blast. :-) At 09:41 AM 3/17/02 -0800, Jeff Schnitzer wrote: Ah, I see. Something like this interface that a model can optionally implement: public interface ModelLifetime { public void discard(); } I have no objection to adding it, although be aware that this is probably an anti-pattern... usually you want to have all your data access completed by the time perform() returns. Since the RC seems to be solid, we want to build the final release of Maverick 2.0 RSN, probably tomorrow. I'll probably slip this change in anyways since it doesn't require any refactoring. Sound good? BTW, if I'm slow to respond to mail, it's because I just started a short contract at Maxis doing WebLogic development and they're keeping me occupied. That, and I'm still couch-surfing, so I'm either busy or don't have a stable net connection available :-) Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Dan Finkelstein [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 16, 2002 8:26 PM To: [EMAIL PROTECTED] Subject: RE: [Mav-user] 2.0rc works fine and a preDiscard question Hi Jeff, Let me try to explain. In my controller (which is _not_ ControllerSingleton), I have a perform() method which opens a database connection. This controller might be used by a number of templates and have methods which might be used by some and not others, methods like getPerformers(), getServices(), etc. Each of these methods uses the open database connection. I'm using JDO and like other systems, it wants me to close my database connection. So, as I understand it, the flow is something like this: 1. Mav calls perform()...and within it, I open the database connection 2. Mav processes my velocity templates, which call methods in my controller, using $model.performers 3. Mav deletes the controller object What I would like is notification between steps 2 and 3 of the pending deletion so I can close the database connection. Does this make more sense? Thanks, Dan At 07:13 AM 3/13/02 -0800, Jeff Schnitzer wrote: I'm not quite sure what you mean. Why not just at the end of your perform() method? Or are you using a ControllerSingleton, and you want to be notified when a new configuration is loaded and the old is being discarded? Jeff Schnitzer [EMAIL PROTECTED] -Original Message- From: Dan Finkelstein [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 9:35 PM To: [EMAIL PROTECTED] Subject: [Mav-user] 2.0rc works fine and a preDiscard question Just a little feedback... I'm now on 2.0rc and am not having any problems Great work!! One question though: In my controller objects, I would like to be notified when an instance is about to be deleted. I'd like to use this opportunity to clean-up, in this case closing a database connection. Can you suggest a way to do this? I would like something more reliable than Java's finalize() method. Or can an overidable method be easily added at this point in the release cycle? Thanks, Dan ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user
[Mav-user] Standard Query Page = Results Page
Hi -- I have a number of admin-type screens that I'm putting together which first display a page with a form to specify what to display. Then the results are displayed on the next page. My question is: what's the recommended way to do this with Maverick? I've been scratching my head on this, and came up with some seemingly awkward ways, but it seems like there might be simpler way. Any ideas? Thanks, Dan ___ Mav-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mav-user
RE: [Mav-user] 2.0 Installation Issues
Hi Jeff, Thanks for your help. 1. I know understand where you're coming from. With log4j, what I've always done is called something like PropertyConfigurator.configure(propFile); when the app starts up. There's a way that Velocity does it where in their src/classes tree they include a default properties file. That file is always read in and is used to initialize their log4j system. Also, there is a hook so you can override particular settings with an external file. They use the apache ExtendedProperty class which is pretty nice. For my needs, what I did is create an Initialize servlet which is loaded on startup before anything else. There I call the log4j initializer and anything else I want -- like reading in a property file. 2. Off my memory, it seemed that when I want friendship-velocity it gave in error when xalan couldn't be found. I suppose that's because friendship does some xsl transformations. Now, are you saying that if I don't do any xsl in my app, xalan doesn't need to be included? That would be very nice 3. I don't think having maverick.xml's location be overridden from an init variable will work. That's because the init setting is in web.xml which is included in the war file. What I'd like is a way to override it from outside. This might relate back to 1, but if maverick had a properties file, say maverick.properties, it could easily include stuff like this. Of course, then the question is how does the app find maverick.properties -- I suppose JNDI might have to be used and then the property is set in the servlet.xml file. If you'd like any help proof-reading the manual, shoot me a copy. :) Thanks a lot, Dan At 05:12 AM 2/6/02 -0800, Jeff Schnitzer wrote: From: Dan Finkelstein [mailto:[EMAIL PROTECTED]] Hi -- Hi! I'm using 2.0 beta 1. When you're writing the doc for 2.0, the problems I've been having might be useful to document. Thanks, this helps! 1. On loading, I get errors that log4j isn't properly configured. I added a log4j initialization call in Dispatcher.init() and that seemed to do the trick. (I grepped the sources but didn't see any explicit initialization occurring. I also added simple properties file that log4j needed.) This is a FAQ in the yet-to-be-checked-in 2.0 manual. First a caveat: I'm not an expert in log4j, so I might be off base here. My general feeling is that log4j is really something that the container should be initializing, outside of the webapp. After all, you're typically going to want full logging when debugging, but minimal logging on the production box. Producing separate WARs for testing and deployment is not only a hassle, it's rather risky. My habit has been to provide default initialization to the JVM on startup using -Dlog4j.configuration=file:/path/to/maverick/tools/log4j.properties. 2. When running friendship-velocity, it gave me errors that were only resolved when I added in xalan.jar and xml-apis.jar. I had to download xalan from jakarta since it wasn't in the distribution. The readme note says to put them in the web server's lib directory. Could the friendship war have been built with these files inside, which is more typical? I'll update the documentation regarding the xml-apis.jar... since jaxp is moving into the JDK itself, it doesn't seem like something that should be included in the WARs. Also, some containers put it on the classpath already, so this is really only a tomcat deployment issue. BTW, didn't a previous version of tomcat include jaxp? I don't remember having this problem before... oh well. I'm hesitant to include xalan.jar in the distribution. There are currently five sample applications in all of Maverick. The xalan jar itself is 800K, and it would be included in each of the WARs plus the maverick/lib directory. This would bloat the distributions by five megs or so. Also, not everyone uses xalan... theoretically, any jaxp-compliant processor will do, and some web containers (e.g. Orion) already include one. 3. I'm interested in distributing different skins which would run alongside the war file. Thus, I would like maverick.xml, the vm files, html files, gif files, etc to live in a separate directory. I think maverick is wired to expect them inside right now. What do you think of this idea? It's definitely possible to have all the content (vm,html,images) in separate directories; paths are simply paths. At the moment, the maverick config file is hard-coded to WEB-INF/maverick.xml, although this could easily be made into a servlet init parameter. Is this what you have in mind? Also, would the shunting feature be of use to you for skinning? You could define each skin as a mode, and define views for all the modes. A custom Shunt could determine mode based on a session attribute. This would allow you to keep a single list of commands and controllers, and the Controllers wouldn't have to know