You can subscribe to this list here.
| 2003 |
Jan
|
Feb
(55) |
Mar
(100) |
Apr
(203) |
May
(330) |
Jun
(190) |
Jul
(302) |
Aug
(323) |
Sep
(197) |
Oct
(245) |
Nov
(490) |
Dec
(330) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(194) |
Feb
(400) |
Mar
(416) |
Apr
(415) |
May
(359) |
Jun
(381) |
Jul
(491) |
Aug
(311) |
Sep
(291) |
Oct
(273) |
Nov
(355) |
Dec
(266) |
| 2005 |
Jan
(306) |
Feb
(303) |
Mar
(520) |
Apr
(346) |
May
(255) |
Jun
(221) |
Jul
(171) |
Aug
(247) |
Sep
(147) |
Oct
(125) |
Nov
(165) |
Dec
(65) |
| 2006 |
Jan
(90) |
Feb
(53) |
Mar
(121) |
Apr
(103) |
May
(113) |
Jun
(103) |
Jul
(104) |
Aug
(67) |
Sep
(78) |
Oct
(82) |
Nov
(78) |
Dec
(70) |
| 2007 |
Jan
(77) |
Feb
(76) |
Mar
(63) |
Apr
(30) |
May
(47) |
Jun
(41) |
Jul
(44) |
Aug
(44) |
Sep
(49) |
Oct
(33) |
Nov
(25) |
Dec
(21) |
| 2008 |
Jan
(45) |
Feb
(13) |
Mar
(15) |
Apr
(12) |
May
(9) |
Jun
(33) |
Jul
(30) |
Aug
(7) |
Sep
(20) |
Oct
(17) |
Nov
(20) |
Dec
(10) |
| 2009 |
Jan
(8) |
Feb
(5) |
Mar
(12) |
Apr
(17) |
May
(19) |
Jun
(97) |
Jul
(77) |
Aug
(33) |
Sep
(24) |
Oct
(41) |
Nov
(16) |
Dec
(32) |
| 2010 |
Jan
(24) |
Feb
(14) |
Mar
(50) |
Apr
(71) |
May
(70) |
Jun
(64) |
Jul
(45) |
Aug
(62) |
Sep
(32) |
Oct
(4) |
Nov
(12) |
Dec
(2) |
| 2011 |
Jan
(1) |
Feb
(3) |
Mar
(4) |
Apr
(3) |
May
(6) |
Jun
(1) |
Jul
(4) |
Aug
(3) |
Sep
(4) |
Oct
(6) |
Nov
(3) |
Dec
(3) |
| 2012 |
Jan
(4) |
Feb
(8) |
Mar
(6) |
Apr
(10) |
May
(2) |
Jun
(3) |
Jul
(11) |
Aug
(10) |
Sep
(4) |
Oct
|
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
(9) |
Apr
(1) |
May
(8) |
Jun
(2) |
Jul
(5) |
Aug
(2) |
Sep
|
Oct
(3) |
Nov
(10) |
Dec
(8) |
| 2014 |
Jan
(3) |
Feb
(12) |
Mar
(9) |
Apr
(12) |
May
(2) |
Jun
|
Jul
(3) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(2) |
| 2015 |
Jan
(1) |
Feb
(3) |
Mar
(4) |
Apr
(9) |
May
(2) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(7) |
Oct
(9) |
Nov
(7) |
Dec
(9) |
| 2016 |
Jan
(7) |
Feb
(5) |
Mar
(5) |
Apr
(5) |
May
(8) |
Jun
(4) |
Jul
(5) |
Aug
(4) |
Sep
(6) |
Oct
(7) |
Nov
(2) |
Dec
(3) |
| 2017 |
Jan
(7) |
Feb
(8) |
Mar
(7) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(5) |
Aug
(8) |
Sep
(4) |
Oct
(2) |
Nov
(3) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2022 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
(5) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2026 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Rod J. <rod...@in...> - 2003-02-24 20:29:06
|
> 1. Add a boolean instance variable isFunction = false to the > StoredProcedure. This could be set to true if the call is to a function > or left false if it is to a procedure. Then the StoredProcedure could > use the correct syntax while it is "compiling" the callString > > 2. Create a StoredFunction class that does the same thing the current > StoredProcedure does, except for the call syntax. We could use > sub-classing to avoid code duplication > > The first solution is simpler and less code, but maybe not as clear as > the second one. I vote for 1. Simple and backward compatible. Thanks for raising the issue. Rod |
|
From: Thomas R. <tri...@tr...> - 2003-02-24 20:17:05
|
Hi guys,
I have just joined the group and I'm really looking forward to working
on this framework. Great stuff so far. I have e-mailed Rod with a few
suggestions for the SQLExceptionTranslater functionality, we should be
able to add some of the new features to CVS real soon.
While testing the changes to the SQLTranslation logic on different
databases I ran across a problem with using the StoredProcedure class
from the jdbc.object package.
It currently only supports the "{call my_proc(?, ?)}" syntax and this
worked fine for procedures but not for stored functions. With functions
you have to use the following call syntax "{? = call my_func(?)}". Since
all stored procedures in Postgres are declared as functions (CREATE
FUNCTION ...) it was a problem.
I came up with two solutions, and would like to know which one you would
prefer.
1. Add a boolean instance variable isFunction = false to the
StoredProcedure. This could be set to true if the call is to a function
or left false if it is to a procedure. Then the StoredProcedure could
use the correct syntax while it is "compiling" the callString
2. Create a StoredFunction class that does the same thing the current
StoredProcedure does, except for the call syntax. We could use
sub-classing to avoid code duplication
The first solution is simpler and less code, but maybe not as clear as
the second one.
This would be a good feature not only for Postgres, but for any database
that supports the CREATE FUNCTION feature - Oracle, MS SQL, DB2 ...
Let me know what you think.
Also - is anybody working on any other parts of the jdbc package? I'd
be interested to look at other issues, but I don't want to solve/fix
something that someone else is already looking at.
-- Thomas
|
|
From: Rod J. <rod...@in...> - 2003-02-24 18:58:46
|
Damn this reply-to! ----- Original Message ----- From: "Rod Johnson" <rod...@in...> To: "jürgen höller [werk3AT]" <jh...@we...> Sent: Monday, February 24, 2003 6:57 PM Subject: Re: [Springframework-developer] Struts (and Re: ErrorCoded/MessageSource) > > Concerning Struts: Despite all of its shortcomings, Struts does have a lot > of features. I've had a detailed look at Struts 1.1b3 recently, especially > analyzing Struts' way of doing things. There are some things worth looking > at: dispatch actions, dynamic forms, error message handling, request tokens, > declarative validation, multipart request processing, "modules", Tiles > integration. > > I agree, there's lots of stuff there, and things we can learn from. However, > wrt the dispatch action, our > com.interface21.web.servlet.mvc.multiaction.MultiActionController does the > same thing but is much more powerful. > > Rod > |
|
From: <jue...@li...> - 2003-02-24 15:22:51
|
Hi everybody, I'd like to communicate an idea that I've been thinking about for quite a while. Currently hanging around at home being a bit sick, this is a good way to use the time... ;-) Anyway, I've already raised the topic of utility libraries on the Wrox forum some time ago, and I've done some research since. The main issue is file upload aka multipart request handling. There are currently 2 noteworthy reusable upload libraries: - Jason Hunter's COS (com.oreilly.servlet): the classic, under Jason's "buy my book" license; - Jakarta's Commons FileUpload (currently 1.0 beta): a new alternative, under the Apache license. The latter is now the default implementation of Struts 1.1's MultipartRequestHandler (alternatively, Struts still has the old 1.0 implementation, the simple DiskMultipartRequestHandler). COS may be older and better tested, but Commons FileUpload is more sophisticated: For example, it can keep uploaded files smaller than a specified threshold in memory instead of writing everything temporarily to disk. My goal is to support file upload within Spring's web package, in a straightforward and pluggable way. The obvious way would be some multipart check in ControllerServlet's doService method that exchanges the standard HttpServletRequest with a wrapping MultipartServletRequest (an interface derived from HttpServletRequest) if it detects a multipart request. Controller implementations can check for a multipart request via "request instanceof MultipartServletRequest", or simply cast to the class if they expect one. The following proposal for Spring's multipart handler interfaces is obviously inspired by both COS' MultipartRequest and Commons FileUpload's FileItem classes, so don't blame me! ;-) It should be easy to write implementations for COS and Commons FileUpload that we could include out of the box. Of course, we are only allowed to include Commons FileUpload in a Spring distribution, in terms of license. Whoever wants to use COS could simply download it, add it to his web app libraries, and configure affected Spring controller servlets accordingly. The MultipartServletRequest interface needs to support getParameter and associated methods, to be able to handle simple parameters in a multipart request transparently, just like when dealing with a normal request. For file handling, I propose to add the following methods beyond HttpServletRequest, analogous to parameter handling: - MultipartFile getFile(String name)... returning a file descriptor for the specified file, or null - Map getFileMap()... returning a Map with file names as keys and MultipartFile instances as values - clearFileResources()... clearing all temporary file resources (automatically called by ControllerServlet after Controller processing) MultipartFile is an interface with the following methods: - InputStream getInputStream()... returning an input stream with the contents of the file - String getFileName()... returning the original file name given by the client - String getContentType()... returning the content type given by the client These should allow for both simple implementations and simple usage by custom controller implementations. The interfaces could even be used by JSPs, as the wrapped request will also be used when forwarding, although that is not recommended practice. Normally, a custom upload controller will evaluate the uploaded files and parameters, and transfer them to some application-specific storage location that could be a filesystem or a database. For application programmers, it is not important where the files are stored temporarily or if they are stored on disk at all, therefore the interfaces do not cover such aspects. Essentially, multipart handling should be as easy and transparent as possible. Finally, how will a ControllerServlet retrieve a MultipartServletRequest instance, using the toolkit of the application's choice? A straightforward Spring way would be to define a standard bean name "multipartResolver" (analogous to "viewResolver" and "localeResolver") that needs to implement the interface MultipartResolver: - MultipartServletRequest createMultipartRequest(HttpServletRequest request)... creating a wrapper - boolean hasMultipartContent(HttpServletRequest request)... checking the content type Of course, ControllerServlet should simply ignore multipart handling when there's no "multipartResolver" bean, maybe log a warning on initialization. What do you think? If we settle on the proposal, I could implement it promptly (right after locale resolution). I definitely consider file upload a 1.0 issue, as both Struts and WebWork have built-in support for it. Juergen P.S.: Concerning 2 other utility issues: For FTP and other Internet protocols that are not supported with J2SE, there's a new alternative too: Jakarta's Commons Net. I guess we won't need special support for it withing Spring. HTML escaping/unescaping: This is so fundamental and yet so simple that I've always wondered about the lack of standard support for it. Not even Struts 1.1 does include a respective utility class. So everyone seems to write his own... I'd like to include a HtmlUtils class providing static htmlEscape and htmlUnescape methods in Spring's web.util package, if no one objects. |
|
From: <rod...@in...> - 2003-02-23 20:12:50
|
Trevor, I agree that we don't need to let backward compatibility cause us to end up with a sub-optimal result for 1.0. Regards, Rod |
|
From: Trevor C. <tc...@in...> - 2003-02-23 19:54:21
|
What you wrote sounded right, and I think I understand what you are planning now, and it should workwell. Its just a much different implementation than what I was thinking, so my own preconceived ideas were clouding my ability to see your idea. Anyway, the working code should reveal all. :) On a more general note: >>BTW, the time before 1.0 is still our greatest chance to get >>it right, without the burden of backward compatibility. I totally agree, but want to make sure that everyone is on the same page. My understanding is that whatever we choose for our "0.8" or "early access" release is not guarenteed to be compatible with our 1.0 release. We obviously want to encourage people to start developing with it, but we won't be burdened by backwards compatibility to support it. If, for example, we discover a glaring hole in the code, we can change it for 1.0 even if it breaks any applications coded against 0.8. Is this correct? Trevor D. Cook --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03 |
|
From: <jh...@we...> - 2003-02-23 12:52:30
|
VHJldm9yLA0KDQo8cXVvdGU+DQpXaGF0IEkgd2FzIHByb3Bvc2luZyB3YXMgYW4gaW1wbGVtZW50 YXRpb24gYXMgZm9sbG93czogDQoNCnB1YmxpYyBpbnRlcmZhY2UgTG9jYWxlUmVzb2x2ZXIgeyAN CiAgICAgICAgDQogICAgLy8gZ2V0IHRoZSBjdXJyZW50bHkgcmVzb2x2ZWQgbG9jYWxlIA0KICAg IExvY2FsZSBnZXRMb2NhbGUoSHR0cFNlcnZsZXRSZXF1ZXN0IHJlcXVlc3QpOyANCg0KICAgIC8v IHNldCB0aGUgbG9jYWxlIGZyb20gdGhlIGFwcGxpY2F0aW9uIGNvZGUgDQogICAgdm9pZCBzZXRM b2NhbGUoSHR0cFNlcnZsZXRSZXF1ZXN0IH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RlcnN0YW5kaW5nIGVhY2gg b3RoZXIsIG9yIGlmIHdlIGFyZSBhY3R1YWxseSB0YWxraW5nIGFib3V0IGRpZmZlcmVudCB0aGlu Z3MuICBIb3dldmVyLCBJIHRoaW5rIHRoZSBvbmx5IHdheSBlaXRoZXIgb2YgdXMgY2FuIGJlIG1v cmUgY2xlYXIgaXMgd2l0aCB3b3JraW5nIGNvZGUuICBZb3Ugc2VlbSB0byB1bmRlcnN0YW5kIHRo ZSBpc3N1ZXMsIHNvIGp1c3QgY29kZSBpdCBob3cgeW91J3JlIHBsYW5uaW5nLiAgV29yc3QgY2Fz ZSwgd2UganVzdCByZWZhY3RvciBhbnkgcHJvYmxlbXMgbGF0ZXIuDQo8L3F1b3RlPg0KDQpHb29k IGlkZWEsIHdvcmtpbmcgY29kZSBpcyBwcm9iYWJseSBzdGlsbCB0aGUgYmVzdCB0aGluZyB0aGF0 IGRldmVsb3BlcnMgY2FuIGRpc2N1c3MgYWJvdXQhIEknbGwgaW1wbGVtZW50IGlzIEFTQVAgKE1v bmRheSBvciBUdWVzZGF5LCBpZiBJIGRvbid0IGZhbGwgaWxsIC0gSSBkb24ndCBmZWVsIGdvb2Qg Y3VycmVudGx5KSwgYW5kIHdlJ2xsIHNlZSB3aGVyZSB0aGUgZ2FwcyBhcmUsIGlmIGFueS4gTWF5 YmUgdGhlIGVsYWJvcmF0aW9uIGFib3ZlIGhhcyBoZWxwZWQsIGVsc2Ugd2UgcmVzb3J0IHRvIGNv ZGUuIEJUVywgdGhlIHRpbWUgYmVmb3JlIDEuMCBpcyBzdGlsbCBvdXIgZ3JlYXRlc3QgY2hhbmNl IHRvIGdldCBpdCByaWdodCwgd2l0aG91dCB0aGUgYnVyZGVuIG9mIGJhY2t3YXJkIGNvbXBhdGli aWxpdHkuDQoNCkp1ZXJnZW4NCg0K |
|
From: Trevor C. <tc...@in...> - 2003-02-23 00:48:16
|
>>I've just been confused by your remarks quoted above: The first paragraph
>>talks about a setLocale method without a locale parameter, and the third
>>paragraph proposes a setLocale method with exactly a locale parameter.
What I was proposing was an implementation as follows:
public interface LocaleResolver {
// get the currently resolved locale
Locale getLocale(HttpServletRequest request);
// set the locale from the application code
void setLocale(HttpServletRequest request, HttpServletResponse
response, Locale locale);
// resolve the current locale
void resolveLocale(HttpServletRequest request, HttpServletResponse
response, Locale locale);
}
>>CookieLocaleResolver.resolveLocale has to look for such a request
>>attribute before looking for a cookie. Thus, it will retrieve the
>>new locale even if the request still contains the old locale cookie.
The problem I see with this is that the application is forced to use
whatever method we define in order to change locales. For example, they
would be required to have a query parameter like "?locale=frCA".
I'm not sure if we are talking about the same thing and not understanding
each other, or if we are actually talking about different things. However,
I think the only way either of us can be more clear is with working code.
You seem to understand the issues, so just code it how you're planning.
Worst case, we just refactor any problems later.
Trevor D. Cook
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03
|
|
From: <jh...@we...> - 2003-02-22 23:05:41
|
VHJldm9yLA0KDQo8cXVvdGU+DQoNCkludGVyZmFjZSAtIHJlYWxseSBnb29kLCBidXQgSSBkb24n dCB0aGluayBpdCdzIG5lY2Vzc2FyeSB0byBoYXZlIGxvY2FsZSBhcyBhIHBhcmFtZXRlciBvZiBz ZXRMb2NhbGUsIHNpbmNlIHRoYXQgbWV0aG9kIHdpbGwgYmUgZGV0ZXJtaW5pbmcgdGhlIGFjdHVh bCBsb2NhbGUuIFdoYXQgdmFsdWUgYmUgcGFzc2VkIGJ5IHRoZSBDb250cm9sbGVyU2VydmxldCBm b3IgdGhpcyBwYXJhbWV0ZXI/ICBNYXliZSBpdCB3b3VsZCBiZSBsZXNzIGNvbmZ1c2luZyB0byBt YWtlIHRoZSBzaWduYXR1cmU6DQoNCkxvY2FsZSByZXNvbHZlTG9jYWxlKEh0dHBTZXJ2bGV0UmVx dWVzdCByZXF1ZXN0LCBIdHRwU2VydmxldFJlc3BvbnNlIHJlc3BvbnNlKTsg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m9sbGVyIHByZXZpb3VzbHkgbWFkZSB0aGUgY2hlY2spLiAgVGhpcyBhbGxvd3Mg Y29udHJvbGxlcnMgdG8ga25vdyB3aGljaCBsb2NhbGUgd2FzIGV4cGxpY2l0bHkgc2V0LCBidXQg YWxzbyBhbGxvd3MgdGhlbSB0byBjaGFuZ2UgdGhhdCB2YWx1ZS4gIFlvdSBndXlzIG1heSBoYXZl IHRob3VnaHQgb2YgdGhpcyBwcm9ibGVtIGFscmVhZHksIGJ1dCBpdCBjYXVnaHQgbWUgb2ZmIGd1 YXJkIChhbmQgY29zdCBtZSAyMCBtaW4gdG8gZmluZCB0aGUgc291cmNlIDooICkuDQoNCglUcmV2 b3IgRC4gQ29vaw0KDQo= |
|
From: Trevor C. <tc...@in...> - 2003-02-22 20:30:01
|
The reason I had setLocale was to allow a Controller access to change the explicit locale. I think the easiest way to explain this is with my understanding of how this should work with a "cookie" implementation. When a request is made, it goes into the ControllerServlet. The ControllerServlet than calls the CookieLocaleResovler resolveLocale. In the resolve method, it looks for a cookie. If it exists, it sets the locale to the value from the cookie. If it doesn't exist, it uses the default (browser) locale (from the request object). However, this only works if the cookie is ALREADY SET. If there is no cookie it resorts to the default locale. This brings up how to set the cookie. For my application, I will probably have a query string parameter added to the url for the current page. This means that if you are on the "about" page and click the "french" button, you receive the french about page. Somebody else may have an explicit "french" url which returns a page saying "thanks for choosing french". Because different applications might have different methods of allowing the user to select the locale, they need to be able to set the cookie (or set the session variable for the other implementation). To prevent this problem, we could force applications to use a single method of setting the locale, but I don't think this is flexible enough, so this brings us to how a Controller would set the locale. If we don't have a "setLocale" method, we need to expose internal implementation details. If you use a cookie version, you need to know the cookie name used by the resolver, create the cookie, and make sure that the locale for the CURRENT REQUEST being handled will be updated (see explanation of this below). However, a session implementation will need to know the name of the session attribute used by its resolver, add the locale to the session, and again ensure the current request locale. Because these 2 implementations have different ways of being set, the controller which sets them is then bound to the specific implementation (cookie / session). If we have a "setLocale" method, the Controller simply calls the interface setLocale method, and the specific implementation sets the appropriate cookie /session. This has the benefit of allowing each application to decide how to allow users to explicitly set a locale, but does not tie the Controller to a specific implementation. This also allows them to change from a cookie resolver to a session resolver by modifying the class in the config file without touching code. I may be misunderstanding how you plan to implement it, but the way I would implement it had the problem I've just described, prompting the third "setLocale" method. Above I mentioned "make sure that the locale for the CURRENT REQUEST being handled will be updated". When I did my prototype implementation, I found that I would set the cookie and then return a page, but the language wouldn't change. On review I noticed the following sequence of events. - request sent to servlet controller - servletController checks for cookie and sets locale - controller checks if locale in query string and sets cookie - controller returns page Because the servletController set the locale before controller processing, setting the cookie didn't change the locale for the current request. If I moved the servletController check after the controller is done, it isn't able to do any processing based on the explicitly set locale. This pointed out my oversight that when I set the cookie I also need to to set the current locale (even though the servletController previously made the check). This allows controllers to know which locale was explicitly set, but also allows them to change that value. You guys may have thought of this problem already, but it caught me off guard (and cost me 20 min to find the source :( ). Trevor D. Cook -----Original Message----- From: jürgen höller [werk3AT] [mailto:jh...@we...] Sent: February 22, 2003 1:57 PM To: spr...@li... Subject: Re: [Springframework-developer] Explicit locales Trevor, The name "LocaleResolver" is fine, and naming the retrieval method "resolveLocale" too, analogous to ViewResolver. But I'm not sure what you mean concerning the setLocale method and its Locale parameter: We need a way of telling the resolver that the user has chosen a specific locale - just like you note in your 4th paragraph. I.e. one resolution method and one modification method. I also prefer the "viewResolver" bean reference, looked up by the ControllerServlet, without individual LocaleResolver instances per controller. Of course, controllers need a way to both retrieve and set the current locale. So we should probably propagate the ControllerServlet's LocaleResolver instance via HandlerMapping to Controller instances that implement LocaleResolverAware (as I've already proposed), analogous to ApplicationContext and ApplicationContextAware. Concerning LocaleResolver implementations: Maybe call the default implementation "BrowserSettingLocaleResolver"? And yes, we should provide a "SessionLocaleResolver" and a "CookieLocaleResolver" out of the box. I like that locale resolution support: fairly sophisticated, but still reasonably simple! Juergen -----Ursprüngliche Nachricht----- Von: Trevor Cook [mailto:tc...@in...] Gesendet: Sa 22.02.2003 17:30 An: spr...@li... Cc: Betreff: RE: [Springframework-developer] Explicit locales Naming - I agree that LocaleHandler is confusing. I like LocaleResolver, since it is consistent with the the ViewResolver classes. Interface - really good, but I don't think it's necessary to have locale as a parameter of setLocale, since that method will be determining the actual locale. What value be passed by the ControllerServlet for this parameter? Maybe it would be less confusing to make the signature: Locale resolveLocale(HttpServletRequest request, HttpServletResponse response); The signature now makes it clear that we are not "setting it" so much as asking the method to determine how it should be set. It also matches the viewResolver usage. An additional "setLocale" method with the signature you provided: void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale); could be used to explicitly override the Locale determined by the resolveLocale method. This would benefit Controller specific overrides (addressed below). As you noted, the response is necessary for cookie-based implementations (good catch). Configuration - I think that loading it as a bean reference (like "viewResolver") makes the most sense. If we provide an access method, this would allow individual Controllers to get a reference to the resolver and override the locale using the setLocale method mentioned above. I think the ControllerServlet should handle the locale resolution rather than a "LocaleHandler-per-Controller". If someone needs "normal" locale handling, I think the per-Controller method would require too much cut-n-paste type code. However, the exposed setLocale method would allow those who need to set it on a per-Controller basis the ability to do so. DefaultImplementation - I think "ClientLocaleHandler" is too general, since all LocaleHandlers (or LocaleResolvers as I prefer :) ) are making decisions based on the client. The default will be using the servlets default mechanism, so maybe "ServletLocaleResolver" or "RequestLocaleResolver" (although again, too me they're too general - I can't think of a really good name). We should also create additional implementations for distribution such as the cookie and session based versions, rather than requiring each client to code one themselves (although they will have the oppurtunity to do so). Great analysis Juergen! Trevor D. Cook --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03 NHY隊X'u'$ح"wzyN\jkz+jw_bnWמv+h*.quڲ "Z0.fj+xTD}k$뉩p %v+\oy+䩮)~{ +ׯzZ)zXX*kxŠuޖ^X(~zwilqzlX)ߣ))~{ +ׯzZ) --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03 |
|
From: <jh...@we...> - 2003-02-22 18:57:01
|
VHJldm9yLA0KIA0KVGhlIG5hbWUgIkxvY2FsZVJlc29sdmVyIiBpcyBmaW5lLCBhbmQgbmFtaW5n IHRoZSByZXRyaWV2YWwgbWV0aG9kICJyZXNvbHZlTG9jYWxlIiB0b28sIGFuYWxvZ291cyB0byBW aWV3UmVzb2x2ZXIuIEJ1dCBJJ20gbm90IHN1cmUgd2hhdCB5b3UgbWVhbiBjb25jZXJuaW5nIHRo ZSBzZXRMb2NhbGUgbWV0aG9kIGFuZCBpdHMgTG9jYWxlIHBhcmFtZXRlcjogV2UgbmVlZCBhIHdh eSBvZiB0ZWxsaW5nIHRoZSByZXNvbHZlciB0aGF0IHRoZSB1c2VyIGhhcyBjaG9zZW4gYSBzcGVj aWZpYyBsb2NhbGUgLSBqdXN0IGxpa2UgeW91IG5vdGUgaW4geW91ciA0dGggcGFyYWdyYXBoLiBJ LmUuIG9uZSByZXNvbHV0aW9uIG1ldGhvZCBhbmQgb25lIG1vZGlmaWNhdGlvbiBtZXRob2QuDQog DQpJIGFsc28gcHJlZmVyIHRoZSAidmlld1Jlc29sdmVyIiBiZWFuIHJlZmVyZW5jZSwgbG9va2Vk IHVwIGJ5IHRoZSBDb250cm9sbGVyU2VydmxldCwgd2l0aG91dCBpbmRpdmlkdWFsIExvY2FsZVJl c29sdmVyIGluc3RhbmNlcyBwZXIgY29udHJvbGxlci4gT2YgY291cnNlLCBjb250cm9sbGVycyBu ZWVkIGEgd2F5IHRvIGJvdGggcmV0cmlldmUgYW5kIHNldCB0aGUgY3VycmVudCBsb2NhbGUuIFNv IHdlIHNob3VsZCBwcm9iYWJseSBwcm9wYWdhdGUgdGhlIENvbnRyb2xsZXJTZXJ2bGV0J3MgTG9j YWxlUmVzb2x2ZXIgaW5zdGFuY2UgdmlhIEhhbmRsZXJNYXBwaW5nI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bmdmcmFtZXdvcmstZGV2ZWxvcGVyQGxpc3RzLnNvdXJjZWZvcmdlLm5ldA0KCWh0 dHBzOi8vbGlzdHMuc291cmNlZm9yZ2UubmV0L2xpc3RzL2xpc3RpbmZvL3NwcmluZ2ZyYW1ld29y ay1kZXZlbG9wZXINCgkNCg0K |
|
From: Trevor C. <tc...@in...> - 2003-02-22 16:30:01
|
Naming - I agree that LocaleHandler is confusing. I like LocaleResolver, since it is consistent with the the ViewResolver classes. Interface - really good, but I don't think it's necessary to have locale as a parameter of setLocale, since that method will be determining the actual locale. What value be passed by the ControllerServlet for this parameter? Maybe it would be less confusing to make the signature: Locale resolveLocale(HttpServletRequest request, HttpServletResponse response); The signature now makes it clear that we are not "setting it" so much as asking the method to determine how it should be set. It also matches the viewResolver usage. An additional "setLocale" method with the signature you provided: void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale); could be used to explicitly override the Locale determined by the resolveLocale method. This would benefit Controller specific overrides (addressed below). As you noted, the response is necessary for cookie-based implementations (good catch). Configuration - I think that loading it as a bean reference (like "viewResolver") makes the most sense. If we provide an access method, this would allow individual Controllers to get a reference to the resolver and override the locale using the setLocale method mentioned above. I think the ControllerServlet should handle the locale resolution rather than a "LocaleHandler-per-Controller". If someone needs "normal" locale handling, I think the per-Controller method would require too much cut-n-paste type code. However, the exposed setLocale method would allow those who need to set it on a per-Controller basis the ability to do so. DefaultImplementation - I think "ClientLocaleHandler" is too general, since all LocaleHandlers (or LocaleResolvers as I prefer :) ) are making decisions based on the client. The default will be using the servlets default mechanism, so maybe "ServletLocaleResolver" or "RequestLocaleResolver" (although again, too me they're too general - I can't think of a really good name). We should also create additional implementations for distribution such as the cookie and session based versions, rather than requiring each client to code one themselves (although they will have the oppurtunity to do so). Great analysis Juergen! Trevor D. Cook --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03 |
|
From: <jh...@we...> - 2003-02-22 13:22:17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gk+DQoJPiBXaGVyZSBkbyB3ZSBjYWNoZSBs b2NhbGUgaW5mb3JtYXRpb24/IEknbSBub3Qga2VlbiBvbiBjcmVhdGluZyBhIHNlc3Npb24NCglp Zg0KCT4gb25lIGRvZXNuJ3QgZXhpc3QsIGFzIEkgdGhpbmsgU3RydXRzIGRvZXMsIGJlY2F1c2Ug dGhpcyBjYW4gZ2V0IHVzIGludG8NCgk+IHJlcGxpY2F0aW9uIGlzc3VlcyBpbiBvdGhlcndpc2Ug c3RhdGVsZXNzIHdlYiBhcHBzLg0KCT4NCgk+IFRoZSBMb2NhbGVMb2NhdG9yIGlzIGFsc28gcmVh bGx5IGEgbWFuYWdlci4gTWF5YmUgb25lIGltcGxlbWVudGF0aW9uIGNvdWxkDQoJPiB1c2Ugc2Vz c2lvbnMsIGFub3RoZXIgY291bGQgdXNlIGNvb2tpZXMgZXRjLiBBcyBKZWFuLVBpZXJyZSBoYXMg ZG9uZSwgdGhlDQoJPiBiZWFuIGZhY3RvcnkgaXMgYSBwZXJmZWN0IHdheSB0byBjaG9vc2UuDQoJ Pg0KCT4gUm9kDQoJDQoNCg== |
|
From: Rod J. <rod...@in...> - 2003-02-21 11:55:12
|
Reply-to again!
----- Original Message -----
From: "Rod Johnson" <rod...@in...>
To: "JP PAWLAK(Tiscali)" <jp....@ti...>
Sent: Friday, February 21, 2003 7:58 AM
Subject: Re: [Springframework-developer] Explicit locales
> Jean-Pierre's interface-based solution (which I hadn't seen because the
> attachment was too big and I had to approve it for it to appear) is along
> the lines I'd envisaged. Consistent with the Spring way, as he points out.
>
> One of the implementations of the interface could simply use a session att
> as Juergen suggests.
>
> I think it should go into the controller servlet.
>
> Where do we cache locale information? I'm not keen on creating a session
if
> one doesn't exist, as I think Struts does, because this can get us into
> replication issues in otherwise stateless web apps.
>
> The LocaleLocator is also really a manager. Maybe one implementation could
> use sessions, another could use cookies etc. As Jean-Pierre has done, the
> bean factory is a perfect way to choose.
>
> Rod
>
> ----- Original Message -----
> From: "JP PAWLAK(Tiscali)" <jp....@ti...>
> To: "Spring Developers (E-mail)"
> <spr...@li...>
> Sent: Friday, February 21, 2003 7:03 AM
> Subject: TR : [Springframework-developer] Explicit locales
>
>
> Envoyé : jeudi 20 février 2003 22:50
> À : 'Trevor Cook'
> Objet : RE : [Springframework-developer] Explicit locales
>
>
>
> I use a solution near of yours but with a more generalist approach. To
> keep the users locale, different possibilities exist: session, cookie,
> URL. But each solution can be handled knowing the request object. So I
> use a bean for implementing the effective strategy in the way of the
> general spirit of Spring.
>
> 1) Create a simple interface like this:
>
> public interface LocaleLocator {
>
> Locale getSessionLocale(HttpServletRequest request);
>
> void setSessionLocale(HttpServletRequest request, Locale
> sessionLocale);
>
> }
>
> 2) Create an implementation class which in your case handles with the
> cookies, but which can use the session or what method you like.
>
> 3) Overriding the ControllerServlet to use a LocaleLocator property with
> at least the setter, so the implementation class can be done in the
> servlet-configuration file.
>
> <bean name="localeLocator" singleton="true"
> class="perso.jpp.fwk.web.LocaleLocatorImpl" />
>
> <bean name="jstlHandler" singleton="true"
> class="perso.jpp.fwk.web.JstlHandlerImpl" >
>
> <property name="bundleName">achappro</property>
>
> </bean>
>
>
>
> code added in declaration part:
>
> // Added by JPP
>
> /** The bean name allowing the user session locale to be retrieved
> */
>
> public static final String LOCALE_LOCATOR = "localeLocator";
>
>
>
> /** The bean name allowing the jstl ressouece bundle to be set */
>
> public static final String JSTL_HANDLER = "jstlHandler";
>
>
>
> /** LocaleLocator used by this servlet
>
> * If not provided, request.getLocale() will be used instead */
>
> private LocaleLocator localeLocator;
>
> // End added
>
>
>
>
>
> code added in ControllerServlet (or descendent) at end of
> initFrameworkServlet :
>
> initViewResolver();
>
>
>
> // Added by JPP
>
> try {
>
> localeLocator = (LocaleLocator)
>
>
> getWebApplicationContext().getBean(LOCALE_LOCATOR);
>
> logger.config("localeLocator found in servlet '" +
> getServletName()
>
> + "' : " + localeLocator.getClass().getName());
>
> } catch(Exception e) {
>
> localeLocator = null; // Not required as it should
> yet been null
>
> logger.config("No localeLocator found in servlet '" +
> getServletName() + "', request Locale will be used.");
>
> }
>
> // Jstl handling
>
> // Put only in a subclass ? But Jstl is ageneric use
>
> // The ApplicationContextAware doesn't provide an access to
> the servletContext
>
> // It's the reason of an initialisation here. Exists a best
> approach ?
>
> try {
>
> JstlHandler jstlHandler = (JstlHandler)
>
>
> getWebApplicationContext().getBean(JSTL_HANDLER);
>
> jstlHandler.setServletCtx(this.getServletContext());
>
> logger.config("jstlHandler found in servlet '" +
> getServletName()
>
> + "' : " + jstlHandler.getClass().getName());
>
> } catch(Exception e) {
>
> logger.config("No jstlHandler found in servlet '" +
> getServletName());
>
> }
>
>
>
> // End added
>
>
>
> 4) As you can see, I handle I a same way the definition of locale and
> bundle for JSTL.
>
> 5) The LocaleLocator can be donated by beanref property to objects which
> have to know the current locale having the request object.
>
>
>
> I hope this will be a useful add-on in this discussion. I suggest to
> integrate a such behaviour in the original ControllerServlet as thes
> needs are very generally.
>
>
>
> Regards,
>
> Jean-Pierre
>
>
>
> -----Message d'origine-----
> De : spr...@li...
> [mailto:spr...@li...] De la
> part de Trevor Cook
> Envoyé : jeudi 20 février 2003 21:38
> À : Spring Developers (E-mail)
> Objet : RE: [Springframework-developer] Explicit locales
>
>
>
> It sounds like you're on the right track, and your approach should work
> for my stuff. I've already implemented some of this (code below) by
> overriding ControllerServlet and checking for a cookie in doService
> before passing control up. I store the locale in a persistent cookie so
> that no session is created for simple site browsing, and to remember
> chosen language for future visits. I'm sure my approach could be
> improved alot, but it's just a prototype (so I could get my html guy to
> start working).
>
> When you're implementing it, a few suggestions/ideas/requests. If this
> is put into the framework, you probably want to allow the developer to
> specify whether to make it cookie or session-based. If it is
> cookie-based, you'll probably also need to allow the developer to
> specify browser or persistent (including max age).
>
> Trevor D. Cook
>
>
>
> public class LocaleServletController extends ControllerServlet {
>
> public static final String LOCALE_HANDLE = "locale";
>
> protected void doService(
>
> HttpServletRequest request,
>
> HttpServletResponse response,
>
> boolean debugMode)
>
> throws ServletException, IOException {
>
> String locale = request.getParameter(LOCALE_HANDLE);
>
> if (locale != null) {
>
> logger.info("Setting locale to: " + locale);
>
> setLocaleCookie(request, response, locale);
>
> } else {
>
> getLocale(request);
>
> }
>
> super.doService(request, response, debugMode);
>
> }
>
> private void getLocale(HttpServletRequest request) {
>
> Cookie[] cookies = request.getCookies();
>
> int cookiesSize = cookies.length;
>
> for (int i = 0; i < cookiesSize; i++) {
>
> if (LOCALE_HANDLE.equals(cookies[i].getName())) {
>
> String localeCookie = cookies[i].getValue();
>
> setLocale(request, localeCookie);
>
> }
>
> }
>
> }
>
> private void setLocaleCookie(
>
> HttpServletRequest request,
>
> HttpServletResponse response,
>
> String localeString) {
>
> Locale locale = setLocale(request, localeString);
>
> Cookie localeCookie = new Cookie(LOCALE_HANDLE, localeString);
>
> if (locale.equals(request.getLocale())) {
>
> localeCookie.setMaxAge(-1);
>
> } else {
>
> localeCookie.setMaxAge(365 * 24 * 60 * 60);
>
> }
>
> response.addCookie(localeCookie);
>
> }
>
> private Locale setLocale(
>
> HttpServletRequest request,
>
> String localeString) {
>
> Locale locale =
>
> new Locale(localeString.substring(0, 2), localeString.substring(2));
>
> request.setAttribute("locale", locale);
>
> return locale;
>
> }
>
> }
>
>
>
>
>
> -----Original Message-----
> From: jürgen höller [werk3AT] [mailto:jue...@we...]
> Sent: February 20, 2003 3:21 PM
> To: Spring Developers (E-mail)
> Subject: Re: [Springframework-developer] Explicit locales
>
> Trevor,
>
>
>
> I've noticed that issue too. We definitely need support for a manually
> set locale in the session, already for 1.0. I consider 1. the only
> viable option but I think of a very easy and generic way: Why not just
> define a Spring standard name for a session attribute that can contain a
> Locale instance? The ControllerServlet could first check the session for
> such an attribute and fall back to the request locale.
>
>
>
> A custom application will probably not support changing the locale with
> every possible action but rather with a special one controller URL. That
> controller implementation could put a respective attribute into the
> session, with the given standard name, and update user preferences in
> the database or set a respective cookie if desired. Of course, the
> user's locale has to be retrieved for a new session - that could happen
> after login in a login controller, or in a custom filter that checks for
> a certain cookie.
>
>
>
> So the minimal framework support needed seems to be the definition of a
> standard name for a session locale, and checking the session when
> determining a view in the ControllerServlet. Of course, custom
> applications can not only set that locale but also retrieve it in
> controllers that perform locale-specific actions.
>
>
>
> I'm currently in the process of polishing Spring's web part (probably
> taking over responsibility for it, at least for 1.0), so I could add
> such locale support easily. Would the outlined approach be sufficient
> for you? If yes, I will add that support prompty, probably commiting the
> changes at the beginning of next week.
>
>
>
> Regards,
>
> Juergen
>
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Trevor Cook [mailto:tc...@in...]
> Gesendet: Donnerstag, 20. Februar 2003 03:55
> An: Spring Developers (E-mail)
> Betreff: [Springframework-developer] Explicit locales
>
> I have a business requirement of handling multiple locales.
> Specifically, I live in Canada, and the application must be available in
> French and English. However, due to multiple users on a single
> computer, we cannot rely solely on the users locale settings. What we
> need to do is default to the users locale, but provide them with the
> ability to override these settings (probably by clicking an
> "English/French" link).
>
> Anyway, the framework question I have is "is there anyway to do this
> currently"? Looking at the controller servlet, it returns a view based
> on "request.getLocale()". This can't be changed, so I can't see any way
> to customize/change it. My ideas are:
>
> 1. Have an explicit object in the request attribute for the locale with
> a "hook" to define how the default is determined (request locale,
> cookie, session, etc.). The view (or any other locale "lookup") would
> be based on this attribute.
>
> 2. Wrap the request/response objects in the control servlet, and provide
> hooks for these wrappers (which could override the getLocale() method).
>
> 3. Have the view return a generic view, and have the view contain
> code/taglibs which do the locale stuff in it.
>
> 4. Any other ideas?
>
> My "rating" of my own arguments is that 1 is the best since it abstracts
> the locale to the start of the servlet request as an initial parameter
> (which is how I consider it). 2 requires a lot of customization to
> support what appears to be something others might use (however, the
> ability to override other methods might be desirable). 3 is ugly code,
> and removes all the benefits of Rod's framework for seamlessly handling
> the locale issues.
>
> We probably can't make any of these changes for the 1.0 release (if we
> can great, but I'm trying to be realistic) but I was looking for some
> ideas and counter-arguments. I need to go ahead with this project (I'm
> actually waiting on this issue right now, but I think I've bought myself
> till Monday :) ) so I'll probably need to make my own modifications to a
> local copy of the code, but if my direction makes sense to everyone, I
> can probably polish/generalize my changes and roll it into the main
> stream in a future release.
>
> Trevor D. Cook
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03
>
>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03
>
>
>
>
|
|
From: Rod J. <rod...@in...> - 2003-02-21 07:22:33
|
Guys, I was aware that this was something that needed to be addressed. Certainly it's a 1.0 thing. Juergen's proposal seems simple and effective. I think it's what Struts does. Trevor's suggestion of a "hook" is interesting. It would be great for testing etc. to be able to configure it flexibly. Imagine if a user's locale preferences were even held in a DB? Can we parameterize based on a LocaleProvider interface? (Haven't had time to read Trevor's code--apologies if you've already considered this). Regards, Rod ----- Original Message ----- From: "jürgen höller [werk3AT]" <jue...@we...> To: "Spring Developers (E-mail)" <spr...@li...> Sent: Thursday, February 20, 2003 8:20 PM Subject: Re: [Springframework-developer] Explicit locales Trevor, I've noticed that issue too. We definitely need support for a manually set locale in the session, already for 1.0. I consider 1. the only viable option but I think of a very easy and generic way: Why not just define a Spring standard name for a session attribute that can contain a Locale instance? The ControllerServlet could first check the session for such an attribute and fall back to the request locale. A custom application will probably not support changing the locale with every possible action but rather with a special one controller URL. That controller implementation could put a respective attribute into the session, with the given standard name, and update user preferences in the database or set a respective cookie if desired. Of course, the user's locale has to be retrieved for a new session - that could happen after login in a login controller, or in a custom filter that checks for a certain cookie. So the minimal framework support needed seems to be the definition of a standard name for a session locale, and checking the session when determining a view in the ControllerServlet. Of course, custom applications can not only set that locale but also retrieve it in controllers that perform locale-specific actions. I'm currently in the process of polishing Spring's web part (probably taking over responsibility for it, at least for 1.0), so I could add such locale support easily. Would the outlined approach be sufficient for you? If yes, I will add that support prompty, probably commiting the changes at the beginning of next week. Regards, Juergen -----Ursprüngliche Nachricht----- Von: Trevor Cook [mailto:tc...@in...] Gesendet: Donnerstag, 20. Februar 2003 03:55 An: Spring Developers (E-mail) Betreff: [Springframework-developer] Explicit locales I have a business requirement of handling multiple locales. Specifically, I live in Canada, and the application must be available in French and English. However, due to multiple users on a single computer, we cannot rely solely on the users locale settings. What we need to do is default to the users locale, but provide them with the ability to override these settings (probably by clicking an "English/French" link). Anyway, the framework question I have is "is there anyway to do this currently"? Looking at the controller servlet, it returns a view based on "request.getLocale()". This can't be changed, so I can't see any way to customize/change it. My ideas are: 1. Have an explicit object in the request attribute for the locale with a "hook" to define how the default is determined (request locale, cookie, session, etc.). The view (or any other locale "lookup") would be based on this attribute. 2. Wrap the request/response objects in the control servlet, and provide hooks for these wrappers (which could override the getLocale() method). 3. Have the view return a generic view, and have the view contain code/taglibs which do the locale stuff in it. 4. Any other ideas? My "rating" of my own arguments is that 1 is the best since it abstracts the locale to the start of the servlet request as an initial parameter (which is how I consider it). 2 requires a lot of customization to support what appears to be something others might use (however, the ability to override other methods might be desirable). 3 is ugly code, and removes all the benefits of Rod's framework for seamlessly handling the locale issues. We probably can't make any of these changes for the 1.0 release (if we can great, but I'm trying to be realistic) but I was looking for some ideas and counter-arguments. I need to go ahead with this project (I'm actually waiting on this issue right now, but I think I've bought myself till Monday :) ) so I'll probably need to make my own modifications to a local copy of the code, but if my direction makes sense to everyone, I can probably polish/generalize my changes and roll it into the main stream in a future release. Trevor D. Cook --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 |
|
From: JP PAWLAK\(Tiscali\) <jp....@ti...> - 2003-02-21 07:04:09
|
Envoy=E9 : jeudi 20 f=E9vrier 2003 22:50
=C0 : 'Trevor Cook'
Objet : RE : [Springframework-developer] Explicit locales
=20
I use a solution near of yours but with a more generalist approach. To
keep the users locale, different possibilities exist: session, cookie,
URL. But each solution can be handled knowing the request object. So I
use a bean for implementing the effective strategy in the way of the
general spirit of Spring.
1) Create a simple interface like this:
public interface LocaleLocator {
Locale getSessionLocale(HttpServletRequest request);
void setSessionLocale(HttpServletRequest request, Locale
sessionLocale);
}
2) Create an implementation class which in your case handles with the
cookies, but which can use the session or what method you like.
3) Overriding the ControllerServlet to use a LocaleLocator property with
at least the setter, so the implementation class can be done in the
servlet-configuration file.
<bean name=3D"localeLocator" singleton=3D"true"
class=3D"perso.jpp.fwk.web.LocaleLocatorImpl" /> =20
<bean name=3D"jstlHandler" singleton=3D"true"
class=3D"perso.jpp.fwk.web.JstlHandlerImpl" > =20
<property name=3D"bundleName">achappro</property>
</bean>
=20
code added in declaration part:
// Added by JPP
/** The bean name allowing the user session locale to be retrieved
*/=20
public static final String LOCALE_LOCATOR =3D "localeLocator";
=20
/** The bean name allowing the jstl ressouece bundle to be set */=20
public static final String JSTL_HANDLER =3D "jstlHandler";
=20
/** LocaleLocator used by this servlet
* If not provided, request.getLocale() will be used instead */ =20
private LocaleLocator localeLocator;
// End added
=20
=20
code added in ControllerServlet (or descendent) at end of
initFrameworkServlet :
initViewResolver();
=20
// Added by JPP
try {
localeLocator =3D (LocaleLocator)
=20
getWebApplicationContext().getBean(LOCALE_LOCATOR);=20
logger.config("localeLocator found in servlet '" +
getServletName()=20
+ "' : " + localeLocator.getClass().getName());
} catch(Exception e) {
localeLocator =3D null; // Not required as it should
yet been null
logger.config("No localeLocator found in servlet '" +
getServletName() + "', request Locale will be used.");
}
// Jstl handling
// Put only in a subclass ? But Jstl is ageneric use
// The ApplicationContextAware doesn't provide an access to
the servletContext
// It's the reason of an initialisation here. Exists a best
approach ?
try {
JstlHandler jstlHandler =3D (JstlHandler) =20
=20
getWebApplicationContext().getBean(JSTL_HANDLER);=20
jstlHandler.setServletCtx(this.getServletContext());
logger.config("jstlHandler found in servlet '" +
getServletName()=20
+ "' : " + jstlHandler.getClass().getName());
} catch(Exception e) {
logger.config("No jstlHandler found in servlet '" +
getServletName());
}
=20
// End added
=20
4) As you can see, I handle I a same way the definition of locale and
bundle for JSTL.
5) The LocaleLocator can be donated by beanref property to objects which
have to know the current locale having the request object.
=20
I hope this will be a useful add-on in this discussion. I suggest to
integrate a such behaviour in the original ControllerServlet as thes
needs are very generally.
=20
Regards,
Jean-Pierre
=20
-----Message d'origine-----
De : spr...@li...
[mailto:spr...@li...] De la
part de Trevor Cook
Envoy=E9 : jeudi 20 f=E9vrier 2003 21:38
=C0 : Spring Developers (E-mail)
Objet : RE: [Springframework-developer] Explicit locales
=20
It sounds like you're on the right track, and your approach should work
for my stuff. I've already implemented some of this (code below) by
overriding ControllerServlet and checking for a cookie in doService
before passing control up. I store the locale in a persistent cookie so
that no session is created for simple site browsing, and to remember
chosen language for future visits. I'm sure my approach could be
improved alot, but it's just a prototype (so I could get my html guy to
start working).
When you're implementing it, a few suggestions/ideas/requests. If this
is put into the framework, you probably want to allow the developer to
specify whether to make it cookie or session-based. If it is
cookie-based, you'll probably also need to allow the developer to
specify browser or persistent (including max age).
Trevor D. Cook
=20
public class LocaleServletController extends ControllerServlet {
public static final String LOCALE_HANDLE =3D "locale";
protected void doService(
HttpServletRequest request,
HttpServletResponse response,
boolean debugMode)
throws ServletException, IOException {
String locale =3D request.getParameter(LOCALE_HANDLE);
if (locale !=3D null) {
logger.info("Setting locale to: " + locale);
setLocaleCookie(request, response, locale);=20
} else {
getLocale(request);
}
super.doService(request, response, debugMode);
}
private void getLocale(HttpServletRequest request) {
Cookie[] cookies =3D request.getCookies();
int cookiesSize =3D cookies.length;
for (int i =3D 0; i < cookiesSize; i++) {
if (LOCALE_HANDLE.equals(cookies[i].getName())) {
String localeCookie =3D cookies[i].getValue();
setLocale(request, localeCookie);
}
}
}
private void setLocaleCookie(
HttpServletRequest request,
HttpServletResponse response,
String localeString) {
Locale locale =3D setLocale(request, localeString);
Cookie localeCookie =3D new Cookie(LOCALE_HANDLE, localeString);
if (locale.equals(request.getLocale())) {
localeCookie.setMaxAge(-1);
} else {
localeCookie.setMaxAge(365 * 24 * 60 * 60);
}
response.addCookie(localeCookie);
}
private Locale setLocale(
HttpServletRequest request,
String localeString) {
Locale locale =3D
new Locale(localeString.substring(0, 2), localeString.substring(2));
request.setAttribute("locale", locale);
return locale;
}
}
=20
=20
-----Original Message-----
From: j=FCrgen h=F6ller [werk3AT] [mailto:jue...@we...]
Sent: February 20, 2003 3:21 PM
To: Spring Developers (E-mail)
Subject: Re: [Springframework-developer] Explicit locales
Trevor,
=20
I've noticed that issue too. We definitely need support for a manually
set locale in the session, already for 1.0. I consider 1. the only
viable option but I think of a very easy and generic way: Why not just
define a Spring standard name for a session attribute that can contain a
Locale instance? The ControllerServlet could first check the session for
such an attribute and fall back to the request locale.
=20
A custom application will probably not support changing the locale with
every possible action but rather with a special one controller URL. That
controller implementation could put a respective attribute into the
session, with the given standard name, and update user preferences in
the database or set a respective cookie if desired. Of course, the
user's locale has to be retrieved for a new session - that could happen
after login in a login controller, or in a custom filter that checks for
a certain cookie.
=20
So the minimal framework support needed seems to be the definition of a
standard name for a session locale, and checking the session when
determining a view in the ControllerServlet. Of course, custom
applications can not only set that locale but also retrieve it in
controllers that perform locale-specific actions.
=20
I'm currently in the process of polishing Spring's web part (probably
taking over responsibility for it, at least for 1.0), so I could add
such locale support easily. Would the outlined approach be sufficient
for you? If yes, I will add that support prompty, probably commiting the
changes at the beginning of next week.
=20
Regards,
Juergen
=20
=20
-----Urspr=FCngliche Nachricht-----
Von: Trevor Cook [mailto:tc...@in...]=20
Gesendet: Donnerstag, 20. Februar 2003 03:55
An: Spring Developers (E-mail)
Betreff: [Springframework-developer] Explicit locales
I have a business requirement of handling multiple locales.
Specifically, I live in Canada, and the application must be available in
French and English. However, due to multiple users on a single
computer, we cannot rely solely on the users locale settings. What we
need to do is default to the users locale, but provide them with the
ability to override these settings (probably by clicking an
"English/French" link).
Anyway, the framework question I have is "is there anyway to do this
currently"? Looking at the controller servlet, it returns a view based
on "request.getLocale()". This can't be changed, so I can't see any way
to customize/change it. My ideas are:
1. Have an explicit object in the request attribute for the locale with
a "hook" to define how the default is determined (request locale,
cookie, session, etc.). The view (or any other locale "lookup") would
be based on this attribute.
2. Wrap the request/response objects in the control servlet, and provide
hooks for these wrappers (which could override the getLocale() method).
3. Have the view return a generic view, and have the view contain
code/taglibs which do the locale stuff in it.=20
4. Any other ideas?=20
My "rating" of my own arguments is that 1 is the best since it abstracts
the locale to the start of the servlet request as an initial parameter
(which is how I consider it). 2 requires a lot of customization to
support what appears to be something others might use (however, the
ability to override other methods might be desirable). 3 is ugly code,
and removes all the benefits of Rod's framework for seamlessly handling
the locale issues.
We probably can't make any of these changes for the 1.0 release (if we
can great, but I'm trying to be realistic) but I was looking for some
ideas and counter-arguments. I need to go ahead with this project (I'm
actually waiting on this issue right now, but I think I've bought myself
till Monday :) ) so I'll probably need to make my own modifications to a
local copy of the code, but if my direction makes sense to everyone, I
can probably polish/generalize my changes and roll it into the main
stream in a future release.
Trevor D. Cook=20
=20
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03
=20
=20
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03
|
|
From: Trevor C. <tc...@in...> - 2003-02-20 20:37:04
|
It sounds like you're on the right track, and your approach should work =
for
my stuff. I've already implemented some of this (code below) by =
overriding
ControllerServlet and checking for a cookie in doService before passing
control up. I store the locale in a persistent cookie so that no =
session is
created for simple site browsing, and to remember chosen language for =
future
visits. I'm sure my approach could be improved alot, but it's just a
prototype (so I could get my html guy to start working).
When you're implementing it, a few suggestions/ideas/requests. If this =
is
put into the framework, you probably want to allow the developer to =
specify
whether to make it cookie or session-based. If it is cookie-based, =
you'll
probably also need to allow the developer to specify browser or =
persistent
(including max age).
Trevor D. Cook
=20
public class LocaleServletController extends ControllerServlet {
public static final String LOCALE_HANDLE =3D "locale";
protected void doService(
HttpServletRequest request,
HttpServletResponse response,
boolean debugMode)
throws ServletException, IOException {
String locale =3D request.getParameter(LOCALE_HANDLE);
if (locale !=3D null) {
logger.info("Setting locale to: " + locale);
setLocaleCookie(request, response, locale);=20
} else {
getLocale(request);
}
super.doService(request, response, debugMode);
}
private void getLocale(HttpServletRequest request) {
Cookie[] cookies =3D request.getCookies();
int cookiesSize =3D cookies.length;
for (int i =3D 0; i < cookiesSize; i++) {
if (LOCALE_HANDLE.equals(cookies[i].getName())) {
String localeCookie =3D cookies[i].getValue();
setLocale(request, localeCookie);
}
}
}
private void setLocaleCookie(
HttpServletRequest request,
HttpServletResponse response,
String localeString) {
Locale locale =3D setLocale(request, localeString);
Cookie localeCookie =3D new Cookie(LOCALE_HANDLE, localeString);
if (locale.equals(request.getLocale())) {
localeCookie.setMaxAge(-1);
} else {
localeCookie.setMaxAge(365 * 24 * 60 * 60);
}
response.addCookie(localeCookie);
}
private Locale setLocale(
HttpServletRequest request,
String localeString) {
Locale locale =3D
new Locale(localeString.substring(0, 2), localeString.substring(2));
request.setAttribute("locale", locale);
return locale;
}
}
=20
=20
-----Original Message-----
From: j=FCrgen h=F6ller [werk3AT] [mailto:jue...@we...]
Sent: February 20, 2003 3:21 PM
To: Spring Developers (E-mail)
Subject: Re: [Springframework-developer] Explicit locales
Trevor,
=20
I've noticed that issue too. We definitely need support for a manually =
set
locale in the session, already for 1.0. I consider 1. the only viable =
option
but I think of a very easy and generic way: Why not just define a =
Spring
standard name for a session attribute that can contain a Locale =
instance?
The ControllerServlet could first check the session for such an =
attribute
and fall back to the request locale.
=20
A custom application will probably not support changing the locale with
every possible action but rather with a special one controller URL. =
That
controller implementation could put a respective attribute into the =
session,
with the given standard name, and update user preferences in the =
database or
set a respective cookie if desired. Of course, the user's locale has to =
be
retrieved for a new session - that could happen after login in a login
controller, or in a custom filter that checks for a certain cookie.
=20
So the minimal framework support needed seems to be the definition of a
standard name for a session locale, and checking the session when
determining a view in the ControllerServlet. Of course, custom =
applications
can not only set that locale but also retrieve it in controllers that
perform locale-specific actions.
=20
I'm currently in the process of polishing Spring's web part (probably =
taking
over responsibility for it, at least for 1.0), so I could add such =
locale
support easily. Would the outlined approach be sufficient for you? If =
yes, I
will add that support prompty, probably commiting the changes at the
beginning of next week.
=20
Regards,
Juergen
=20
=20
-----Urspr=FCngliche Nachricht-----
Von: Trevor Cook [mailto:tc...@in...]=20
Gesendet: Donnerstag, 20. Februar 2003 03:55
An: Spring Developers (E-mail)
Betreff: [Springframework-developer] Explicit locales
I have a business requirement of handling multiple locales. =
Specifically, I
live in Canada, and the application must be available in French and =
English.
However, due to multiple users on a single computer, we cannot rely =
solely
on the users locale settings. What we need to do is default to the =
users
locale, but provide them with the ability to override these settings
(probably by clicking an "English/French" link).
Anyway, the framework question I have is "is there anyway to do this
currently"? Looking at the controller servlet, it returns a view based =
on
"request.getLocale()". This can't be changed, so I can't see any way =
to
customize/change it. My ideas are:
1. Have an explicit object in the request attribute for the locale with =
a
"hook" to define how the default is determined (request locale, cookie,
session, etc.). The view (or any other locale "lookup") would be based =
on
this attribute.
2. Wrap the request/response objects in the control servlet, and =
provide
hooks for these wrappers (which could override the getLocale() method).
3. Have the view return a generic view, and have the view contain
code/taglibs which do the locale stuff in it.=20
4. Any other ideas?=20
My "rating" of my own arguments is that 1 is the best since it =
abstracts the
locale to the start of the servlet request as an initial parameter =
(which is
how I consider it). 2 requires a lot of customization to support what
appears to be something others might use (however, the ability to =
override
other methods might be desirable). 3 is ugly code, and removes all the
benefits of Rod's framework for seamlessly handling the locale issues.
We probably can't make any of these changes for the 1.0 release (if we =
can
great, but I'm trying to be realistic) but I was looking for some ideas =
and
counter-arguments. I need to go ahead with this project (I'm actually
waiting on this issue right now, but I think I've bought myself till =
Monday
:) ) so I'll probably need to make my own modifications to a local copy =
of
the code, but if my direction makes sense to everyone, I can probably
polish/generalize my changes and roll it into the main stream in a =
future
release.
Trevor D. Cook=20
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( HYPERLINK "http://www.grisoft.com"
\nhttp://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03
=20
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.456 / Virus Database: 256 - Release Date: 2/18/03
=20
|
|
From: <jue...@we...> - 2003-02-20 20:21:26
|
Trevor, =20 I've noticed that issue too. We definitely need support for a manually = set locale in the session, already for 1.0. I consider 1. the only = viable option but I think of a very easy and generic way: Why not just = define a Spring standard name for a session attribute that can contain a = Locale instance? The ControllerServlet could first check the session for = such an attribute and fall back to the request locale. =20 A custom application will probably not support changing the locale with = every possible action but rather with a special one controller URL. That = controller implementation could put a respective attribute into the = session, with the given standard name, and update user preferences in = the database or set a respective cookie if desired. Of course, the = user's locale has to be retrieved for a new session - that could happen = after login in a login controller, or in a custom filter that checks for = a certain cookie. =20 So the minimal framework support needed seems to be the definition of a = standard name for a session locale, and checking the session when = determining a view in the ControllerServlet. Of course, custom = applications can not only set that locale but also retrieve it in = controllers that perform locale-specific actions. =20 I'm currently in the process of polishing Spring's web part (probably = taking over responsibility for it, at least for 1.0), so I could add = such locale support easily. Would the outlined approach be sufficient = for you? If yes, I will add that support prompty, probably commiting the = changes at the beginning of next week. =20 Regards, Juergen =20 =20 -----Urspr=FCngliche Nachricht----- Von: Trevor Cook [mailto:tc...@in...]=20 Gesendet: Donnerstag, 20. Februar 2003 03:55 An: Spring Developers (E-mail) Betreff: [Springframework-developer] Explicit locales =09 =09 I have a business requirement of handling multiple locales. = Specifically, I live in Canada, and the application must be available in = French and English. However, due to multiple users on a single = computer, we cannot rely solely on the users locale settings. What we = need to do is default to the users locale, but provide them with the = ability to override these settings (probably by clicking an = "English/French" link). Anyway, the framework question I have is "is there anyway to do this = currently"? Looking at the controller servlet, it returns a view based = on "request.getLocale()". This can't be changed, so I can't see any way = to customize/change it. My ideas are: 1. Have an explicit object in the request attribute for the locale with = a "hook" to define how the default is determined (request locale, = cookie, session, etc.). The view (or any other locale "lookup") would = be based on this attribute. 2. Wrap the request/response objects in the control servlet, and = provide hooks for these wrappers (which could override the getLocale() = method). 3. Have the view return a generic view, and have the view contain = code/taglibs which do the locale stuff in it.=20 4. Any other ideas?=20 My "rating" of my own arguments is that 1 is the best since it = abstracts the locale to the start of the servlet request as an initial = parameter (which is how I consider it). 2 requires a lot of = customization to support what appears to be something others might use = (however, the ability to override other methods might be desirable). 3 = is ugly code, and removes all the benefits of Rod's framework for = seamlessly handling the locale issues. We probably can't make any of these changes for the 1.0 release (if we = can great, but I'm trying to be realistic) but I was looking for some = ideas and counter-arguments. I need to go ahead with this project (I'm = actually waiting on this issue right now, but I think I've bought myself = till Monday :) ) so I'll probably need to make my own modifications to a = local copy of the code, but if my direction makes sense to everyone, I = can probably polish/generalize my changes and roll it into the main = stream in a future release. Trevor D. Cook=20 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 =20 |
|
From: Trevor C. <tc...@in...> - 2003-02-20 02:54:29
|
I have a business requirement of handling multiple locales. Specifically, I live in Canada, and the application must be available in French and English. However, due to multiple users on a single computer, we cannot rely solely on the users locale settings. What we need to do is default to the users locale, but provide them with the ability to override these settings (probably by clicking an "English/French" link). Anyway, the framework question I have is "is there anyway to do this currently"? Looking at the controller servlet, it returns a view based on "request.getLocale()". This can't be changed, so I can't see any way to customize/change it. My ideas are: 1. Have an explicit object in the request attribute for the locale with a "hook" to define how the default is determined (request locale, cookie, session, etc.). The view (or any other locale "lookup") would be based on this attribute. 2. Wrap the request/response objects in the control servlet, and provide hooks for these wrappers (which could override the getLocale() method). 3. Have the view return a generic view, and have the view contain code/taglibs which do the locale stuff in it. 4. Any other ideas? My "rating" of my own arguments is that 1 is the best since it abstracts the locale to the start of the servlet request as an initial parameter (which is how I consider it). 2 requires a lot of customization to support what appears to be something others might use (however, the ability to override other methods might be desirable). 3 is ugly code, and removes all the benefits of Rod's framework for seamlessly handling the locale issues. We probably can't make any of these changes for the 1.0 release (if we can great, but I'm trying to be realistic) but I was looking for some ideas and counter-arguments. I need to go ahead with this project (I'm actually waiting on this issue right now, but I think I've bought myself till Monday :) ) so I'll probably need to make my own modifications to a local copy of the code, but if my direction makes sense to everyone, I can probably polish/generalize my changes and roll it into the main stream in a future release. Trevor D. Cook --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/03 |
|
From: <jue...@we...> - 2003-02-18 15:45:07
|
"Reply to" address, a second time... =20 =20 -----Urspr=FCngliche Nachricht----- Von: j=FCrgen h=F6ller [werk3AT]=20 Gesendet: Freitag, 14. Februar 2003 21:00 An: Rod Johnson Betreff: Re: [Springframework-developer] Optional dependencies Rod, =20 Let's simply include the relevant JARs in the CVS lib directory. = Developers shouldn't care about some additional JARs even if they aren't = interested in them. The same rule applies to the current view = implementations that depend on Velocity and co. Of course, a dependency = table is a must, at least at the subpackage level of the Spring = codebase. =20 Regarding Struts: I guess it should be possible to include only the = relevant JARs and ignore the convenience stuff, like some of the Commons = packages. Ideally, that would mean just a struts.jar, not the whole army = that comes with a Struts distribution. Of course, the unit tests need to = be able to run, so this might be more sophisticated that I assume. =20 Concerning the distribution: I don't mind including such classes in the = standard Spring JARs, as they wouldn't need any of the third party = libraries if they are not actually used at runtime. I've used that = approach successfully numerous times within application projects, for = example in terms of separation of remote client and server classes, or = web application and applet codebase. Spring users that want to enable a = plugin should have to download the respective libraries from the third = party's site. That instructions need to be mentioned in a readme.=20 =20 Take for example Tomcat 4.x: Its distribution includes Tyrex-dependent = factory classes for its JNDI resource manager even though it doesn't = include the Tyrex libraries. Users have to download the Tyrex libraries = themselves from the ExoLab site. I don't know about Tomcat's CVS = contents, but I assume that the developers do have the Tyrex libraries = there. =20 In terms of repository size, including third party libraries should not = make a big difference. I assume that those libraries will change rarely, = at least in the Spring CVS, as we don't need to follow every minor = update. So CVS updates will usually ignore them and not cause additional = download traffic after initial checkout. =20 Regards, Juergen =20 =20 -----Urspr=FCngliche Nachricht-----=20 Von: Rod Johnson [mailto:rod...@in...]=20 Gesendet: Fr 14.02.2003 07:57=20 An: spr...@li...=20 Cc:=20 Betreff: [Springframework-developer] Optional dependencies =09 =09 Guys, =09 I've just been discussing our forthcoming Struts integration with Yann = and Paul. =09 This raises a problem that's likely to recur. This will probably = involve adding a small number of classes that are Struts-dependent. But not all developers might be interested in them. =09 In the following, read "Struts" to mean "any third party product some classes will depend on but which aren't of interest to everyone". =09 How can we prevent our whole source tree being Struts-dependent and = prevent developers uninterested in Struts from having to download the relevant = Jars? * Make it a separate CVS module? But this will lead to a profusion of = CVS modules. Harder to build etc. * Put it in the main module and change the Ant build script to compile = the necessary classes and run the the relevant tests only if it finds = Struts on the classpath? This could eventually make the build script very long = and complicated. * Better ideas I haven't thought off?? How do other projects handle = this? =09 From a distribution point of view, many users won't want the Struts = classes either. We could make them a sep download. Or we could just include = them in one of the main Jars, and they wouldn't do any harm unless they were = used without Struts. =09 From a documentation view, we'll also need a dependencies table, = showing what depends on what. =09 Regards, Rod =09 ____________________________________________________ Rod Johnson J2EE Architect and Author +44 7973 409 132 =09 Author of "Expert One-on-One J2EE Design and Development" (Wrox Press, October 2002). http://www.amazon.com/exec/obidos/tg/detail/-/1861007841/ =09 http://www.wrox.com/books/1861007841.htm =09 http://www.wrox.com/dynamic/books/find.aspx?author=3DRod+Johnson =09 =09 =09 =09 ------------------------------------------------------- This SF.NET email is sponsored by: FREE SSL Guide from Thawte are you planning your Web Server Security? Click here to get a FREE Thawte SSL guide and find the answers to all your SSL security issues. http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer =09 |
|
From: <jue...@we...> - 2003-02-18 15:44:12
|
That xxx "reply to" address... ;-) -----Urspr=FCngliche Nachricht----- Von: j=FCrgen h=F6ller [werk3AT]=20 Gesendet: Montag, 17. Februar 2003 08:44 An: 'Rod Johnson' Betreff: Re: [Springframework-developer] build.xml: VOTE Fine! > -----Urspr=FCngliche Nachricht----- > Von: Rod Johnson [mailto:rod...@in...] > Gesendet: Sonntag, 16. Februar 2003 22:45 > An: spr...@li... > Betreff: Fw: [Springframework-developer] build.xml: VOTE >=20 >=20 > Oops, the "reply to" address got me again... >=20 >=20 > Sounds like a good idea to me. Can we vote on it? >=20 > Rod > > > > ----- Original Message ----- > > From: "Kopylenko, Dmitry" <dko...@su...> > > To: "'spring-dev-list'" > > <spr...@li...> > > Sent: Friday, February 14, 2003 8:52 PM > > Subject: [Springframework-developer] build.xml > > > > > > > Just a thought. Why not move all the property declarations out of > > build.xml > > > into a property file. It's a best practice and makes a build file > cleaner. > > > > > > Just my 2c. > > > > > > Dmitriy. > > > > > > > > > ------------------------------------------------------- > > > This SF.NET email is sponsored by: FREE SSL Guide from > Thawte are > > > you planning your Web Server Security? Click here to get a FREE > > > Thawte SSL guide and find the answers to all your SSL security=20 > > > issues. http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en > > > _______________________________________________ > > > Springframework-developer mailing list=20 > > > Spr...@li... > > >=20 > https://lists.sourceforge.net/lists/listinfo/springframework-d evelop > > er > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Springframework-developer mailing list = Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Tim M. <mu...@on...> - 2003-02-17 22:22:39
|
I've always felt it was most effective to only put properties that were likely to be changed for an individual's local environment. So something like the location of JBoss or JDBC information. Stuff like the location of the build directory probably won't change much and just clutters up the properties file. If you have one and only put things that are likely to change, it is much more obvious to a new user where to make mods. --Tim |
|
From: Kopylenko, D. <dko...@ac...> - 2003-02-17 18:03:42
|
Yes, I will do that as soon I get a chance. Right now I am stuck here in Philadelphia with my girlfriend (I live in NJ) due to the big snow storm... :-) Will be waiting until the conditions improve :-) Later. Dmitriy. -----Original Message----- From: Rod Johnson To: Kopylenko, Dmitry; 'spring-dev-list' Sent: 2/17/2003 4:12 AM Subject: Re: [Springframework-developer] build.xml Dmitriy, Yes, this seems to be worth doing. Would you like to send me a modified build.xml and the new properties file so that I can test it and check it in? Please update to build.xml 1.3 as the basis for your new version--I made some changes last night. Regards, Rod ----- Original Message ----- From: "Kopylenko, Dmitry" <dko...@su...> To: "'spring-dev-list'" <spr...@li...> Sent: Friday, February 14, 2003 8:52 PM Subject: [Springframework-developer] build.xml > Just a thought. Why not move all the property declarations out of build.xml > into a property file. It's a best practice and makes a build file cleaner. > > Just my 2c. > > Dmitriy. > > > ------------------------------------------------------- > This SF.NET email is sponsored by: FREE SSL Guide from Thawte > are you planning your Web Server Security? Click here to get a FREE > Thawte SSL guide and find the answers to all your SSL security issues. > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer |