Re: [Stripes-users] Subclassing TypeConverterFactory -- newInstance()

2011-11-19 Thread Newman, John W
yep .. I didn't see that one.   That makes sense.   Thanks for clarifying.
In that case, a line in the class doco for each of those not thread safe .. do 
not cache one instance anywhere wouldn't hurt.

Actually in my case it wasn't even the snippet I posted causing the problem, 
since that map only contains MY type converters that coincidentally are all 
thread safe ...  After a second look, I found another class that had a field, 
private IntegerTypeConverter intConverter; ...  can't do that... had to delete 
the field and pull it from the factory inside the method call (reinstantiate 
it) instead of pulling it once in the constructor.  That smells but really it's 
the JDKs fault.   I just dislike it when any classes in a web application 
aren't thread safe, because you never know how you might want to use something. 

From: Ben Gunter [bgun...@cpons.com]
Sent: Saturday, November 19, 2011 7:50 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Subclassing TypeConverterFactory --
newInstance()

I did this and committed it years ago. Then Tim saw the change and told me he 
already had a JIRA issue for it that should have been resolved Won't Fix. He 
had done some testing and found that it really doesn't help enough to be worth 
the added complexity. So he reverted it.

See for reference:

http://www.stripesframework.org/jira/browse/STS-42?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel#issue-tabs

http://stripes.svn.sourceforge.net/viewvc/stripes?view=revisionrevision=682

http://stripes.svn.sourceforge.net/viewvc/stripes?view=revisionrevision=712

-Ben

On Fri, Nov 18, 2011 at 4:12 PM, Newman, John W 
newma...@d3onc.commailto:newma...@d3onc.com wrote:
All,

I just wanted to sound off about this as I know I borrowed this snippet of code 
from someone on this mailing list a long time ago, and I think there may be a 
few others out there still using it.  Subclassing the type converter factory to 
cache the instances instead of reinstating every time like so:

public class TypeConverterFactory extends DefaultTypeConverterFactory  {

  private static MapClass? extends TypeConverter?, TypeConverter? 
converterInstanceMap =
new ConcurrentHashMapClass? extends TypeConverter?, 
TypeConverter?();


  @SuppressWarnings(unchecked)  // super method uses raw type .. 
should be ?
  @Override
  public TypeConverter getInstance(Class? extends TypeConverter clazz,
  Locale locale) throws Exception {
TypeConverter? typeConverter = converterInstanceMap.get(clazz);
return typeConverter == null ? super.getInstance(clazz, locale) : 
typeConverter;
  }
}

.. is a bad idea, as it saves instances of the DateTypeConverter and 
NumberTypeConverter which are NOT thread safe.  I’ve had to remove this to get 
my load tests to pass.

At first I thought it was a bug that those are not thread safe, then I noticed 
this instance cache.   I’d like to propose that the default converter works 
this way to avoid this inefficient instantiation on every request, and that the 
DateTypeConverter and NumberTypeConverter  either synchronize on the 
SimpleDateFormat and NumberFormat instances or pool them.  The sync approach 
would be a pretty easy patch, I’d be happy to submit it, pooling would be 
better but would be more complex and probably add a dependency.  Any thoughts 
on that?

Thanks,
John

--
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string parameters?

2011-09-29 Thread Newman, John W
Just to follow up on this, thanks for all the good responses.

The solution Grzegorz outlined is probably the best way to do it.  Originally 
send a post, servlet filter does rewrite service, 301 redirect to short url, 
filter comes back in, detects short url and does internal forward to original 
request.  (I hadn't thought of forward of course, good call there).

But it turns out I really don't have to do any of this.  A very very long time 
ago during our first beta, we had an issue where IE 6 was caching ajax 
responses we obviously did not want it to.  I looked at the @HttpCache piece 
stripes offered, but for some reason I made the poor decision to trivialize the 
cache response headers...  We're broken in that every forward is getting these 
headers added:

protected ForwardResolution forward(String pageKey)  {
HttpServletResponse response = getCtx().getResponse();
response.setHeader(Cache-Control, no-store, no-cache, 
must-revalidate);
response.addHeader(Cache-Control, post-check=0, 
pre-check=0);
response.setHeader(Expires, Fri, 01 Jan 1990 00:00:00 GMT);
response.setHeader(Pragma, no-cache);
return new ForwardResolution(lookupPage(pageKey));
}

Obviously that is not right for every type of response.  I completely forgot 
that piece was hiding in there since it hasn't been touched for over 3 years.  
So in reading about proper use of HTTP caching headers, it is really non 
trivial.  I have to go through every forward and classify case by case how the 
caching should work.  I'm envisioning 3 or 4 different sets of response headers 
depending on how the response should or should not be cached.  It's really the 
burden of the application developer to make sure caching is handled correctly, 
no framework or anything is going to do this for you automatically and get it 
right.  Anyone sending an http response may want to read 
http://www.mnot.net/cache_docs 

 If I just remove the expires header on this one post, when the user goes back 
the page shows up right away.. this is the expected normal experience.  So I 
was really dead wrong with what I said about IE - it's actually a good feature 
on their part to alert that the page has expired.  I think the version of FF I 
was using did not say anything about page is expired, and just said do you 
want to resend the post?.   So once again, our users are unfortunately right 
that it is a bug on my end.  =)
 
Thanks again.
-John 

-Original Message-
From: Grzegorz Krugły [mailto:g...@karko.net] 
Sent: Tuesday, September 27, 2011 13:01
To: Stripes Users List
Subject: Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string 
parameters?

I think that it's going to have even less of an impact if some of those forms 
are used more than once by the same user. You can do 301 permanent http 
redirect so the user agent won't hit the original URL with s more than once 
for the same query at least.


Also, I don't think you need Tomcat source code :-) Try something like that:

 // check for URL mapping
 String rewrittenUrl = ejb.getUrlMapping(req.getRequestURI());

 // (...)

 if (rewrittenUrl == null) {
 chain.doFilter(request, response);
 } else {
 
filterConfig.getServletContext().getRequestDispatcher(rewrittenUrl).forward(request,
response);
 return;
 }


W dniu 2011-09-27 18:54, Newman, John W pisze:
 Right, I'd strongly prefer one billion requests for a simple task opposed to 
 trusting anything from a client.  In real life the two requests probably 
 isn't a killer.. i'll have to try it out.



 -Original Message-
 From: Grzegorz Krugły [mailto:g...@karko.net]
 Sent: Tuesday, September 27, 2011 12:49 PM
 To: Stripes Users List
 Subject: Re: [Stripes-users] Cleaning up / shrinking / obfuscating query 
 string parameters?

 It's not possible to bypass the two requests per one part if you want the 
 URL mangling done server-side. If there's only going to be a single request, 
 everything must be done on the client-side. So you'd have to trust their 
 clock when timestamping, etc. Not nice at all.


 --
 All the data continuously generated in your IT infrastructure contains a 
 definitive record of customers, application performance, security threats, 
 fraudulent activity and more. Splunk takes this data and makes sense of it. 
 Business sense. IT sense. Common sense.
 http://p.sf.net/sfu/splunk-d2dcopy1
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users


 --
 All the data continuously generated in your IT infrastructure contains a
 definitive record of customers

[Stripes-users] Cleaning up / shrinking / obfuscating query string parameters?

2011-09-27 Thread Newman, John W
All,

Up to this point our application has used method=POST for every form.  In 
general we're not too big on using GET due to the long messy URLs and people 
being able to save or share requests that may or may not work the same all the 
time for everyone.

For user experience reasons, we're looking at converting the read only forms 
to GET like they probably should have been in the first place.  When you go 
back to a POST, firefox does a nice job of just giving you a simple confirm 
message box.  Click yes and you're back at the results of the post.  But 
reasons I don't understand, IE8 went crazy and re-did this:  Send post, click 
back, get a white page is expired page (looks like an error), click refresh, 
get a message box, click retry, finally back at your results.  It's a lot of 
reading, mouse movement, and clicks just to go back and repost.  The average 
user gets lost and confused throughout this sequence and sees it as a bug on 
our end.
If I just change the method to GET it works fine, but the URL is extremely 
long.  It has the fp and sourcePage parameters in there which shows things like 
WEB-INF and other things I'd rather not have that visible.  Why aren't those 
sourcePage and fp parameters encrypted?

That aside, in order to switch this to get I'd like to do a couple things if I 
can:

1). Rewrite the query string from ?a=1234b=2345=c=3456  to something like 
?q=6vhHABS59OP0ILkMJsL7yY5t==  . ... and the stripes side should still see the 
parameters as  a  b  c, as it did before, no perceivable change from its 
perspective
2). Add a some tokens into the GET to keep track of when it was submitted and 
by whom so we can potentially block out old or unexpected requests.
#2 is not a big deal, we can do that fairly easily through a subclass of the 
form tag and an interceptor.  #1 however, I'm not really sure how to go about 
it.   I'm not 100% but I don't think the /clean/urls/feature can solve this as 
the form is kind of dynamic and has anywhere from 1-15 fields in the query.  It 
wouldn't translate to a restful URL.   Does stripes offer anything 'out of the 
box' that I can take advantage of?  I feel like I am missing something.

So far the best I can come up with is to put a servlet filter before the 
stripes filter that takes the q parameter, decodes it, and rewrites the 
getParameter() pieces to look into here instead.  Unfortunately this requires 
using HttpServletRequestWrapper, and due to no multiple inheritance, I have to 
literally copy a few pieces out of the servlet implementation we are currently* 
using.  So obviously that is a poor solution and I'm not going to do that.

Also, I'm not really sure how to encrypt the parameter on the client side.  I 
can hook into the form.submit() piece using jquery, but any encryption I put in 
there is client visible and can be broken.  Might I be able to hook into the 
form tag or something, or is just pointless base64 encoding the best I can do 
here?

Thanks for any input.
-John


John W. Newman
Programmer

[Description: Description: Description: 
C:\Users\newmjw\AppData\Local\Microsoft\Windows\Temporary Internet 
Files\Content.Outlook\TKMGHKML\d3via_logo (2).gif]

5750 Centre Avenue, Suite 500

Pittsburgh, PA 15206

Tel  412-204-0116

newma...@d3onc.commailto:newma...@d3onc.com

www.d3onc.comhttp://www.d3onc.com/

Fax 412-365-0749


This e-mail may contain confidential information of the sending organization. 
Any unauthorized or improper disclosure, copying, distribution, or use of the 
contents of this e-mail and attached document(s) is prohibited. The information 
contained in this e-mail and attached document(s) is intended only for the 
personal and confidential use of the recipient(s) named above. If you have 
received this communication in error, please notify the sender immediately by 
e-mail and delete the original e-mail and attached document(s).



inline: image001.gif--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string parameters?

2011-09-27 Thread Newman, John W
Why aren't those sourcePage and fp parameters encrypted?

Nevermind on that point, I have the thing set in debug mode locally...

public static String encrypt(String input) {
if (input == null)
input = ;

// encryption is disabled in debug mode
Configuration configuration = StripesFilter.getConfiguration();
if (configuration != null  configuration.isDebugMode())
return input;

.
public class Configuration extends RuntimeConfiguration {
@Override
protected Boolean initDebugMode() {
return 
dev.equals(appProperties.getString(environment));
}


so in real life I have

_sourcePage=I4HN0m5UPlwLkwNJZW2E9IQpyv6197QwgNwVAooFT2w1ry-oUVtWpQ==
__fp=zf_qQeORoi95oKdh9cUYlC8ExapErZ6TbTAzHXTSpRt5oKdh9cUYlIj8UUTtG8E006PeHlxld74=

which i guess is ok in the url (a lot better than showing WEB-INF).  Ideally 
I'd remove those two entirely but I think they're needed for validation to work 
right.


From: Newman, John W [mailto:newma...@d3onc.com]
Sent: Tuesday, September 27, 2011 11:34 AM
To: Stripes Users List (stripes-users@lists.sourceforge.net)
Subject: [Stripes-users] Cleaning up / shrinking / obfuscating query string 
parameters?

All,

Up to this point our application has used method=POST for every form.  In 
general we're not too big on using GET due to the long messy URLs and people 
being able to save or share requests that may or may not work the same all the 
time for everyone.

For user experience reasons, we're looking at converting the read only forms 
to GET like they probably should have been in the first place.  When you go 
back to a POST, firefox does a nice job of just giving you a simple confirm 
message box.  Click yes and you're back at the results of the post.  But 
reasons I don't understand, IE8 went crazy and re-did this:  Send post, click 
back, get a white page is expired page (looks like an error), click refresh, 
get a message box, click retry, finally back at your results.  It's a lot of 
reading, mouse movement, and clicks just to go back and repost.  The average 
user gets lost and confused throughout this sequence and sees it as a bug on 
our end.

If I just change the method to GET it works fine, but the URL is extremely 
long.  It has the fp and sourcePage parameters in there which shows things like 
WEB-INF and other things I'd rather not have that visible.  Why aren't those 
sourcePage and fp parameters encrypted?

That aside, in order to switch this to get I'd like to do a couple things if I 
can:

1). Rewrite the query string from ?a=1234b=2345=c=3456  to something like 
?q=6vhHABS59OP0ILkMJsL7yY5t==  . ... and the stripes side should still see the 
parameters as  a  b  c, as it did before, no perceivable change from its 
perspective
2). Add a some tokens into the GET to keep track of when it was submitted and 
by whom so we can potentially block out old or unexpected requests.

#2 is not a big deal, we can do that fairly easily through a subclass of the 
form tag and an interceptor.  #1 however, I'm not really sure how to go about 
it.   I'm not 100% but I don't think the /clean/urls/feature can solve this as 
the form is kind of dynamic and has anywhere from 1-15 fields in the query.  It 
wouldn't translate to a restful URL.   Does stripes offer anything 'out of the 
box' that I can take advantage of?  I feel like I am missing something.

So far the best I can come up with is to put a servlet filter before the 
stripes filter that takes the q parameter, decodes it, and rewrites the 
getParameter() pieces to look into here instead.  Unfortunately this requires 
using HttpServletRequestWrapper, and due to no multiple inheritance, I have to 
literally copy a few pieces out of the servlet implementation we are currently* 
using.  So obviously that is a poor solution and I'm not going to do that.

Also, I'm not really sure how to encrypt the parameter on the client side.  I 
can hook into the form.submit() piece using jquery, but any encryption I put in 
there is client visible and can be broken.  Might I be able to hook into the 
form tag or something, or is just pointless base64 encoding the best I can do 
here?

Thanks for any input.
-John


--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string parameters?

2011-09-27 Thread Newman, John W
Right so the trick of a redirect and using two requests for one.  That would 
work but I don’t really like the two request thing.   We’d probably have to 
persist the key-value pair in a table somewhere or they’d be invalid after an 
app restart.   I do like that idea as we could store timestamps and user 
accounts along with the pairs.  I’ll try that out here and see how it works, 
but I think the “copy pieces from tomcat svn” hack would still be required to 
get the parameter customization right...


  @Override
  public void doFilter(ServletRequest request, ServletResponse response,
  FilterChain chain) throws IOException, ServletException {
ServletRequest result = request;
HttpServletRequest cast = (HttpServletRequest) request;
String method = cast.getMethod();
if (method != null  GET.equals(method.toUpperCase())) {
  String queryString = cast.getQueryString();
  if (queryString != null  !.equals(queryString)) {
   if (isShortForm(queryString))  {
result = shortenAndMakeRedirect(cast);
// shorten and send client redirect .. client will 
make second request..
   } else  {
result = new WrappedRequest(cast);
// wrapped request would take care of the lookup 
piece.  You’ll need to adjust the
// getParameter() pieces to have this custom logic, but you’ll still run 
into the problem of
// having to borrow quite a bit from your particular servlet implementation.
// In my case the class I need to extend is package scoped...

   }
  }
}
chain.doFilter(result, response);
  }




From: gshegosh [mailto:g...@karko.net]
Sent: Tuesday, September 27, 2011 12:04 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string 
parameters?

Stripes has a mechanism for encrypting stuff, but I don't think it'll be too 
useful in your situation.

I don't think there's a need for a hardcode encryption on the client side, 
what they input in the form is not reliable anyway, so what would strong 
encryption give you? They already know what they've entered.

What I'd do (actually, I'm planning to modify my little stripes-based framework 
in such a way) is for the system to work a bit like a URL shortening service. 
That is, I'd implement a filter that would be placed before Stripes filter in 
the chain (I call it UrlRewritingFilter) and would basically tell it to do two 
things:
1. If current URL looks like a GET request from a form (contains ? and  or 
some better detection logic), encode it and send user a redirect to encoded URL.
2. If current URL is encoded, decode it.

By encoding I mean having a lookup MapString,String where keys are random, 
say 7-character strings (such as r8YhrR4 - 7 [A-Za-z0-9] digits give you a 
space of 62^7=3 521 614 606 208 unique keys) and values are my long, original 
URLs. When encoding a URL, I'll first look it up (reverse map as a cache could 
be useful for performance) and if it already exists, just return its key. If it 
doesn't, just make a random new key, make sure it doesn't already exist and put 
new entry.

That way URLs will be ultra short, will not be at all possible to decode 
without access to the lookup table and if users copy and paste them, they'll 
probably still work.

HTH,
Grzegorz
--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string parameters?

2011-09-27 Thread Newman, John W
 The __fp and _sourcePage values are encrypted as of Stripes 1.5 unless you 
 have Stripes.DebugMode turned on in your web.xml.
I did... lol

You can use @Validate(encrypted=true) to have form values encrypted when 
written out and automatically decrypted when read back in for binding.
Yep, we are using this where applicable (hidden fields).  I'm trying to encrypt 
(or otherwise alter) the parameter names as well as the values, and have 
stripes still see them the way it normally would.

 use a regular form tag and inside that put a stripes:form with the 
 partial attribute turned on
Hmm I will have to try that out.  I don't think validation / repopulation will 
still work right, but I will try.  Either way as long as the values are 
encrypted I think I can probably live with it.

There's nothing in Stripes to help much with combining multiple request 
parameters into one. You're on your own there.
Ok, good to get confirmation from you on that.  We'll see if we can come up 
with anything half decent.

Thanks Ben.


From: Ben Gunter [mailto:bgun...@cpons.com]
Sent: Tuesday, September 27, 2011 12:33 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string 
parameters?

The __fp and _sourcePage values are encrypted as of Stripes 1.5 unless you have 
Stripes.DebugMode turned on in your web.xml.

You can use @Validate(encrypted=true) to have form values encrypted when 
written out and automatically decrypted when read back in for binding.

As for getting rid of the __fp and _sourcePage parameters for a GET request, 
I'm not sure I've ever done this, but it might work. When you write your form 
into the HTML, use a regular form tag and inside that put a stripes:form 
with the partial attribute turned on. I think that would eliminate those 
special elements while still allowing for form repopulation, etc.

There's nothing in Stripes to help much with combining multiple request 
parameters into one. You're on your own there.

-Ben
On Tue, Sep 27, 2011 at 11:33 AM, Newman, John W 
newma...@d3onc.commailto:newma...@d3onc.com wrote:
All,

Up to this point our application has used method=POST for every form.  In 
general we're not too big on using GET due to the long messy URLs and people 
being able to save or share requests that may or may not work the same all the 
time for everyone.

For user experience reasons, we're looking at converting the read only forms 
to GET like they probably should have been in the first place.  When you go 
back to a POST, firefox does a nice job of just giving you a simple confirm 
message box.  Click yes and you're back at the results of the post.  But 
reasons I don't understand, IE8 went crazy and re-did this:  Send post, click 
back, get a white page is expired page (looks like an error), click refresh, 
get a message box, click retry, finally back at your results.  It's a lot of 
reading, mouse movement, and clicks just to go back and repost.  The average 
user gets lost and confused throughout this sequence and sees it as a bug on 
our end.
If I just change the method to GET it works fine, but the URL is extremely 
long.  It has the fp and sourcePage parameters in there which shows things like 
WEB-INF and other things I'd rather not have that visible.  Why aren't those 
sourcePage and fp parameters encrypted?

That aside, in order to switch this to get I'd like to do a couple things if I 
can:

1). Rewrite the query string from ?a=1234b=2345=c=3456  to something like 
?q=6vhHABS59OP0ILkMJsL7yY5t==  . ... and the stripes side should still see the 
parameters as  a  b  c, as it did before, no perceivable change from its 
perspective
2). Add a some tokens into the GET to keep track of when it was submitted and 
by whom so we can potentially block out old or unexpected requests.
#2 is not a big deal, we can do that fairly easily through a subclass of the 
form tag and an interceptor.  #1 however, I'm not really sure how to go about 
it.   I'm not 100% but I don't think the /clean/urls/feature can solve this as 
the form is kind of dynamic and has anywhere from 1-15 fields in the query.  It 
wouldn't translate to a restful URL.   Does stripes offer anything 'out of the 
box' that I can take advantage of?  I feel like I am missing something.

So far the best I can come up with is to put a servlet filter before the 
stripes filter that takes the q parameter, decodes it, and rewrites the 
getParameter() pieces to look into here instead.  Unfortunately this requires 
using HttpServletRequestWrapper, and due to no multiple inheritance, I have to 
literally copy a few pieces out of the servlet implementation we are currently* 
using.  So obviously that is a poor solution and I'm not going to do that.

Also, I'm not really sure how to encrypt the parameter on the client side.  I 
can hook into the form.submit() piece using jquery, but any encryption I put in 
there is client visible and can be broken.  Might I be able to hook into the 
form

Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string parameters?

2011-09-27 Thread Newman, John W
Right, I'd strongly prefer one billion requests for a simple task opposed to 
trusting anything from a client.  In real life the two requests probably isn't 
a killer.. i'll have to try it out.



-Original Message-
From: Grzegorz Krugły [mailto:g...@karko.net] 
Sent: Tuesday, September 27, 2011 12:49 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Cleaning up / shrinking / obfuscating query string 
parameters?

It's not possible to bypass the two requests per one part if you want the URL 
mangling done server-side. If there's only going to be a single request, 
everything must be done on the client-side. So you'd have to trust their clock 
when timestamping, etc. Not nice at all.


--
All the data continuously generated in your IT infrastructure contains a 
definitive record of customers, application performance, security threats, 
fraudulent activity and more. Splunk takes this data and makes sense of it. 
Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] Exception handler - cannot forward to error page after exception in original page forward.

2011-08-16 Thread Newman, John W
Hi All,

I've had this minor problem for a while now, and I'm not really sure what I'm 
supposed to do differently.  Consider an action bean that throws an exception 
in the middle of the forward resolution while processing the page:

class ActionBean  {
public Resolution throwExceptionWithinJsp()  {
return new 
ForwardResolution(/WEB-INF/some-jsp-page-that-throws-an-exception.jsp);
}
}

We have an exception handler configured, to catch any errors and then take the 
user to a friendly error page instead of giving them the nice old tomcat stack 
trace view.

class ExceptionHandler()  {
public Resolution handleGeneric(Throwable t)  {
  log.error(t);
  return new ForwardResolution(/WEB-INF/errors/500.jsp);
   }
}


So we've got an exception trace from that jsp page (or freemarker in my case):

ERROR: Expression xyz is undefined on line 105, column 38 in 
WEB-INF/some-jsp-page-that-throws-an-exception.jsp
at freemarker.template.Template.process(Template.java:237)
at 
freemarker.ext.servlet.FreemarkerServlet.process(FreemarkerServlet.java:458)
at 
freemarker.ext.servlet.FreemarkerServlet.doPost(FreemarkerServlet.java:405)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
net.sourceforge.stripes.controller.DynamicMappingFilter.doFilter(DynamicMappingFilter.java:345)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at 
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at 
net.sourceforge.stripes.action.ForwardResolution.execute(ForwardResolution.java:110)

Now the exception handler kicks in, logs the error, and now tries to forward 
the user over to our nice 500 page.But the problem is, they never actually 
get to the error page - just a blank response, due to yet another exception 
caused by the second forward:

ERROR 
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/].[default]] 
Servlet.service() for servlet default threw exception
java.lang.IllegalStateException: Cannot forward after response has been 
committed
at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at 
net.sourceforge.stripes.action.ForwardResolution.execute(ForwardResolution.java:110)
at 
net.sourceforge.stripes.exception.DefaultExceptionHandler$HandlerProxy.handle(DefaultExceptionHandler.java:107)
at 
net.sourceforge.stripes.exception.DefaultExceptionHandler.handle(DefaultExceptionHandler.java:140)
at 
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:249)

So since I can't return a forward resolution if I've already executed one, what 
am I supposed to do to get the user over to the error page?   In general, is 
returning a resolution from the exception handler a valid idea on stripes' 
part?  I know I'm not the only one who has this requirement of a forward to a 
friendly 500 page.   I'm also slightly curious why that second error doesn't 
get through to my exception handler, and stick the application in an infinite 
loop of forward-exception-handle-forward-exception.

Any thoughts are appreciated.

Thanks,
John

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Exception handler - cannot forward to error page after exception in original page forward.

2011-08-16 Thread Newman, John W
I forgot to mention, a lot of the content on

http://www.stripesframework.org/display/stripes/Exception+Handling

is actually incorrect due to this problem.  That page is where I lifted this  
stuff from many years ago.

[Description: http://www.stripesframework.org/images/icons/emoticons/check.gif]

The ExceptionHandler is invoked from the Stripes Filter. This allows it to 
handle exceptions generated in ActionBeans, in JSPs and even in other Servlet 
Filters that are lower down the chain than the Stripes Filter.



Is request.getRequestDispatcher(/error.jsp).forward(request, response);

Any more likely to succeed as opposed to  return new ForwardResolution(...);



(the page uses both idioms in the example)




From: Newman, John W [mailto:newma...@d3onc.com]
Sent: Tuesday, August 16, 2011 1:26 PM
To: Stripes Users List (stripes-users@lists.sourceforge.net)
Subject: [Stripes-users] Exception handler - cannot forward to error page after 
exception in original page forward.

Hi All,

I've had this minor problem for a while now, and I'm not really sure what I'm 
supposed to do differently.  Consider an action bean that throws an exception 
in the middle of the forward resolution while processing the page:

class ActionBean  {
public Resolution throwExceptionWithinJsp()  {
return new 
ForwardResolution(/WEB-INF/some-jsp-page-that-throws-an-exception.jsp);
}
}

We have an exception handler configured, to catch any errors and then take the 
user to a friendly error page instead of giving them the nice old tomcat stack 
trace view.

class ExceptionHandler()  {
public Resolution handleGeneric(Throwable t)  {
  log.error(t);
  return new ForwardResolution(/WEB-INF/errors/500.jsp);
   }
}


So we've got an exception trace from that jsp page (or freemarker in my case):

ERROR: Expression xyz is undefined on line 105, column 38 in 
WEB-INF/some-jsp-page-that-throws-an-exception.jsp
at freemarker.template.Template.process(Template.java:237)
at 
freemarker.ext.servlet.FreemarkerServlet.process(FreemarkerServlet.java:458)
at 
freemarker.ext.servlet.FreemarkerServlet.doPost(FreemarkerServlet.java:405)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
net.sourceforge.stripes.controller.DynamicMappingFilter.doFilter(DynamicMappingFilter.java:345)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at 
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at 
net.sourceforge.stripes.action.ForwardResolution.execute(ForwardResolution.java:110)

Now the exception handler kicks in, logs the error, and now tries to forward 
the user over to our nice 500 page.But the problem is, they never actually 
get to the error page - just a blank response, due to yet another exception 
caused by the second forward:

ERROR 
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/].[default]] 
Servlet.service() for servlet default threw exception
java.lang.IllegalStateException: Cannot forward after response has been 
committed
at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:302)
at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at 
net.sourceforge.stripes.action.ForwardResolution.execute(ForwardResolution.java:110)
at 
net.sourceforge.stripes.exception.DefaultExceptionHandler$HandlerProxy.handle(DefaultExceptionHandler.java:107)
at 
net.sourceforge.stripes.exception.DefaultExceptionHandler.handle(DefaultExceptionHandler.java:140)
at 
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:249)

So since I can't return a forward resolution if I've already executed one, what 
am I supposed to do to get the user over to the error page?   In general, is 
returning a resolution from the exception handler a valid idea on stripes' 
part?  I know I'm not the only one who has this requirement of a forward to a 
friendly 500 page.   I'm also

Re: [Stripes-users] Direct access to .jsp, no security manager (stripesstuff security)

2011-07-12 Thread Newman, John W
Easiest thing to do is move your jsp files into the WEB-INF folder, which is 
not allowed to be requested directly per the servlet spec.   That's a normal 
best practice kind of thing.  Jsps should be protected just like the compiled 
.class and .jar files (siblings)

-Original Message-
From: T Akhayo [mailto:t.akh...@gmail.com] 
Sent: Tuesday, July 12, 2011 4:35 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Direct access to .jsp, no security manager 
(stripesstuff security)

Good evening,

I'm currently using the security interceptor from stripesstuff. It works like a 
charm.

There is only one problem, when i access my .jsp pages directly (surf to .jsp 
page) the  allowed jsp tag always grant access.

When i go to a .action page (which forwards to the .jsp) everything works fine.

I turned debugging on and found out that when going directly to a .jsp page the 
security interceptor doesn't insert the security manager in the current 
request. When using the allowed tag the debug message
is:
there is no security manager; allowing access

Is there a way i can manually insert the security manager?

Please note that i am using my own j2eesecuritymanager.

Kind regards,
T. Akhayo


stripes-users@lists.sourceforge.net

--
AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the 
creator of the Lean Startup Methodology on Lean Startup Secrets Revealed. 
This video shows you how to validate your ideas, optimize your ideas and 
identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on Lean Startup 
Secrets Revealed. This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] TypeConverter API - can I get the current field name?

2011-06-24 Thread Newman, John W
Well, that's a great idea, but unfortunately not available until 1.6 is 
released.  But that will definitely work at that point.  Thanks Remi.

If that trick is mentioned in the FAQ or the type converter / configuration 
doco, I would close 701 as won't fix since changing that interface breaks 
backwards compatibility.  I know I for one would not want to update all of our 
25+ type converter classes.



From: VANKEISBELCK Remi [mailto:r...@rvkb.com]
Sent: Friday, June 24, 2011 4:37 AM
To: Stripes Users List
Subject: Re: [Stripes-users] TypeConverter API - can I get the current field 
name?

Hi John,

There's a Workaround : actually you can access the action bean for a a request 
from anywhere through the ExecutionContext. See 
net.sourceforge.stripes.controller.ExecutionContext#currentContext. You can do :

ExecutionContext.currentContext().getActionBean();

Cheers

Remi
2011/6/23 Newman, John W newma...@d3onc.commailto:newma...@d3onc.com
I did not know that.  Nearly 5 years of using stripes, you think I would know 
that by now.errors.add(new 
LocalizableError(validation.expression.valueFailedExpression));  is working 
fine.

But yeah, the current action bean instance would be a great addition.  
http://www.stripesframework.org/jira/browse/STS-701  looks like what I'm 
getting at.   Perhaps a simple StripesFilter.getCurrentActionBean() or 
something like that might be a possibility as opposed to changing old interface 
signatures.

Thanks Freddy

-Original Message-
From: Freddy Daoud [mailto:xf2...@fastmail.fmmailto:xf2...@fastmail.fm]
Sent: Thursday, June 23, 2011 1:27 PM
To: 
stripes-users@lists.sourceforge.netmailto:stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] TypeConverter API - can I get the current field 
name?

Hi John,

The type converter doesn't need to be given the field name. The field name is 
automatically provided as the {0} parameter when constructing the error message 
from the resource bundle, and {1} the value entered by the user. Ideally you 
use a ScopedLocalizableError, so that the user of your type converter can make 
good use of the lookup strategy to organize resource bundle keys.

I agree that it would be useful for the type converter to be given more 
context. Perhaps just the ActionBean, because from there you can get the 
ActionBeanContext, then the request, response, session, ...

Cheers,
Freddy



--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe, 
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
All the data continuously generated in your IT infrastructure contains a 
definitive record of customers, application performance, security 
threats, fraudulent activity and more. Splunk takes this data and makes 
sense of it. Business sense. IT sense. Common sense.. 
http://p.sf.net/sfu/splunk-d2d-c1___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] TypeConverter API - can I get the current field name?

2011-06-23 Thread Newman, John W
All,

The type converter interface has the validation errors as an argument.  If 
invalid input is contained in the post, the collection is there to add a new 
error message to.   But to add a useful error message, I need the field name as 
a parameter.   Which I'm not able to get (unless I am missing something?)

public Object convert(String input, Class? extends Object type,
CollectionValidationError errors) {
  Object result = null;
  if (input == null) {
// The value supplied ({1}) for field {0} is invalid
errors.add(new LocalizableError(
validation.expression.valueFailedExpression,
input, how do I get the field name?));
  } else {
result = new Object();
  }
  return result;
}

Am I missing something?  Shouldn't the interface be

public Object convert(String fieldName, String input,
Class? extends Object type,
CollectionValidationError errors) {

Or maybe even

public T, A extends ActionBean convert(A actionBean, String fieldName, String 
input,
Class? extends T type,
CollectionValidationError errors) {

I think it would be nice to get the current action bean instance in there, 
allowing access through to the session etc.  Essentially what I'm getting at is 
the type converters could make use of a lot more stuff than they currently get. 
 I could do some workaround with spring to control these instances and inject 
the current bean and other stuff in there, but it would be much easier if the 
public method just got other things as a parameter.

Thoughts?
-John
--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] TypeConverter API - can I get the current field name?

2011-06-23 Thread Newman, John W
I did not know that.  Nearly 5 years of using stripes, you think I would know 
that by now.errors.add(new 
LocalizableError(validation.expression.valueFailedExpression));  is working 
fine. 

But yeah, the current action bean instance would be a great addition.  
http://www.stripesframework.org/jira/browse/STS-701  looks like what I'm 
getting at.   Perhaps a simple StripesFilter.getCurrentActionBean() or 
something like that might be a possibility as opposed to changing old interface 
signatures.

Thanks Freddy

-Original Message-
From: Freddy Daoud [mailto:xf2...@fastmail.fm] 
Sent: Thursday, June 23, 2011 1:27 PM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] TypeConverter API - can I get the current field 
name?

Hi John,

The type converter doesn't need to be given the field name. The field name is 
automatically provided as the {0} parameter when constructing the error message 
from the resource bundle, and {1} the value entered by the user. Ideally you 
use a ScopedLocalizableError, so that the user of your type converter can make 
good use of the lookup strategy to organize resource bundle keys.

I agree that it would be useful for the type converter to be given more 
context. Perhaps just the ActionBean, because from there you can get the 
ActionBeanContext, then the request, response, session, ...

Cheers,
Freddy



--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe, 
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Strange introspection issue after upgrade to 1.5.2

2011-05-13 Thread Newman, John W
Hi,

I can confirm this only happens with stripes 1.5.2 .  The changes for STS-664 
appear to be the problem.  I am working on digging through those a bit and 
coming up with a reproducible test case.  It is not due to idle time, I just 
got it to happen shortly after startup.  Our session timeout is set to 4 hours 
and we have a timeout listener built to pop up a dialog, so it's not anything 
related to session.  Some other thread is disturbing the cache maintained by 
the introspector.   Ben, does this ring any bells?  I'm specifically looking at 
the comment on rev 1184, it really looks like something is that cache is 
somehow changing from one minute to the next.

117710/20/09 12:36 PM   2   bengunter   Fixed STS-664: JDK bug 
in bean introspection prevents Stripes validation. Also added a unit test. 
118110/21/09 3:17 PM6   bengunter   A more complete fix for 
STS-664: JDK bug in bean introspection prevents Stripes validation. I added 
several useful methods to help deal with this problem in ReflectUtil and 
updated several classes to get the property descriptors from ReflectUtil 
instead of directly from Introspector. ReflectUtil transparently handles bridge 
methods in PropertyDescriptors so that calling code need not be concerned with 
them. 
118210/21/09 3:25 PM1   bengunter   Minor fix for STS-664. 
Null the setter after logging the error when a bridge goes nowhere. (This 
should not happen, but I have observed it on Java 1.6.0_03.) 
118310/21/09 10:25 PM   1   bengunter   STS-664: In the 
BridgedPropertyDescriptor constructor, pass this to resolvePropertyType(..) 
to get the correct result. Also override setReadMethod and setWriteMethod. 
*1184   10/21/09 10:43 PM   2   bengunter   STS-664: Create 
a copy of the array of property descriptors so that if and when we poke a 
BridgePropertyDescriptor into the array, we don't affect the cache maintained 
by Introspector. Also added a missing @Override to the unit test class. 
**1185  10/21/09 11:50 PM   1   bengunter   STS-664: Never return 
null from resolveBridgedWriteMethod(..). If a better write method can't be 
found, then return the write method that was passed in. Sun's compiler marks 
certain methods as bridge while the Eclipse compiler does not 
**1186  10/21/09 11:56 PM   1   bengunter   STS-664: Earlier commit 
(r1181) broke loadForClass(..) by repeatedly looking at the property 
descriptors for the bean type instead of each superclass as it climbs the 
hierarchy. Fixed here. . I can't say which is correct, but they definitely 
differ. This new behavior of not returning null seems to work well enough for 
both cases. 

Anyway, I will continue trying to pin the problem down... just wondering if Ben 
or anyone else would know what might be changing the introspector cache.  It 
should always return Short - it always does after startup, but after a period 
of time / activity, it changes its mind and starts returning serializable.  I 
have to say this is one of the most bizarre issues I've ever been up against =) 
.. no worries

Thanks,
John



-Original Message-
From: Gérald Quintana [mailto:gerald.quint...@gmail.com] 
Sent: Thursday, May 05, 2011 3:37 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Strange introspection issue after upgrade to 1.5.2

Hello,

The ~30min delay may be a clue. Does it match your HTTP Session timeout 
(30min by default on Tomcat) ? You could control what's being stored in your 
HTTP Session...

Gérald

2011/5/4 Newman, John W newma...@d3onc.com:
 No sir, just the core jar .. we're not really doing anything too 
 wild.. if anything the object hierarchy we have is a bit weird due to 
 jaxb generation.  But these same classes have always worked just fine.  
 Now after
 1.5.2 it works fine .. for a while then something happens to disturb it.



 net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation
 #fillInTypeInformation()



 one minute says java.lang.Short

 Same class, same field, next minute says java.lang.Serializable.



 We are not doing any crazy class reloading on the fly or anything like 
 that.  I know bean introspection is cached somewhere, but as far as I 
 know there is no background thread going on updating those results as 
 they should never change.



 Our class hierarchy is a bit wild like I said.



 public class TheBindingTarget extends AbstractCompositeKeyEntity {

    private Short id;   // initially this is detected as Short, at some 
 point it changes to Serializable.

    public Short getID()  { return this.ID; }

    public void setID(Short id)  { this.ID = id; }

 // other fields, not important

 }



 public abstract class AbstractCompositeKeyEntity extends 
 AbstractEntityShort {

    // overrides for equals and hashcode for a 3 part business key (ID, 
 version, revision)

 }



 public abstract class AbstractEntityPK extends Serializable

[Stripes-users] Strange introspection issue after upgrade to 1.5.2

2011-05-04 Thread Newman, John W
All,

We've been using jdk5 / jboss4.22 / stripes 1.5 in production, stable for a 
long time now.   We've decided it's about time to do some upgrades to jdk6 / 
jboss 5.  The classpath scanner in stripes 1.5 does not work on jboss 5, which 
was fixed in 1.5.2 as a result of 
http://www.stripesframework.org/jira/browse/STS-655

Ok so in addition to jdk / jboss upgrade, we have to upgrade stripes.jar.  Not 
a big deal.  Everything has gone smoothly, except for one remaining issue that 
is about as bizarre as it gets.  The application starts up and runs fine.  But, 
if you leave it sit idle for a period of time, say ~30 minutes, sometimes, the 
bean introspection results will somehow change.  This doesn't make a whole lot 
of sense to me, but it's what we're seeing.

After startup, DefaultActionBeanPropertyBinder says this one field is of type 
java.lang.Short (which it is), it will take a value and bind into that no 
problem.  You can click around all you want and everything is good.  Now, ~30 
minutes of idle time go by, all of a sudden DefaultActionBeanPropertyBinder now 
decides to say this same field is of type java.lang.Serializable, foolishly 
tries to do new Serializable(value); and fails.  I can't explain why that 
result would change over time.

Might we be running into a regression that came from the changes in 
http://www.stripesframework.org/jira/browse/STS-664  also in 1.5.2 ?   That's 
the only thing I'm seeing related to introspection.  Because this is such a 
weird issue, I'm not even sure if it's stripes related.  We are working on 
narrowing it down and continuing to research, but I thought I'd ask here first. 
 Unfortunately I can't run 1.5 in jboss5, but we are trying 1.5.2 in jboss4 
right now (I suspect this will still show the issue).

  Is there any reasonable explanation for that change causing the result to say 
java.lang.Short one minute, and java.lang.Serializable the next?  Has 
anyone else ran into this?


Thanks in advance for any ideas.
-John
--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Strange introspection issue after upgrade to 1.5.2

2011-05-04 Thread Newman, John W
No sir, just the core jar .. we’re not really doing anything too wild.. if 
anything the object hierarchy we have is a bit weird due to jaxb generation.  
But these same classes have always worked just fine.  Now after 1.5.2 it works 
fine .. for a while then something happens to disturb it.

net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation 
#fillInTypeInformation()

one minute says java.lang.Short
Same class, same field, next minute says java.lang.Serializable.

We are not doing any crazy class reloading on the fly or anything like that.  I 
know bean introspection is cached somewhere, but as far as I know there is no 
background thread going on updating those results as they should never change.

Our class hierarchy is a bit wild like I said.

public class TheBindingTarget extends AbstractCompositeKeyEntity {
   private Short id;   // initially this is detected as Short, at some point it 
changes to Serializable.
   public Short getID()  { return this.ID; }
   public void setID(Short id)  { this.ID = id; }
// other fields, not important
}

public abstract class AbstractCompositeKeyEntity extends AbstractEntityShort {
   // overrides for equals and hashcode for a 3 part business key (ID, version, 
revision)
}

public abstract class AbstractEntityPK extends Serializable  implements 
EntityPK {
   // equals and hashcode for 1 part key, ID
}

public interface EntityPK extends Serializable extends Serializable  {
   PK getID();
   void setID(PK id);
}

The uppercase of “ID” comes from jaxb generated classes, which come from 
someone else’s xsd that I cannot control.  I don’t think the case is an issue 
however.  Given the nature of that hierarchy with generics and all that, I can 
understand how the “get type” code could be slightly thrown off for this case 
given the complexity going on in there.  However, it should be giving the same 
result every time – not changing from one minute to the next right?

-John

From: Samuel Santos [mailto:sama...@gmail.com]
Sent: Wednesday, May 04, 2011 11:35 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Strange introspection issue after upgrade to 1.5.2

Hi John,

Do you use any Stripes extension/plugin?

Cheers,

--
Samuel Santos
http://www.samaxes.com/

On Wed, May 4, 2011 at 3:24 PM, Newman, John W 
newma...@d3onc.commailto:newma...@d3onc.com wrote:
All,

We’ve been using jdk5 / jboss4.22 / stripes 1.5 in production, stable for a 
long time now.   We’ve decided it’s about time to do some upgrades to jdk6 / 
jboss 5.  The classpath scanner in stripes 1.5 does not work on jboss 5, which 
was fixed in 1.5.2 as a result of 
http://www.stripesframework.org/jira/browse/STS-655

Ok so in addition to jdk / jboss upgrade, we have to upgrade stripes.jar.  Not 
a big deal.  Everything has gone smoothly, except for one remaining issue that 
is about as bizarre as it gets.  The application starts up and runs fine.  But, 
if you leave it sit idle for a period of time, say ~30 minutes, sometimes, the 
bean introspection results will somehow change.  This doesn’t make a whole lot 
of sense to me, but it’s what we’re seeing.

After startup, DefaultActionBeanPropertyBinder says this one field is of type 
java.lang.Short (which it is), it will take a value and bind into that no 
problem.  You can click around all you want and everything is good.  Now, ~30 
minutes of idle time go by, all of a sudden DefaultActionBeanPropertyBinder now 
decides to say this same field is of type java.lang.Serializable, foolishly 
tries to do new Serializable(“value”); and fails.  I can’t explain why that 
result would change over time.

Might we be running into a regression that came from the changes in 
http://www.stripesframework.org/jira/browse/STS-664  also in 1.5.2 ?   That’s 
the only thing I’m seeing related to introspection.  Because this is such a 
weird issue, I’m not even sure if it’s stripes related.  We are working on 
narrowing it down and continuing to research, but I thought I’d ask here first. 
 Unfortunately I can’t run 1.5 in jboss5, but we are trying 1.5.2 in jboss4 
right now (I suspect this will still show the issue).

  Is there any reasonable explanation for that change causing the result to say 
“java.lang.Short” one minute, and “java.lang.Serializable” the next?  Has 
anyone else ran into this?


Thanks in advance for any ideas.
-John

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: [Stripes-users] Getting Array Index with Stripes Validations?

2011-01-19 Thread Newman, John W
There's probably a few different ways to do it, but you can always fall back to 
a custom validation method,

@ValidationMethod(when=ValidationState.ALWAYS, on={event1, event2})
public void validateEmails()  {
   if (lotsofemail != null)  {
for (int i = 0, n = lotsofemail.size(); i n; ++i)  {
  String email = lotsofemail.get(i);
  boolean isValid = emailTypeConverter.convert(email);
  if (isValid)  {

  } else  {
   invalidIndexes.add(i);
  invalidEmails.add(email);// maybe put these in 
somewhere else so they can easily correct and resubmit
  }
}
   }
}

Something like that, but there still might be a way to do it sticking with the 
annotations, idk.  I hope you're not amassing email addresses to spam people.  
`_´


-Original Message-
From: Derrick Williams [mailto:a...@derrickwilliams.com] 
Sent: Monday, January 17, 2011 10:03 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Getting Array Index with Stripes Validations?


I've begun using the Stripes @Validation feature and it's been fantastic. It's 
a lifesaver when Stripes intercepts all the multitudes of input errors and 
shunts it to my instance of handlesValidationErrors(), using the 
ValidationErrorHandler interface.
My EventHandler doesn't even get called. It's like it was never submitted. It 
saved me a lot of work. Priceless!

Life would be perfect in every way with Stripes Validations except for this one 
application I'm working on, which for boring reasons needs to handle errors the 
same way it did before I converted it to Stripes. I'll describe what I'm trying 
to do, and no doubt there's an infinitely better way to do it.

The application has a list of e-mails coming in, being checked by Stripes 
Validation:

@Validate(converter=EmailTypeConverter.class)
private ListString lotsofemail;


Our users work their fingers to the bone all day long typing in long lists of 
e-mail. Invariably they mistype one. No problem,
handleValidationErrors() has this under control, right?


@Override
public Resolution handleValidationErrors(ValidationErrors errors) throws 
exception{ ..


Almost - the application as it was written really wants to know which
index positions in ListString lotsofemail the mistyped e-mails are
in, so it can write an error message such as You typed a badly formed
e-mail on lines 4, 5, 9, 12 and so on.

The index the error occurred in in 'lotsofemail' doesn't seem to be
available (or is it?). To compound my woes, 'lotsofemail' has been
scrubbed of invalid e-mails by the time it reaches
handleValidationErrors. It now just contains the correctly formatted
e-mails. 

Not complaining here, in any other situation this would be a GOOD thing,
but my goal is to find out which position the incorrect e-mail is in. I
can find the actual mistyped e-mail using the 'getFieldValue()' function
from the ValidationError collection, but no obvious way to simply search
through the original 'lotsofemail' list to deduct its original position.
The bad e-mails have been removed, and likewise any information about
its original index value is gone.

Ok! Not giving up, maybe I can prevent 'lotsofemail' from being
scrubbed. I try extending EmailTypeConverter in this Wil E. Coyote sort
of way:


public class MyEmailTypeConverter extends EmailTypeConverter {

  EmailTypeConverter therealconverter;

  public MyEmailTypeConverter(){
therealconverter = new EmailTypeConverter()
  }

  public String convert(String input, Class? extends String
targetType, CollectionValidationError errors{

  therealconverter.convert(input,targetType,errors);

  return Bad Email: +input;

  }

}



My extension *is* working, but not the way I expect. 'lotsofemail' is
still scrubbed of bad e-mails, and now it has entries like Bad Email:
g...@email.com. How does it even do that? Spooky!

So I hope I've given enough detail about my clumsy hacks to try to get
the information I want. Given a List of validated input types, how can
I tell the index values of that original list containing the invalidated
data?

Thanks again!

-Derrick


--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 

[Stripes-users] Disabling the flash scope feature?

2011-01-13 Thread Newman, John W
Hi,

This morning I've been debugging a bad date format pattern, so I've got a break 
point in java.text.DateFormat.parse(String) to see which pattern is allowing 
invalid dates through.  When I initially load up the first page, I see this 
break point getting hit about 20 times even though there should be no date 
parsing that I am aware of, this is a blank GET request to the home page.  The 
stack is showing:

Daemon Thread [ajp-localhost%2F127.0.0.1-8009-1] (Suspended (breakpoint at line 
335 in DateFormat))
SimpleDateFormat(DateFormat).parse(String) line: 335
FastHttpDateFormat.internalParseDate(String, DateFormat[]) 
line: 191
FastHttpDateFormat.parseDate(String, DateFormat[]) line: 166
Request.getDateHeader(String) line: 183   not sure how this 
one is implemented - it calls parse date on every header/parameter in the 
request, so that's really where the penalty is.   
RequestFacade.getDateHeader(String) line: 632
FlashRequest.init(HttpServletRequest) line: 134
FlashRequest.replaceRequest(HttpServletRequest) line: 81
FlashScope.completeRequest() line: 165
StripesFilter.flashOutbound(HttpServletRequest) line: 308
StripesFilter.doFilter(ServletRequest, ServletResponse, 
FilterChain) line: 255
DynamicMappingFilter.doFilter(ServletRequest, ServletResponse, 
FilterChain) line: 350
ApplicationFilterChain.internalDoFilter(ServletRequest, 
ServletResponse) line: 235

So the stripes flash scope is doing something that is actually taking a 
considerable amount of time.  (each one of those 20+ failed date parse attempts 
throws an exception, which adds up to be expensive.)   This application is not 
using flash scope anywhere, so I'd like to disable this piece entirely.  
Looking at the code for stripes filter, I just see:

// Execute the rest of the chain
flashInbound(httpRequest);
filterChain.doFilter(httpRequest, servletResponse);

and

finally {
// reset the flag that indicates if this is the initial invocation
if (initial) {
initialInvocation.set(true);
flashOutbound(httpRequest);

// Once the request is processed, take the Configuration back 
out of thread local
StripesFilter.configurationStash.remove();
}

So I don't think there is an existing way to avoid the flash scope.  Is there a 
clever way to disable that?  If not, could we add a configuration flag to do so:

// Execute the rest of the chain
if (configuration.isFlashScopeIsEnabled())  { // default = true
  flashInbound(httpRequest);
}
filterChain.doFilter(httpRequest, servletResponse);

finally {
// reset the flag that indicates if this is the initial invocation
if (initial) {
initialInvocation.set(true);
if (configuration.isFlashScopeEnabled())  {
flashOutbound(httpRequest);
}

// Once the request is processed, take the Configuration back 
out of thread local
StripesFilter.configurationStash.remove();
}

And wherever else flash scope related bits are invoked would be blocked by this 
setting as well.  I'm imaginging there are other places involved I could 
disable as well. Any thoughts?  Should I look at using flash scope because I'm 
missing how powerful it is?  (I haven't seen a need for it yet).

-John

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Disabling the flash scope feature?

2011-01-13 Thread Newman, John W
 Stripes uses the flash scope implicitly

Right, I was thinking that might be the case.  So even if I'm not deliberately 
using it, I am actually using it and can't disable it.  That's fine - so 
nevermind about the disable feature.

But this doesn't look very good, see the FlashRequest constructor: 

   /**
 * Creates a new FlashRequest by copying all appropriate attributes from 
the prototype
 * request supplied.
 *
 * @param prototype the HttpServletRequest to create a disconnected copy of
 */
@SuppressWarnings({ unchecked, deprecation })
public FlashRequest(HttpServletRequest prototype) {
 .  snip . 
// copy headers
for (String key : Collections.list((EnumerationString) 
prototype.getHeaderNames())) {
headers.put(key, Collections.list(prototype.getHeaders(key)));
try {
dateHeaders.put(key, prototype.getDateHeader(key));
}   catch (Exception e) {
}
}
// copy locales
locales = Collections.list(prototype.getLocales());
// copy parameters
parameters.putAll(prototype.getParameterMap());
}  

Maybe we can do better there.  Can we add a specific set of header names that 
can be converted to dates, instead of blindly trying to convert every single 
header to a date which results in many many exceptions occurring and being 
suprressed.  If you can prevent an exception with a simple if check, it is far 
less expensive to do that first instead of letting it occur and catching it.  
Right?

 patch
private static final SetString possibleDateHeaders = new HashSetString();
static  {
   possibleDateHeaders.add(Date);
   possibleDateHeaders.add(If-Modified-Since);
 ...  see http://en.wikipedia.org/wiki/List_of_HTTP_header_fields 
}

... if (possibleDateHeaders.contains(key))  {
try  {
   dateHeaders.put(key, prototype.getDateHeader(key));
} catch (IllegalArgumentException e)  {
 // should no longer occur since we only call when it 
will succeed.  Right?
}
}

That would eliminate the issue I saw this morning, all this extra failed date 
parsing on things like the content-type header etc.

-J

-Original Message-
From: Freddy Daoud [mailto:xf2...@fastmail.fm] 
Sent: Thursday, January 13, 2011 11:54 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Disabling the flash scope feature?

Hi John,

 Should I
 look at using flash scope because I’m missing how powerful it is?  (I 
 haven’t seen a need for it yet).

Well, it's not so much that you would use the flash scope directly, but it is 
used implicitly in some useful ways. One common example that comes to mind is 
when you submit a form that saves some data to the database. Afterwards, you 
want to do a redirect (to avoid resubmitting the form on a browser refresh) and 
you want to show some kind of the data has been saved message on the page. 
You would use a Stripes message and stripes:messages/ for that.
Stripes uses the flash scope implicitly to make the messages survive the 
additional request done by the redirect.

Cheers,
Freddy

--
Protect Your Site and Customers from Malware Attacks Learn about various 
malware tactics and how to avoid them. Understand malware threats, the impact 
they can have on your business, and how you can protect your company and 
customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Disabling the flash scope feature?

2011-01-13 Thread Newman, John W
No this would be very minor.  It may not even be worth making the change I 
outlined below if you're not comfortable.  It certainly would save several ms 
when running however - lots of unnecessary exceptions are being thrown, and 
each one by itself is expensive enough.

I'm not sure yet if its ever running when it's not supposed to.  I'll keep a 
breakpoint around and if I can pin down a way it runs through that unexpectedly 
I'll revive the thread.  And if that happens you'd probably have to make a 
change at a higher stack frame than the one I noted below =)

From: Ben Gunter [mailto:gunter...@gmail.com]
Sent: Thursday, January 13, 2011 12:55 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Disabling the flash scope feature?

Probably the better thing to do would be to parse the string in 
getDateHeader(..) instead. When I did it the way I did it, I just figured I'd 
let the container handle the parsing ahead of time so I'd have less chance of 
screwing it up. Since Stripes and Tomcat have the same license, I can just lift 
the code directly from Tomcat.

Out of curiosity, is this really that much of a problem? It should only execute 
if you're intentionally (whether directly or indirectly) using flash scope, so 
it should be infrequent. If this is executing at a time when you're not 
explicitly putting something in flash and you're not adding messages then 
redirecting, then that's a problem that needs to be investigated.

-Ben
On Thu, Jan 13, 2011 at 12:23 PM, Newman, John W 
john.new...@viaoncology.commailto:john.new...@viaoncology.com wrote:
 Stripes uses the flash scope implicitly
Right, I was thinking that might be the case.  So even if I'm not deliberately 
using it, I am actually using it and can't disable it.  That's fine - so 
nevermind about the disable feature.

But this doesn't look very good, see the FlashRequest constructor:

  /**
* Creates a new FlashRequest by copying all appropriate attributes from the 
prototype
* request supplied.
*
* @param prototype the HttpServletRequest to create a disconnected copy of
*/
   @SuppressWarnings({ unchecked, deprecation })
   public FlashRequest(HttpServletRequest prototype) {
 .  snip .
   // copy headers
   for (String key : Collections.list((EnumerationString) 
prototype.getHeaderNames())) {
   headers.put(key, Collections.list(prototype.getHeaders(key)));
   try {
   dateHeaders.put(key, prototype.getDateHeader(key));
   }   catch (Exception e) {
   }
   }
   // copy locales
   locales = Collections.list(prototype.getLocales());
   // copy parameters
   parameters.putAll(prototype.getParameterMap());
   }

Maybe we can do better there.  Can we add a specific set of header names that 
can be converted to dates, instead of blindly trying to convert every single 
header to a date which results in many many exceptions occurring and being 
suprressed.  If you can prevent an exception with a simple if check, it is far 
less expensive to do that first instead of letting it occur and catching it.  
Right?

 patch
private static final SetString possibleDateHeaders = new HashSetString();
static  {
  possibleDateHeaders.add(Date);
  possibleDateHeaders.add(If-Modified-Since);
 ...  see http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
}

... if (possibleDateHeaders.contains(key))  {
   try  {
  dateHeaders.put(key, prototype.getDateHeader(key));
   } catch (IllegalArgumentException e)  {
// should no longer occur since we only call when it 
will succeed.  Right?
   }
}

That would eliminate the issue I saw this morning, all this extra failed date 
parsing on things like the content-type header etc.

-J

-Original Message-
From: Freddy Daoud [mailto:xf2...@fastmail.fmmailto:xf2...@fastmail.fm]
Sent: Thursday, January 13, 2011 11:54 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Disabling the flash scope feature?

Hi John,

 Should I
 look at using flash scope because I'm missing how powerful it is?  (I
 haven't seen a need for it yet).

Well, it's not so much that you would use the flash scope directly, but it is 
used implicitly in some useful ways. One common example that comes to mind is 
when you submit a form that saves some data to the database. Afterwards, you 
want to do a redirect (to avoid resubmitting the form on a browser refresh) and 
you want to show some kind of the data has been saved message on the page. 
You would use a Stripes message and stripes:messages/ for that.
Stripes uses the flash scope implicitly to make the messages survive the 
additional request done by the redirect.

Cheers,
Freddy

--
Protect Your Site and Customers from Malware Attacks Learn about various 
malware tactics and how to avoid them. Understand malware threats, the impact 
they can have on your

Re: [Stripes-users] UrlBinding to /

2010-12-29 Thread Newman, John W
Did you look at dynamic mapping filter at all?

Leave your web.xml as is, just paste this in

filter
filter-nameDynamicMappingFilter/filter-name

filter-classnet.sourceforge.stripes.controller.DynamicMappingFilter/filter-class
/filter
filter-mapping
filter-nameDynamicMappingFilter/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherFORWARD/dispatcher
dispatcherINCLUDE/dispatcher
/filter-mapping

And 
@UrlBinding(/)
public class Home extends AbstractActionBeanActionBeanContext  {

should work fine.  Before DMF was added, I would do

welcome-file-list
welcome-fileHome.action/welcome-file
/welcome-file-list

And make an empty file named Home.action next to WEB-INF... there's a thread on 
this in the list archives if you dig.  It worked, but I didn't measure 
performance.  Really if we were to have a serious conversation about ways to 
improve performance, it would be a very very long discussion, with a lot to say 
about the overuse of reflection.

-Original Message-
From: Janne Jalkanen [mailto:janne.jalka...@ecyrd.com] 
Sent: Wednesday, December 29, 2010 6:27 AM
To: Stripes Users List
Subject: Re: [Stripes-users] UrlBinding to /

Folks,

to follow up on this, it seems that the simplest way to accomplish an 
URLBinding to / is to create an /index.jsp -file which has the following 
contents:

%@ page language=java contentType=text/html; charset=UTF-8
pageEncoding=ISO-8859-1%
%
//
//  We just simply redirect to the proper actionbean.
//

request.getRequestDispatcher( /action/mybean ).forward(request,response); 
%

Also ensure that index.jsp is in your welcome-file-list.

There seems to be no more performance penalty on Tomcat 6, oddly enough. You'll 
just need to be careful that you have your Servlet Filters mapped properly in 
web.xml, since RequestDispatcher.forward() does not rerun the filter chain. 
(FWIW, I tried setting up REQUEST and FORWARD dispatchers for StripesFilter, 
but got very quickly into infinite loops, which were severely detrimental to 
the performance of my web site. So just map the filters you need properly for 
*.jsp and you should be fine.)

This change alone bumped my Yottaa score up by 10 notches compared to just 
blindly mapping action/mybean as a welcome-file. :-)

/Janne

On 29 Dec 2010, at 00:31, Janne Jalkanen wrote:

 Hi folks!
 
 I need to map the root of my site to a particular ActionBean. Now, the simple 
 way to do this is of course to use a welcome-file-list in web.xml (Tomcat 
 6.0.x):
 
 welcome-file-list
  welcome-fileaction/mybean/welcome-file
 /welcome-file-list
 
 but unfortunately this carries a fairly heavy performance penalty: compared 
 to accessing action/mybean directly, the performance on EC2 Large instances 
 is up to 100ms slower - and I'm seeing a definite bump in CPU usage as well 
 (about 5x of what I would use normally). On my local OSX box the difference 
 isn't that bad, but I'm still seeing it, especially the CPU usage. There's no 
 considerable IO.
 
 So it seems that the welcome-file solution is less than ideal in my 
 environment, and before I go and start ripping the guts out of it (or worse, 
 changing my production environment), I'm wondering if there's a simple and 
 clean way to resolve this the Stripes way. I see 
 http://stripesframework.org/jira/browse/STS-688 has some discussion.
 
 Would a custom Servlet Filter be the best solution here? If so, then how 
 would I invoke a particular ActionBean from it?
 
 (Here's the interesting part - it's slightly *faster* to have an 
 index.jsp redirecting with 302 to /action/mybean than have the 
 /action/mybean as the welcome-file. However, I want to steer away from 
 redirects, since 1) I want clean URLs, and 2) redirects can be quite 
 bad for performance, especially on mobile networks. And 3) it bothers 
 me that this should really be faster than have an extra redirect 
 loop... I'm wondering if having an ActionBean as a welcome-file 
 somehow confuses Tomcat when the file does not exist physically.)
 
 /Janne


--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers to 
consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database without 
downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 

Re: [Stripes-users] Different Types of Messages

2010-12-01 Thread Newman, John W
We've found that the message tag is really too generic to be useful.  Making 
it a little more flexible might be helpful for some particular use case, but 
it's not going to be able to cover everything.  IMO this is something better 
done on a per-case basis by the client code and the entire feature should be 
bagged from stripes.

private ListString errorMessages;
private ListString warningMessages;
private ListMessage randomMessages;
private MapString, Message messagesAreBestLeftUpToTheClientDeveloper;

The message feature as it stands today is so simple it is about the same amount 
of work to do it yourself.  Set some state in the current action bean or 
context, and use your own jsp tagfile or freemarker macro to pull and render 
them in the same spirit of the stripes:messages / tag, however complex you 
need to go.  Obviously I don't think we'll see the feature cut for backwards 
compatibility reasons, but I don't think enhancing it to support X but not Y 
and Z is that good of an idea


-Original Message-
From: Iwao AVE! [mailto:haraw...@gmail.com] 
Sent: Tuesday, November 30, 2010 10:11 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Different Types of Messages

Hi Nikolaos,

The 'key' attribute of MessageTag might help.

- StripesResources.properties
stripes.messages.header=div class=message stripes.messages.beforeMessage= 
stripes.messages.afterMessage= stripes.messages.footer=/div

- JSP (I would make it a tag file)
div class=info
stripes:messages key=info /
/div
div class=warn
stripes:messages key=warn /
/div

- CSS
div.info div.message {
...
}
div.warn div.message {
...
}

- ActionBean
// add info
getContext().getMessages(info).add(Information);
// add warn
getContext().getMessages(warn).add(Warning!);

--
And here's the doc:
http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/ActionBeanContext.html#getMessages(java.lang.String)

Hope this helps,
Iwao

on 10/11/30 5:54 Nikolaos Giannopoulos said the following:
 Hi,
 
 So in Stripes we can display messages OR errors to users and 
 everything seems OK.
 Editing the resource file makes in tandem with CSS appears to work well.
 
 However, what if one wants to display different types of messages for 
 users like a Warning and Ok (checkmark)?
 
 e.g. checkmark-icon  Your article was saved
 e.g. warn-icon  The language of this Article is English however you 
 have selected Spanish
 
 Is this possible with Stripes?
 
 --Nikolaos

--
Increase Visibility of Your 3D Game App  Earn a Chance To Win $500!
Tap into the largest installed PC base  get more eyes on your game by 
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Increase Visibility of Your 3D Game App  Earn a Chance To Win $500!
Tap into the largest installed PC base  get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Preventing multiple form submission

2010-11-16 Thread Newman, John W
I'm wondering why the stripes form tag and stripes filter don't provide this 
automatically.  It seems like everyone rolls their own version of this, and if 
they haven't yet they will eventually, since without such a check the 
application is easy to break.

I think this would be a good feature for stripes-stuff or stripes core even.  I 
believe a lot of other web frameworks offer this right out of the box, and tout 
it as a useful and necessary feature, which it is.  Am I wrong?  I know the 
trend is to say NO to features and bloat, I agree with that generally, but 
this topic comes up a lot.  It could be a big deal to force everyone to 
implement a new interface or something for handling the failure case, maybe a 
generic validation error could be used, idk.

-Original Message-
From: Oscar Westra van Holthe - Kind [mailto:os...@westravanholthe.nl] 
Sent: Tuesday, November 16, 2010 10:35 AM
To: nikol...@brightminds.org; Stripes Users List
Subject: Re: [Stripes-users] Preventing multiple form submission

On 16-11-2010 at 10:17, Nikolaos Giannopoulos wrote:
 Just wondering how others elegantly solve this situation:
 
 1) User is editing a form and fills it out and clicks submit button
 2) Form gets successfully processed on the server however before a 
 response is returned the user hits the stop button, their internet 
 connection drops, etc...
 4) User clicks on submit again and tries to re-submit the same
 information(*)
 
 Now, this would be trivial if there was a unique piece of information 
 in the content being posted however lets assume someone posting some 
 blog / news content wherein there is really no unique info (e.g. 
 although it may be rare there is nothing wrong with 2 people say 
 posting the same content with the same title).
 
 I was thinking to tag the users session with the last successfully 
 submitted Stripes _sourcePage field and direct the user to the view
 handler if they are trying to do an edit and the _sourcePagematches.
 
 Thoughts???

It is always possible to render a hidden field nonce with a bit of opaque 
information (like a random long, hex-encoded), that is also stored in the 
session. Generally, you get a flow like this:
- A form is prepared
- Generate a few random bytes (e.g. a long, anf hex-encode it)
- Store the value in the session
- Display the form, including a hidden field nonce with the generated value 
...
- When receiving a request that's not intended for a default handler, check
  the field nonce:
  - If it isn't present, give an error
  - If it is present but doesn't match the value in the session, present an
error message this form has already been submitted, and re-display the
form or the detail page
  - Otherwise the nonce is present and matches the stored value: perfect
- Unless there is an error (see above), proceed as usual

As a variation you may generate a nonce per form or form/record combination to 
explicitly allow people to edit multiple things at once.

Also, given that I match on default handler or not, it is perfectly possible 
to handle this using an interceptor and custom form tag. The first check upon 
submit forced the use of the custom tag, so there will be no omissions there.


Oscar

-- 
   ,-_  Oscar Westra van Holthe - Kind  http://www.xs4all.nl/~kindop/
  /() )
 (__ (  Inequality is the inevitable consequence of liberty.
=/  ()  -- Salvador De Madariaga - Anarchy or Hierarchy (1937)

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Preventing multiple form submission

2010-11-16 Thread Newman, John W
Cool, struts is one but there's a lot of others that provide it.  I wasn't 
necessarily saying stripes needs this to do this now, just trying to get the 
idea out there for some discussion. 

If it would end up being a bunch of bloat and extra burden on the developer, 
forget it; but if we can provide appropriate configuration and offload this 
thing that every app should have anyway, then why not.  Is the token 
universally good for any http based application or am I missing something?  Any 
reason you would NOT want this feature in your app? Obviously it could be 
flagged disabled, possibly even by default.


-Original Message-
From: Stone, Timothy [mailto:tst...@barclaycardus.com] 
Sent: Tuesday, November 16, 2010 2:11 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Preventing multiple form submission

Struts 1.x provides this functionality... 
@see org.apache.struts.action.Action#saveToken(HttpServletRequest
request),
@see org.apache.struts.action.Action#resetToken(HttpServletRequest
request),
@see org.apache.struts.action.Action#isTokenValid(HttpServletRequest
request)

It's described in /Struts in Action/ as a synchronizing token and automatically 
provided in the html:form ... and html:link ... tags.
If the action is using tokens, an appropriate hidden field is generated.

Regards,
Tim

PS... I'm only just saying. Not suggesting that Stripes want to do this in 
core. :)

-Original Message-
From: Newman, John W [mailto:john.new...@viaoncology.com]
Sent: Tuesday, November 16, 2010 1:35 PM
To: Stripes Users List; nikol...@brightminds.org
Subject: Re: [Stripes-users] Preventing multiple form submission

I'm wondering why the stripes form tag and stripes filter don't provide this 
automatically.  It seems like everyone rolls their own version of this, and if 
they haven't yet they will eventually, since without such a check the 
application is easy to break.



I think this would be a good feature for stripes-stuff or stripes core even.  I 
believe a lot of other web frameworks offer this right out of the box, and tout 
it as a useful and necessary feature, which it is.  Am I wrong?  I know the 
trend is to say NO to features and bloat, I agree with that generally, but 
this topic comes up a lot.  It could be a big deal to force everyone to 
implement a new interface or something for handling the failure case, maybe a 
generic validation error could be used, idk.

-Original Message-
From: Oscar Westra van Holthe - Kind [mailto:os...@westravanholthe.nl]
Sent: Tuesday, November 16, 2010 10:35 AM
To: nikol...@brightminds.org; Stripes Users List
Subject: Re: [Stripes-users] Preventing multiple form submission

On 16-11-2010 at 10:17, Nikolaos Giannopoulos wrote:
 Just wondering how others elegantly solve this situation:
 
 1) User is editing a form and fills it out and clicks submit button
 2) Form gets successfully processed on the server however before a 
 response is returned the user hits the stop button, their internet 
 connection drops, etc...
 4) User clicks on submit again and tries to re-submit the same
 information(*)
 
 Now, this would be trivial if there was a unique piece of information 
 in the content being posted however lets assume someone posting some 
 blog / news content wherein there is really no unique info (e.g.
 although it may be rare there is nothing wrong with 2 people say 
 posting the same content with the same title).
 
 I was thinking to tag the users session with the last successfully 
 submitted Stripes _sourcePage field and direct the user to the
view
 handler if they are trying to do an edit and the
_sourcePagematches.
 
 Thoughts???

It is always possible to render a hidden field nonce with a bit of opaque 
information (like a random long, hex-encoded), that is also stored in the 
session. Generally, you get a flow like this:
- A form is prepared
- Generate a few random bytes (e.g. a long, anf hex-encode it)
- Store the value in the session
- Display the form, including a hidden field nonce with the generated value 
...
- When receiving a request that's not intended for a default handler, check
  the field nonce:
  - If it isn't present, give an error
  - If it is present but doesn't match the value in the session, present an
error message this form has already been submitted, and re-display the
form or the detail page
  - Otherwise the nonce is present and matches the stored value: perfect
- Unless there is an error (see above), proceed as usual

As a variation you may generate a nonce per form or form/record combination to 
explicitly allow people to edit multiple things at once.

Also, given that I match on default handler or not, it is perfectly possible 
to handle this using an interceptor and custom form tag. The first check upon 
submit forced the use of the custom tag, so there will be no omissions there.


Oscar

-- 
   ,-_  Oscar Westra van Holthe - Kind
http://www.xs4all.nl/~kindop/
  /() )
 (__ (  Inequality

Re: [Stripes-users] CryptoUtils standalone

2010-11-08 Thread Newman, John W
fork that one single class for your standalone app and re-implement the 
methods you use so that they don't call StripesFilter

Heh.  This is actually what I did...


Last, if you have a refactoring proposal for the class (to make the crypto 
feature independant of Stripes) that's worth it, we'll surely consider the 
option.

Would be nice.  The problem is the way the secret key is pulled from the 
web.xml.  Certainly there's a number of other ways of doing this, it would not 
be too hard to call a setter on startup instead (quick example below, this 
probably isn't much better).  StripesFilter.getConfiguration() is a bit 
overused across the board - it effectively ties each class to the servlet 
container, but I don't have any better suggestions at this time.


protected static byte[] getKeyMaterialFromConfig() {
-try {
-Configuration config = StripesFilter.getConfiguration(); //
-if (config != null) {
-String key = 
config.getBootstrapPropertyResolver().getProperty(CONFIG_ENCRYPTION_KEY);
-if (key != null) {
-return key.getBytes();
-}
-}
-}
-catch (Exception e) {
-log.warn(Could not load key material from configuration., e);
-}
-
-return null;
+ return CryptoUtil.keyMaterial; // passed to init method
}

DefaultConfiguration:
public void init()  {
+String key = 
getBootstrapPropertyResolver().getProperty(CONFIG_ENCRYPTION_KEY);
+if (key != null) {
+   CryptoUtil.init(key.getBytes());
+   }
}

From: VANKEISBELCK Remi [mailto:r...@rvkb.com]
Sent: Monday, November 08, 2010 4:24 AM
To: Stripes Users List
Subject: Re: [Stripes-users] CryptoUtils standalone

Hi Keith,

Sorry for the late reply.

What exactly are you trying to reuse ?

I'm just trying to understand. Stripes is supposed to handle the Web MVC part : 
if your application's logic is written in its tier, then it should not depend 
on Stripes. Your action beans usually just invoke your biz logic, that should 
be written in an independent module.

If you depend directly on CryptoUtils, then your best option is probably to . 
Using MockRoundtrip in a standalone app seems odd.

Last, if you have a refactoring proposal for the class (to make the crypto 
feature independant of Stripes) that's worth it, we'll surely consider the 
option.

Cheers

Remi
2010/11/4 Keith khyl...@bge.iemailto:khyl...@bge.ie
Hi,

We have a stripes web application.

We now wish to re-use some of the functionality of the web application in a
standalone java program without re-writing the code.

The problem we are facing is that the web-application uses the CryptoUtils
class to encrypt/ decript some values.

When this is run from a standalone program we get the error below.

Is it possible to use the CryptoUtil in standalone mode, perhaps by Mocking
certain objects, or injecting a Configuration instance.

Cheers,
Keith

ERROR: net.sourceforge.stripes.controller.StripesFilter -
net.sourceforge.stripes.exception.StripesRuntimeException: Something is trying
to access the current Stripes configuration but the current request was never
routed through the StripesFilter! As a result the appropriate Configuration
object cannot be located. Please take a look at the exact URL in your
browser's address bar and ensure that any requests to that URL will be filtered
through the StripesFilter according to the filter mappings in your web.xml.

   at
net.sourceforge.stripes.controller.StripesFilter.getConfiguration
(StripesFilter.java:161)
   at net.sourceforge.stripes.util.CryptoUtil.decrypt(CryptoUtil.java:181)
...




--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a
Billion shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book Blueprint to a 
Billion shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] How to get JSP output as a HTML stream for AJAX?

2010-10-11 Thread Newman, John W
Yes this is actually one thing that is very easy to do.  Just have an ajax 
updater function make a request to one of your event handler methods, and 
return a forward resolution to your jsp.  The jsp will surprisingly just get 
processed and inserted into your div. =)

Now if your event handler returns validation errors, that does not work at all, 
and you have to write a bunch of code to make it work.  Stripes really should 
do much better at that.

From: Mike McNally [mailto:emmecin...@gmail.com]
Sent: Monday, October 11, 2010 1:19 PM
To: Stripes Users List
Subject: Re: [Stripes-users] How to get JSP output as a HTML stream for AJAX?

That's quite possible, and extremely common. The server-side (Stripes) code 
really doesn't need to know that it's responding to an AJAX request; it just 
forwards to the JSP as usual. The client-side code just does exactly what you 
describe with the new content.

Using a client-side framework (Dojo, Prototype, jQuery, whatever) makes this 
considerably easier.

On Mon, Oct 11, 2010 at 12:12 PM, derrickaw 
a...@derrickwilliams.commailto:a...@derrickwilliams.com wrote:


I hope I'm not asking a dumb question or one that's been answered a hundred
times, I probably don't know the right search terms, but if anyone has any
pointers to answer my question it is gratefully accepted! I've been happily
using Stripes for the past few months, but I'm not sure if this is strictly
a Stripes question.

I am wondering if it's possible to render a JSP from within Javascript, such
as sending a request to the server and getting the rendered HTML stream
back, which I can dynamically display.

Here's how my current web page is set up:

div id=customerjsp:include page=/customer_info.jsp //div
div id=specsjsp:include page=/widget_specifications.jsp //div
div id=disclaim jsp:include page=/boring_legal_disclaimer.jsp
//div
div id=orderjsp:include page=/complicated_order_form.jsp //div


Changing one of these JSP files sometimes makes it necessary to change the
information on another JSP. I am doing an Ajax submit of the Stripes form,
which updates the database with no problem. However, the user display isn't
up to date.

I could do this easily with a servlet, getting all the HTML myself, but
bleh, all the JSPs are already written and they all work great. The JSPs are
fairly complex so it's not really feasible to write some Javascript to do
the updates without pretty much duplicating the entire JSP code in
Javascript.

So can I do this:

1) User updates their personal information in customer_info.jsp, database
updates (this step works A+)
2) Ajax Call: request complicated_order_form.jsp rendered into HTML, with
new db values
3) Dynamically put the received HTML into the innerHTML() of the order div

Again, apologies if this has been answered a million times, I tried to do my
homework, honest! On the other hand, if what I'm trying to do with the JSPs
is simply impossible, what other strategies might be better?

Thanks!

-Derrick

--
View this message in context: 
http://old.nabble.com/How-to-get-JSP-output-as-a-HTML-stream-for-AJAX--tp29935584p29935584.html
Sent from the stripes-users mailing list archive at Nabble.com.


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Turtle, turtle, on the ground,
Pink and shiny, turn around.
--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] How to get JSP output as a HTML stream for AJAX?

2010-10-11 Thread Newman, John W
Sure, I guess I should have said it depends.

If your stripes-errors tag and all potentially errored form fields are within 
the updating div, it works great.  But if your stripes-errors tag is outside of 
the updating div, it won't be updated with the new error messages.  *You have 
to catch that and issue a separate html update.  And if any fields are now in 
error outside of the div, you have to add the error css yourself.  In the 
applications I've written this is a common headache.

And yes, if you get a 400 or 500 error you'll need to handle that within the 
javascript as well.  Have fun with session timeouts.  =)  That's all expected, 
I just think stripes could do more with regards to ajax requests and validation 
errors (that don't already get rendered through the forward resolution itself).

From: Mike McNally [mailto:emmecin...@gmail.com]
Sent: Monday, October 11, 2010 1:34 PM
To: Stripes Users List
Subject: Re: [Stripes-users] How to get JSP output as a HTML stream for AJAX?

If the handler returns validation errors, the JSP can just include them into 
the response just like it would with an ordinary form post response.

Now, if there's an exception of some sort, then yes the client-side code would 
have to detect that.
On Mon, Oct 11, 2010 at 12:30 PM, Newman, John W 
john.new...@viaoncology.commailto:john.new...@viaoncology.com wrote:
Yes this is actually one thing that is very easy to do.  Just have an ajax 
updater function make a request to one of your event handler methods, and 
return a forward resolution to your jsp.  The jsp will surprisingly just get 
processed and inserted into your div. =)

Now if your event handler returns validation errors, that does not work at all, 
and you have to write a bunch of code to make it work.  Stripes really should 
do much better at that.

From: Mike McNally [mailto:emmecin...@gmail.commailto:emmecin...@gmail.com]
Sent: Monday, October 11, 2010 1:19 PM
To: Stripes Users List
Subject: Re: [Stripes-users] How to get JSP output as a HTML stream for AJAX?

That's quite possible, and extremely common. The server-side (Stripes) code 
really doesn't need to know that it's responding to an AJAX request; it just 
forwards to the JSP as usual. The client-side code just does exactly what you 
describe with the new content.

Using a client-side framework (Dojo, Prototype, jQuery, whatever) makes this 
considerably easier.

On Mon, Oct 11, 2010 at 12:12 PM, derrickaw 
a...@derrickwilliams.commailto:a...@derrickwilliams.com wrote:


I hope I'm not asking a dumb question or one that's been answered a hundred
times, I probably don't know the right search terms, but if anyone has any
pointers to answer my question it is gratefully accepted! I've been happily
using Stripes for the past few months, but I'm not sure if this is strictly
a Stripes question.

I am wondering if it's possible to render a JSP from within Javascript, such
as sending a request to the server and getting the rendered HTML stream
back, which I can dynamically display.

Here's how my current web page is set up:

div id=customerjsp:include page=/customer_info.jsp //div
div id=specsjsp:include page=/widget_specifications.jsp //div
div id=disclaim jsp:include page=/boring_legal_disclaimer.jsp
//div
div id=orderjsp:include page=/complicated_order_form.jsp //div


Changing one of these JSP files sometimes makes it necessary to change the
information on another JSP. I am doing an Ajax submit of the Stripes form,
which updates the database with no problem. However, the user display isn't
up to date.

I could do this easily with a servlet, getting all the HTML myself, but
bleh, all the JSPs are already written and they all work great. The JSPs are
fairly complex so it's not really feasible to write some Javascript to do
the updates without pretty much duplicating the entire JSP code in
Javascript.

So can I do this:

1) User updates their personal information in customer_info.jsp, database
updates (this step works A+)
2) Ajax Call: request complicated_order_form.jsp rendered into HTML, with
new db values
3) Dynamically put the received HTML into the innerHTML() of the order div

Again, apologies if this has been answered a million times, I tried to do my
homework, honest! On the other hand, if what I'm trying to do with the JSPs
is simply impossible, what other strategies might be better?

Thanks!

-Derrick

--
View this message in context: 
http://old.nabble.com/How-to-get-JSP-output-as-a-HTML-stream-for-AJAX--tp29935584p29935584.html
Sent from the stripes-users mailing list archive at Nabble.com.


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb

Re: [Stripes-users] Login page with AJAX

2010-09-28 Thread Newman, John W
Hi Andres,

Based on your email I'm not really sure what your question is.  Can you please 
clarify what your problem is and what you need to happen so someone can help?

También, algunos de nosotros hablan español

From: Andrés Martínez [mailto:andresml...@gmail.com]
Sent: Tuesday, September 28, 2010 2:54 PM
To: Stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Login page with AJAX

Hi,

I have a login.jsp page (user and password), the field validation is done with 
ajax, if there is any error message is displayed on div tag.

As I can redirect to login.jsp page home.jsp once the fields are correct.

Thanks
--
Andres M. Luna
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Login page with AJAX

2010-09-28 Thread Newman, John W
Bueno, hay un montón de maneras que usted puede hacer esto. Después de un 
tiempo, es posible que la pieza Ajax.Updater sin el uso de JSON es un poco 
limitado. Siempre usamos sólo Ajax.Request que devuelve un objeto json, que 
contiene propiedades similares a redirectURL o updateHTML, etc. Entonces la 
función onSuccess de la solicitud se ve en el json y actualiza el div, o 
redirecciones, o mostrar un diálogo de error, etc dependiendo de lo que está en 
el mapa json.

Básicamente, usted tendrá que agregar una función de éxito que es capaz de 
distinguir lo que pasó y es capaz de actuar de manera apropiada para cada tipo 
de resultado (los errores de validación, la excepción, la respuesta válida, 
etc.)

Esto realmente es un área donde creo que stripes podrían hacer más, que acaban 
de tener que escribir su propio código para que todo va correctamente. Usted 
puede desear mirar en Ajax.Responders.register({}) para configurar algún tipo 
de apoyo ajax mundial para su aplicación. También estamos en medio de zanjas 
prototipo en favor de jQuery y es mucho mejor en general, así que tal vez echa 
un vistazo a jQuery, si usted no ha oído hablar de él.


function invoke(form, event, container) {
  if (!form.onsubmit) { form.onsubmit = function() { return false } 
};
  var params = Form.serialize(form, {submit:event});
  new Ajax.Updater(container, form.action, {
method:'post',
parameters:params,
onSuccess: function(transport, json)  {
if (condition)   {  //  transport.response.responseText == 
)  {
window.location = target  //  'home.jsp' or 
json.redirectUrl etc;
}
}});
   }



From: Andrés Martínez [mailto:andresml...@gmail.com]
Sent: Tuesday, September 28, 2010 4:29 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Login page with AJAX

Hola John,

De antemano te agredezco tu ayuda, mi problema es el siguiente:

Tengo una página con login (/index.jsp) la cual válido con Ajax, en el 
ActionBean válido que los campos hayan sido capturados y que se encuentren en 
la DB, en caso de haber un error se escribe el mensaje en la página 
asincronamente. La funcion de JS que estoy usando es:

function invoke(form, event, container) {
  if (!form.onsubmit) { form.onsubmit = function() { return false } 
};
  var params = Form.serialize(form, {submit:event});
  new Ajax.Updater(container, form.action, {method:'post', 
parameters:params});
   }

y el llamado lo realizo en el evento onclick del stripes:image 
onclick=invoke(this.form, this.namehttp://this.name, 'result');

Mi duda es la siguiente, una vez que no existen errores que mostrar en la 
página de login, como puedo hacer para que automaticamente se cambie a la 
pagina de bienvenida (/home.jsp)

Saludos y gracias.
A.
On Tue, Sep 28, 2010 at 2:41 PM, Newman, John W 
john.new...@viaoncology.commailto:john.new...@viaoncology.com wrote:
Hi Andres,

Based on your email I'm not really sure what your question is.  Can you please 
clarify what your problem is and what you need to happen so someone can help?

También, algunos de nosotros hablan español

From: Andrés Martínez 
[mailto:andresml...@gmail.commailto:andresml...@gmail.com]
Sent: Tuesday, September 28, 2010 2:54 PM
To: 
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Login page with AJAX

Hi,

I have a login.jsp page (user and password), the field validation is done with 
ajax, if there is any error message is displayed on div tag.

As I can redirect to login.jsp page home.jsp once the fields are correct.

Thanks
--
Andres M. Luna

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Andrés M. Luna
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] The New Stripes Website - WAS: Re: Stripes Development and its Future... (this one is long too)

2010-09-02 Thread Newman, John W
I don't think stripes is dying, it's just matured and most people are still 
using it quietly.  Strange how what should be a home run for marketing is 
actually a big downside.   Activity has been a bit stagnant lately, but that 
doesn't mean the project is suddenly no good and you'll regret using it.

Can I volunteer to convert the project to use maven2 instead of ant?  

:-P

Seriously though I think that would be a good idea.  

The best thing I think this project could do at this point is get a some 
articles out there about the release of 1.6 with some new exciting features 
that you need to see, and publish some new things on the site like a couple 
videos and a new sample application.  A shorter release cycle would keep 
bringing new interest in.  Unfortunately that all takes time, that nobody 
really has.

If it's just two already full time devs working on it in the evenings after 
coding all day, what can you expect really...  I do want to volunteer somehow 
as I have some ideas and could help, but seriously I can rarely sit down and 
code at night after what I go through here every day.  (the headaches are NOT 
from stripes.. that's a stress free bit of our app =).  Do we have a talented 
unemployed coder somewhere that could contribute some serious hours to the 
project? HA.  I am open to donating as well.

-Original Message-
From: Aaron Porter [mailto:aa...@mongus.com] 
Sent: Thursday, September 02, 2010 2:45 PM
To: Stripes Users List
Subject: Re: [Stripes-users] The New Stripes Website - WAS: Re: Stripes 
Development and its Future... (this one is long too)

On 09/02/2010 10:19 AM, Dani Pardo wrote:
   I don't discard either providing financial support if needed for a 
 web designer. I think Freddy and Ben are the most active developers at 
 the moment (correct me if I'm wrong), so they should agree on how to 
 manage/delegate all this.
   Ideally, I think that the new website should come along with a new 
 tag that correct the major bugfixes there might be at the moment. I 
 agree that its features are complete, but there are always new things 
 to add. For example, in DynamicMappingFilter, can I use regexps?
   Regarding Freedy's comment, it should be cool to have rayures + 
 stripesstuff as a separate module to use.

   Btw (as a off-off-topic), when using stipersist/JPA, do we need an 
 OpenSessionInView filter, or everything just works out of the box? :)

 --
 Dani



No filter required for Stripersist. Once you get JPA set up correctly it should 
just work.

It's exciting to see so many people want to breathe new life into Stripes!

Aaron





--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Exception when setting object array properties

2010-06-08 Thread Newman, John W
Your shortList field is changing somehow as you loop over it.  Given that 
both the action bean and the jsp are both single threaded to the current 
request, it is probably not a real concurrency issue (unless you have a 
background thread and a singleton, which I doubt).

Anyway, perhaps your getter method, actionbean.getShortList()  has some logic 
in it that is changing the list and/or its contents?

I think you probably have

public ListT getShortList()  {
   ListT x  = findStuffFromDB_OrDoSomethingToProduceList();
   return x;
}

When essentially what you need is:

private ListT shortList;
public ListT getShortList()  {return this.shortList};
public Resolution yourEvent()  {
  shortList = findStuffFromDB_OrDoSomethingToProduceList();
  return new ForwardResolution(/WEB-INF/your-jsp.jsp);
}

Alternatively you could put the shortList= bit in an @Before method..   
Problems like this one are easy to troubleshoot by running your container in 
debug mode.  Also the howto on unit testing with MockRoundtrip is a really big 
time saver.


From: David Hamilton [mailto:dhamil...@hermitagelighting.com]
Sent: Tuesday, June 08, 2010 9:08 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Exception when setting object array properties

Hello,


I've tried several different ways to solve this issue but I keep getting a 
java.util.ConcurrentModificationException every time I try to loop over the 
properties of a bean. Here are the (hopefully) relevant code snipites:

In the JSP:

s:form beanclass=accounts.actions.ShowStatementActionBean

 c:forEach items=${actionBean.shortList} var=inv varStatus=loop

 tr  td${inv.line.invoiceNum}/td/tr

 trs:text name=shortList[${loop.index}]/s:text/tr

/c:forEach

/table

/s:form



The result is this exception:

WARNING: ApplicationDispatcher[/Public] PWC1231: Servlet.service() for servlet 
jsp threw exception

java.util.ConcurrentModificationException

at 
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)

at java.util.AbstractList$Itr.next(AbstractList.java:343)

at 
org.apache.taglibs.standard.tag.common.core.ForEachSupport$SimpleForEachIterator.next(ForEachSupport.java:149)

at 
org.apache.taglibs.standard.tag.common.core.ForEachSupport.next(ForEachSupport.java:171)

at 
javax.servlet.jsp.jstl.core.LoopTagSupport.doAfterBody(LoopTagSupport.java:326)

  



I'm fairly new to Stripes (and JSP development in general) so I'm sure it's 
something simple but I can't seem to figure out what..



Thanks,


David Hamilton
Web Coordinator
(615) 843-3337
Hermitage Lighting Gallery
www.hermitagelighting.comhttp://www.hermitagelighting.com


[cid:~WRD000.jpg]
Please do not print this e-mail unless necessary

Printing email can cost more than you think. Learn more on our website: 
http://www.hermitagelighting.com/printing_email.php

The information transmitted in this email is intended solely for the individual 
or entity to which it is addressed and may contain confidential and/or 
privileged material. Any review, retransmission, dissemination or other use of 
or taking action in reliance upon this information by persons or entities other 
than the intended recipient is prohibited. If you have received this email in 
error please immediately notify us by reply email to the sender. You must 
destroy the original material and its contents from any computer.

inline: ~WRD000.jpg--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Redirecting to url outside my application

2010-04-01 Thread Newman, John W
There is a direct way, see: 
http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/RedirectResolution.html#RedirectResolution%28java.lang.String,%20boolean%29

public 
RedirectResolution(Stringhttp://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true
 url,
  boolean prependContext)
Constructor that allows explicit control over whether or not the context path 
is prepended to the URL before redirecting.
Parameters:
url - the URL to which the user's browser should be re-directed.
prependContext - true if the context should be prepended, false otherwise

I myself have never used it but, return new 
RedirectResolution(http://www.google.com;, false); should do what you want.






From: Ben Gunter [mailto:gunter...@gmail.com]
Sent: Thursday, April 01, 2010 11:12 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Redirecting to url outside my application

There's no direct way to do it, but you can try this:

return new RedirectResolution() {
@Override
public String getUrl(Locale locale) {
return http://www.google.com/;;
}
};

-Ben
On Thu, Apr 1, 2010 at 10:54 AM, Ivan L. 
dukeofb...@gmail.commailto:dukeofb...@gmail.com wrote:
Hello, i want to redirect user from my action bean to other web site (and add
some parameters to url just like strings). How can I do that? Is it done by
Resolution at all?

For example:

public Resolution newOne() {
   return new SomeResolution(www.google.comhttp://www.google.com);
   }
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Security Concerns Binding Into Domain Model

2010-03-25 Thread Newman, John W
Yes, this is what the @StrictBinding annotation is for, have a look at that.

Problem solved =)

From: Caine Lai [mailto:caine...@gmail.com]
Sent: Thursday, March 25, 2010 2:14 PM
To: Stripes Users List
Subject: [Stripes-users] Security Concerns Binding Into Domain Model

I've been using Stripes for a couple of years now and love it.  However, I have 
recently been thinking about some security problems with binding directly into 
a domain model in action beans.  The problem is that Stripes will bind to 
properties even if there is no @Validate annotation on a field.

Imagine the following domain object, simplified for demonstration purposes:

public class User {

 private String role, email;

 public void setRole(String role) { this.role = role; }

 public String getRole() { return this.role }

 public void setEmail(String email) { this.email= email; }

 public String getEmail() { return this.email }
}

Now in my action bean, I use a user object for an update form and define some 
validators to it:

@ValidateNestedProperties({
@Validate(field = email, required = true, maxlength = 
ModelConstants.EMAIL_MAX_LENGTH, converter=EmailTypeConverter.class),
})
private User user;

public Resolution update() {
 user.merge();
}

Now if I am a regular user with the USER role, I can request the following 
url:  
http://www.someserver.com/context/action_mapping/update?user.email=someem...@somedomain.comrole=ADMIN

Now even though I do not specify a validator on the role field, Stripes will 
still bind to that field and the user has just elevated their privileges to 
ADMIN.  Again, simplified example but this could pose all kinds of security 
holes and problems in an application.

Is there a reason Stripes binds to properties even when there is no validator 
or type converter defined on the property?

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] UTF-8 Resource Bundles

2010-03-09 Thread Newman, John W
We ended up extending ResourceBundle to pull the properties from a database 
table and cache them internally.  class ApplicationPropertyT {String key, T 
value} ..

The main drawback is we can't use that bundle while booting the application, so 
there are a few low level bootstrap properties (mainly db connection) that 
still have to be stored in a file.  But I prefer this over the text file, since 
we can store unicode and the values can be edited and reloaded in real time.  
Eventually we'll have a UI for this.  With a regular file loaded from the 
classpath, if you need to fix a typo in a message you have to repackage, 
release, and restart (sometimes a 3 week ordeal for us :-x)Plus any client 
code still sees it as a regular old resource bundle so it is just a swappable 
implementation.



From: Ross Sargant [mailto:rsarg...@tvrc.com]
Sent: Tuesday, March 09, 2010 4:09 PM
To: Stripes Users List
Subject: Re: [Stripes-users] UTF-8 Resource Bundles

Freddy,
  I did see that...BUT.. what would I need to do to hookup fmt:setBundle/ and 
fmt:message to use XML based resource bundles? Is that even possible?

If I can't use fmt:message as is, I'll probably just implement my own XML 
driven mechanism?


On Tue, Mar 9, 2010 at 3:46 PM, Freddy Daoud 
xf2...@fastmail.fmmailto:xf2...@fastmail.fm wrote:
Another possibility is to use XML:

The loadFromXML(InputStream) and storeToXML(OutputStream, String,
String)
methods load and store properties in a simple XML format. By default the
UTF-8 character encoding is used, however a specific encoding may be
specified if required.

Source: http://java.sun.com/javase/6/docs/api/java/util/Properties.html

Cheers,
Freddy

On Tue, 9 Mar 2010 21:06:24 +0100, Simon Oxenvad Rasmussen
si...@ibill.dkmailto:si...@ibill.dk said:
 Hi Ross,



 I too had the issue some time back - my solution was to convert all the
 text
 into unicode charactes in the format \u using the following site
 http://itpro.cz/juniconv/ (it's a simple javascript for turing text into
 the
 \u format.).



 Paste the outcome back into your bundle and then save it again - making
 sure
 that it actually saves as a utf8 file (in eclipse: rightclick the file -
 properties and set encoding).



 I hope this helps.



 Fra: Ross Sargant [mailto:rsarg...@tvrc.commailto:rsarg...@tvrc.com]
 Sendt: 9. marts 2010 20:53
 Til: Stripes Users List
 Emne: [Stripes-users] UTF-8 Resource Bundles



 Hi,
   Does anybody know of a good solution for dealing with the fact that
   java
 property files only support ISO-8859-1 encoding?

 I would really prefer that I could have them be UTF-8 and work with them
 naturally in different languages (with no need to use the
 nativetoascii
 tool) or look at U codes in my files.

 I'm having trouble using the fmt:message tag with resource bundles that
 contain non-ascii unicode characters ( I get garbled output). Other UTF-8
 data displays without issue so page encoding, response encoding etc is
 all
 good.

 I *think* the problem is that java property files are assumed to be
 ISO-8859-1 encoded so the localized values aren't ready correctly from
 the
 file.

 Am I the only one that finds this hilarious considering that  property
 files
 are touted as the answer to internationalization?

 Appreciate any and all suggestions!



 --
 Ross Sargant
 Software Engineer
 p: 954-623-6015 x2108
 email: rsarg...@tvrc.commailto:rsarg...@tvrc.com

 TVR Communications LLC
 541 S. State Road 7,Suite 5,Margate, Florida,33068

 http://www.tvrc.com

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Ross Sargant
Software Engineer
p: 954-623-6015 x2108
email: rsarg...@tvrc.commailto:rsarg...@tvrc.com

TVR Communications LLC
541 S. State Road 7,Suite 5,Margate, Florida,33068

http://www.tvrc.com
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] UTF-8 Resource Bundles

2010-03-09 Thread Newman, John W
Well, the way this app is designed it all happens from user authentication.  We 
have a central security database and multiple organization databases.  So after 
a user is authenticated through the central db, we know which organization db 
to point to.  Each org db only has the proper locale messages in there.  To 
avoid duplication of non org specific settings/messages, we have a common db 
above them which is checked after the org specific lookup comes back with null. 
 This also allows orgs to override =)

But if we just had one big db, the handleGetObject() method would need a piece 
to find the current locale and point to a different bundle.Something like 
MapLocale, MapString, Object .  IDK, there are lots and lots of ways I 
could see this being solved.

There seems to be plenty of options if you fully control the access  retrieval 
of the bundle yourself.

That's the idea, we are essentially using our own entity beans for properties 
everywhere - we just had to build an adapter to the old ResourceBundle 
interface since that's what every library expects.  I can't see any advantage 
to using plain old property files for locale messages, just because that's what 
everybody does doesn't mean it's still the best way.  Messages and settings 
like that strike me as something that should be able to change on the fly.  If 
you can do whatever you want but provide an adapter so nobody knows the 
difference, it's win win.

 What I'm trying to find is a mechanism that would work with tags like 
fmt:message or  stripes:label and not require adding other widgetsgadgets 
(I've added enough of those on my own :) to retrieve values.

Yep, you might want to evaluate extending resource bundle.  The biggest 
roadblock would be ensuring whatever client code that is using your bundle is 
provided a reference to an instance of YourResourceBundleExtensionClass and not 
just a vanilla ResourceBundle through ResourceBundle.getBundle(someFileName). 
 Here's how I did it for stripes.  I am not using the jstl fmt anywhere, I 
imagine that might be more difficult to hook into.  Fortunately stripes had the 
foresight to allow apps to customize the instantiation of the bundle.

public class Configuration extends RuntimeConfiguration {
@Override
  protected LocalizationBundleFactory initLocalizationBundleFactory() {
return new LocalizationBundleFactory() {
  public ResourceBundle getErrorMessageBundle(Locale arg0)
  throws MissingResourceException {
return dbResourceBundle;// injected spring 
bean
  }

  public ResourceBundle getFormFieldBundle(Locale arg0)
  throws MissingResourceException {
return dbResourceBundle;
  }

  public void init(net.sourceforge.stripes.config.Configuration 
arg0)
  throws Exception {
  }
};
  }

Also,  spring does offer some enhancements around resource bundles, you may 
want to look there if you are already using spring.


From: Ross Sargant [mailto:rsarg...@tvrc.com]
Sent: Tuesday, March 09, 2010 4:40 PM
To: Stripes Users List
Subject: Re: [Stripes-users] UTF-8 Resource Bundles

Interesting suggestion.
How did you then display any localized values in the web layer or have you not 
had to do that?

There seems to be plenty of options if you fully control the access  retrieval 
of the bundle yourself.

What I'm trying to find is a mechanism that would work with tags like 
fmt:message or  stripes:label and not require adding other widgetsgadgets 
(I've added enough of those on my own :) to retrieve values.

Good point on reload issue though. Definitely a good reason to roll your own!


On Tue, Mar 9, 2010 at 4:26 PM, Newman, John W 
john.new...@viaoncology.commailto:john.new...@viaoncology.com wrote:
We ended up extending ResourceBundle to pull the properties from a database 
table and cache them internally.  class ApplicationPropertyT {String key, T 
value} ..

The main drawback is we can't use that bundle while booting the application, so 
there are a few low level bootstrap properties (mainly db connection) that 
still have to be stored in a file.  But I prefer this over the text file, since 
we can store unicode and the values can be edited and reloaded in real time.  
Eventually we'll have a UI for this.  With a regular file loaded from the 
classpath, if you need to fix a typo in a message you have to repackage, 
release, and restart (sometimes a 3 week ordeal for us :-x)Plus any client 
code still sees it as a regular old resource bundle so it is just a swappable 
implementation.



From: Ross Sargant [mailto:rsarg...@tvrc.commailto:rsarg...@tvrc.com]
Sent: Tuesday, March 09, 2010 4:09 PM
To: Stripes Users List
Subject: Re: [Stripes-users] UTF-8 Resource Bundles

Freddy,
  I did see that...BUT.. what would I need to do

Re: [Stripes-users] When is the HTTP response output stream closed?

2010-03-02 Thread Newman, John W
Thanks Will, that's pretty much what I thought was happening but I wasn't sure.

response.getBufferSize() = 8192, jboss default 

OP, it sounds this *might be what is causing your problem as well - I would 
suggest trying small and very large jsps and see if you can reproduce it based 
on response size.

Also we have jboss connected to IIS, there's a chance that IIS could actually 
be what is doing this.  I'm rather hesitant to increase the buffer though, I 
wonder how much I'd need to and what that means for request processing.

-Original Message-
From: Will Hartung [mailto:redro...@sbcglobal.net] 
Sent: Monday, March 01, 2010 9:44 PM
To: Stripes Users List
Subject: Re: [Stripes-users] When is the HTTP response output stream closed?


On Mar 1, 2010, at 9:28 AM, Newman, John W wrote:

 I think we are seeing a similar issue - different use case and  
 symptoms, but same idea, response is sometimes closed and sometimes  
 not.

 Can you try it with a very large and small response and see if the  
 size seems to play a role?  Because for us, I think a large size is  
 what closes it.

 Basically, I am getting cannot forward after response has been  
 committed sometimes.  Our exception handler has a debug mode  
 property, if true, it will take the stack trace and stream it back.   
 In production, this is disabled and it just sends back a rather  
 generic error message.  This always works fine.  But in debug mode,  
 if the stack trace is quite large (usually is), I'll get cannot  
 forward after the response committed.  It's like it commits the  
 response once the buffer gets past a certain point, but if that  
 isn't reached it doesn't close it until after the entire page is  
 rendered.  If I throw a large amount of text in there, the response  
 buffer closes well before the page is even read..

 Not sure how related that is, it just struck me as I'm seeing the  
 response close before it should.  *sometimes

John,

The problem your seeing has to do with the buffering of the response.

The Servlet layer typically has some amount of buffering (you can set  
this on JSP page for example, I don't recall the specifics).

For arguments sake, lets say that this buffering amount is 50K bytes.

When you send  a response to the client, the container starts  
buffering the output.

When it reaches, in this case, 50K, it will flush the buffer to the  
client.

At that point, the response is committed. At any point up to when  
you have reached the buffer size limit, the response is uncommitted  
since the system can simply erase the buffer, no harm, no foul.

So what you're seeing is most certainly size related. You may want to  
look at increasing your buffer size, or determine what is being  
written early on in your process.

Regards,

Will Hartung


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] When is the HTTP response output stream closed?

2010-03-01 Thread Newman, John W
I think we are seeing a similar issue - different use case and symptoms, but 
same idea, response is sometimes closed and sometimes not.

Can you try it with a very large and small response and see if the size seems 
to play a role?  Because for us, I think a large size is what closes it.

Basically, I am getting cannot forward after response has been committed 
sometimes.  Our exception handler has a debug mode property, if true, it will 
take the stack trace and stream it back.  In production, this is disabled and 
it just sends back a rather generic error message.  This always works fine.  
But in debug mode, if the stack trace is quite large (usually is), I'll get 
cannot forward after the response committed.  It's like it commits the 
response once the buffer gets past a certain point, but if that isn't reached 
it doesn't close it until after the entire page is rendered.  If I throw a 
large amount of text in there, the response buffer closes well before the page 
is even read..

Not sure how related that is, it just struck me as I'm seeing the response 
close before it should.  *sometimes
 

-Original Message-
From: Mike McNally [mailto:emmecin...@gmail.com] 
Sent: Sunday, February 28, 2010 8:22 AM
To: Stripes Users List
Subject: [Stripes-users] When is the HTTP response output stream closed?

We're noticing a somewhat weird problem with our Stripes app.  Many
(most) of our forms are in client-side dialogs.  The dialogs aren't
complete pages; they're done with various bits of client-side magic.
An AJAX request loads a page fragment containing the form, the user
types stuff, and upon a button's click the client-side code launches
another AJAX request to POST the form. The response to the POST (when
successful) is another page fragment, which now will mostly be nothing
but a script block with a snippet of Javascript to close the
dialog and trigger reloading of other parts of the page affected by
the operation. In other words, if the page is displaying some sort of
configuration status, and a dialog provides a way to change something,
then upon closing the dialog after a successful update some other
portion of the page must be reloaded with the new (changed)
configuration stuff.

So all that generally works great, except for this one small issue
that comes up now and then. Our server-side (Stripes) environment
involves a home-grown JPA implementation and a fairly simple database
session manager. Basically all that happens is that the session gets
initialized early in the Stripes lifecycle, and then after the
ResolutionExecution stage is done we commit the database transaction
and clean stuff up.

The strange thing that sometimes happens is this: sometimes, the
client-side code that responds to the successful POST from one of
those AJAX forms manages to start a new HTTP transaction to fetch
updated stuff from the server, and that transaction manages to run
**before** the code in the previous HTTP request thread has managed to
commit the database transaction (the one responsible for the update).
To me, what that means is that the HTTP response stream must be
completed (closed? that's all I can imagine, but I'm pretty fuzzy on
exactly how the high-level Java Servlet APIs relate to the low-level
HTTP protocol and the things in particular that the browser sees to
convince it that an HTTP response is complete) before the code in our
intercept does the commit.

Our intercept is not much more complicated than this:

Resolution rv = executionContext.proceed();
boolean closeSession = (executionContext.getLifecycleStage ==
LifecycleStage.ResolutionExecution) ||
  rv == null;
// exception handling, other stuff not really relevant
if (closeSession) {
  session.commit();
}

So: is it the case that somewhere inside Stripes - or inside something
else - that *after* the JSP code for our page fragment has completed,
and before that call to proceed returns to our intercept, the HTTP
response stream is closed? If so, is there a better place to put our
session cleanup code in the lifecycle? One fairly simple thing we've
considered is that we could commit the session after the action bean
has finished and before we get to the JSP code, leaving it in a
semi-open state so that page code and utility beans etc. could still
access the database read-only. That has the minor problem that
forwarding from one action bean to another would become problematic,
though that's a pretty rare thing in our application.

-- 
Turtle, turtle, on the ground,
Pink and shiny, turn around.

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Stripes-users mailing list

Re: [Stripes-users] FileBean doesn't work in first page of wizard

2010-02-18 Thread Newman, John W
This looks like a bug, either the file bean just needs a string constructor 
added or the property binder is running down an incorrect code path.  Please 
report in jira

Adding that constructor fixes file bean for mock round trip, maybe that should 
be there either way.

-Original Message-
From: Stripes User [mailto:colin.hendri...@gmail.com] 
Sent: Saturday, February 13, 2010 3:23 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] FileBean doesn't work in first page of wizard

I have a Stripes action class annotated with @wizard. The first page in my
wizard includes a filebean tag. When the second page of my wizard is posted back
to my action I get the stacktrace below. Is the FileBean supposed to work within
a multi-page wizard? It works fine for me on normal pages.

14:02:45,739  WARN DefaultActionBeanPropertyBinder:94 - Looks like type
converter null threw an exception.
java.lang.NoSuchMethodException:
net.sourceforge.stripes.action.FileBean.init(java.lang.String)
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getConstructor(Class.java:1657)
at
net.sourceforge.stripes.controller.
DefaultActionBeanPropertyBinder.convert(DefaultActionBeanPropertyBinder.java:795)




--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Issue with special charcters stripes 1.4.2 framework

2010-02-09 Thread Newman, John W
Character encoding hell can be tough to get out of sometimes.  You need to step 
through and verify UTF8 one layer at a time like Richard suggested.  Firebug is 
extremely useful here.

Do you have

meta http-equiv=Content-Type content=text/html; charset=UTF-8/meta

at the top the top of the page?



-Original Message-
From: Iwao AVE! [mailto:haraw...@gmail.com] 
Sent: Tuesday, February 09, 2010 8:27 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Issue with special charcters stripes 1.4.2 
framework

Hi,

I see a space character in the field attribute of your @Validation
annotation.
Please make sure it doesn't exist in your actual action bean.

Using System.out for debugging utf-8 characters is not a good idea.
I would recommend using some kind of logging framework
(commons-loggin, log4j, etc.) that can be configured to output utf-8.

Regards,
Iwao

on 10/02/09 14:40 AjayThukral said the following:
 
 Hi,
 
 We are facing an issue while using the special characters like Ç Ä i.e 2
 byte characters as input.
 I want to enter these characters in the stripes:text box in jsp and then
 validate the input using the @validate annotation in the action Bean.
 
 @Validate(field =  billcity, mask =
 [[\u00DC\u00D6\u00C4\u00DF\u00E4\u00F6\u00FC\u00C0\u00E0\u00C2\u00E2\u00E7\u00C7\u00C8\u00E8\u00C9\u00E9\u00CA\u00EA\u00CB\u00EB\u00CE\u00EE\u00CF\u00EF\u00D4\u00F4\u00D9\u00F9\u00DB\u00FB\u00C6\u00E6\u0152\u0153]\\w,\\s-/+%(.)//;#]+,
 on = “saveMethod”),
 
 The mask method is not validating the input even if the regular expression
 is correct and the input matches it.
 
 The problem seems is that if I enter string as  “45is+%()hÇÄ” what I
 receive in action Bean (java class ) is  “45is+%()hC?A?”. I can see it by
 printing  i.e System.out.println(getBillcity()).
 
 I have also checked the requestCharEncoding
 (getContext().getRequest().getCharacterEncoding()) in java class and it is
 also utf-8.
 
 jsp :
 I have a jsp mentioned encoding as utf-8 in  at the following points:
 %@ page contentType=text/html;charset=UTF-8 language=java %
 .
 ……..
meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
 .
 ……..
 
 stripes:form id=viewInfoForm action=/UserManager.action method=post
 name=InfoForm enctype=UTF-8
 .
 ……..

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Testing File uploads

2010-01-28 Thread Newman, John W
I ran into this a while back, see 
http://old.nabble.com/forum/ViewPost.jtp?post=16314703framed=y

I don't think sts-265 is related, but adding that constructor has been fine.  
Actually a type converter in test only would probably be better, can you share 
that maybe?  I still think something should happen in the trunk to support file 
beans from MockRoundtrip.



-Original Message-
From: Nick Stuart [mailto:nstu...@speranzasystems.com] 
Sent: Thursday, January 28, 2010 9:53 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Testing File uploads

Answering my own question here, I made a simple file bean converter in my test 
packages that converts strings to file beans! Yeah for extensions and 
flexibility. Of course, you never want to put this type of converter into 
production as it would be dangerous to be able to turn any string parameter 
passed in into a file.



On Jan 27, 2010, at 3:40 PM, Nick Stuart wrote:

 Hey all, I'm trying to piece together some integration tests, and while 
 strictly speaking I don't need to test that file uploads work, I need a way 
 to pass files to my action beans during tests to make sure they do the right 
 thing with them. 
 
 I am using the MockServletContext and MockRoundTrip which work great for my 
 'normal' parameters, but not sure what to do with files. Can I just convert a 
 byte array of the file contents to a string and pass it that way? Anyone have 
 to deal with this before?
 
 Thanks for any pointers! 
 -Nick


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Unit Testing Mock Object Spring Beans

2009-12-18 Thread Newman, John W
Where ever you're creating a new MockRoundTrip(), there's an additional 
constructor to attach an existing http session.  Looks like you're prebuilding 
a session w/ your spring beans injected, but are you passing that session into 
any trips?  Maybe post the code for one of the unit tests.

Just curious, what are you using spring http session beans for?

 -Original Message-
From: paulsjv [mailto:paul...@gmail.com] 
Sent: Friday, December 18, 2009 12:57 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Unit Testing Mock Object  Spring Beans


Hi everyone,

I’m a new user to Stripes and so far I’m really enjoying my experience.  So
thanks for a great framework!

My question has to do with unit testing with the Stripes mock objects and
the injection of Spring beans into my action beans.  We currently have a
couple of Spring beans that are session scoped (they are defined
scope=”session” in the applicationContext.xml).  This leads to the following
error (see stack trace below).  We were able to get around this scoping
issue within the application by adding the RequestContextLister to our
web.xml file (see below).  

I tried to duplicate what was in our web.xml in a BaseTest class to setup
all the mock objects but that doesn’t seem to be working (see code below). 
Any ideas or tips would be appreciated!

Thanks,
Jay

public class BaseTest {
  protected static MockServletContext mockServletContext;
  protected static MockHttpSession mockSession;
  protected static MockHttpServletRequest mockHttpServletRequest;
  
  @Before
  public void setUpMock() throws Exception {
mockServletContext = new MockServletContext(inspector_test);
mockHttpServletRequest = new
MockHttpServletRequest(mockServletContext.getContextPath(),
getServletPath());

MapString, String params = new HashMapString, String();
params.put(ActionResolver.Packages,
com.initiatesystems.accessibility.actions);
params.put(Interceptor.Classes,
net.sourceforge.stripes.integration.spring.SpringInterceptor);
params.put(LocalizationBundleFactory.FieldNameBundle,
Application);
params.put(PopulationStrategy.Class,
net.sourceforge.stripes.tag.BeanFirstPopulationStrategy);
params.put(LocalizationBundleFactory.ErrorMessageBundle,
Application);
 
mockServletContext.addFilter(StripesFilter.class,
StripesFilter, params);


// my guess is the realitive path is /WEB-INF/classes hence the
../
mockServletContext.addInitParameter(contextConfigLocation,
../applicationContext.xml,../spring-servlet.xml);



ContextLoaderListener springContextLoader = new
ContextLoaderListener();
springContextLoader.contextInitialized(new
ServletContextEvent(mockServletContext));

RequestContextListener springRequestContextListener = new
RequestContextListener();
springRequestContextListener.requestInitialized(new
ServletRequestEvent(mockServletContext, mockHttpServletRequest));

mockServletContext.setServlet(DispatcherServlet.class,
DispatcherServlet, null);
  }
  
  /**
   * Hook to set the servlet path for the creation of a 
   * MockHttpServletReqest object in the @BeforeClass
   * /actionType/foo.action
   * @return
   */
  protected String getServletPath() {
return null;
  }
}

Web.xml
listener
 
listener-classorg.springframework.web.context.request.RequestContextListener/listener-class
/listener

SEVERE: 
net.sourceforge.stripes.exception.StripesRuntimeException: Something is
trying to access the current Stripes configuration but the current request
was never routed through the StripesFilter! As a result the appropriate
Configuration object cannot be located. Please take a look at the exact URL
in your browser's address bar and ensure that any requests to that URL will
be filtered through the StripesFilter according to the filter mappings in
your web.xml.
at
net.sourceforge.stripes.controller.StripesFilter.getConfiguration(StripesFilter.java:161)
at
net.sourceforge.stripes.util.CryptoUtil.encrypt(CryptoUtil.java:123)
at
net.sourceforge.stripes.mock.MockRoundtrip.setSourcePage(MockRoundtrip.java:234)
at
net.sourceforge.stripes.mock.MockRoundtrip.init(MockRoundtrip.java:160)
at
net.sourceforge.stripes.mock.MockRoundtrip.init(MockRoundtrip.java:105)
at
com.initiatesystems.accessibility.actions.TaskSearhActionBeanTest.testFailBeginEndDates(TaskSearhActionBeanTest.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)

Re: [Stripes-users] Best way to test redirects with url bindings

2009-12-15 Thread Newman, John W
Probably not the best solution but this piece of code has been here for a very 
long time:

  Assert.assertEquals(Patient.class, 
getRedirectActionClass(trip.getDestination()));


  protected Class? extends ActionBean getRedirectActionClass(String 
destination) {
int queryStringPos = destination.indexOf(?);
return StripesFilter.getConfiguration().getActionResolver()
.getActionBeanType(
0 = queryStringPos ? 
destination.substring(0,
queryStringPos) : destination);
  }




From: Levi Hoogenberg [mailto:levihoogenb...@gmail.com]
Sent: Tuesday, December 15, 2009 12:32 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Best way to test redirects with url bindings

I figured you'd come up with this (or with extracting a constant into a static 
Destinations class). Internally, Stripes uses a UrlBindingFactory (IIRC) to 
interpolate the URL parameters; you could use that class in your unit tests 
too. My strategy is to simply use strings - if a binding changes (whcich rarely 
occurs IME), I'll fix the unit tests.

Op 15 dec 2009 om 01:35 heeft Nathan Maves 
nathan.ma...@gmail.commailto:nathan.ma...@gmail.com het volgende 
geschreven:\
Good call and this works perfect for simple UrlBinding.  I just ran into this 
binding

@UrlBinding(/account/admin/branches/{$event}/{branch.idhttp://branch.id})

Guess I am looking for a best practice on how most people unit test their 
redirect actions in stripes.

Nathan
On Mon, Dec 14, 2009 at 4:43 PM, Levi Hoogenberg 
levihoogenb...@gmail.commailto:levihoogenb...@gmail.com wrote:
Something like SettingsMenuAction.class.getAnnotation
(UrlBinding.class).value() should do the trick.

  Levi

Op 14 dec 2009 om 23:49 heeft Nathan Maves 
nathan.ma...@gmail.commailto:nathan.ma...@gmail.com
het volgende geschreven:\

 right now I have an action like

 @UrlBinding(/settings)
 public class SettingsMenuAction extends SettingsTabAction {
 ...
 }

 a second action redirects to the action via

   public Resolution cancel() {
   return new RedirectResolution(SettingsMenuAction.class);
   }

 now in the unit test of the action that makes the redirect I can run
 the following fine.

   @Test
   public void cancel() throws Exception {
   trip.execute(cancel);

   assertEquals(/settings, trip.getDestination());
   }

 The only issue I have is with the static /settings in the test
 assertion.  Is there anyway to get that binding from the action class?

 Nathan
 ---
 ---
 ---
 -
 Return on Information:
 Google Enterprise Search pays you back
 Get the facts.
 http://p.sf.net/sfu/google-dev2dev
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Stripes 1.6 snapshot with Maven2

2009-11-20 Thread Newman, John W
Has there been any discussion about eventually reworking the project layout to 
be pure maven 2 and removing the ant builds?

I would, much simpler... I can't ever see myself writing ant build scripts 
again.

From: Ben Gunter [mailto:gunter...@gmail.com]
Sent: Friday, November 20, 2009 8:25 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Stripes 1.6 snapshot with Maven2

FYI, I put the request in on Nov. 9. They tend to take a while to get around to 
these things.

http://jira.codehaus.org/browse/MAVENUPLOAD-2656

-Ben
On Fri, Nov 20, 2009 at 6:35 AM, Freddy Daoud 
xf2...@fastmail.fmmailto:xf2...@fastmail.fm wrote:
It is done.

I didn't realize that 1.5.2 wasn't up in the Maven repo yet; I've
been on 1.6 for a while now. Can't live without the ObjectFactory ;-)

Not sure why directory listing isn't working. I'll have to check
that out.

Cheers,
Freddy
http://www.stripesbook.com
On Fri, 20 Nov 2009 09:11:17 +0100, Richard Hauswald
richard.hausw...@googlemail.commailto:richard.hausw...@googlemail.com said:
 Please do so. It'd be also kewl if you enable the index listings to
 enable repository browsing.
 Thanks,
 Richard

 On Fri, Nov 20, 2009 at 9:04 AM, M.C.S. 
 m...@syn-online.demailto:m...@syn-online.de wrote:
  Hi Freddy,
 
  would it hurt if you also added Stripes 1.5.2 to the repo? Central's
  current version is still 1.5.1 :-(
 
  Greetings,
  Marcus
 
 
  Freddy Daoud schrieb:
  If you are using Maven 2 and want to experiment with the current snapshot
  of Stripes 1.6, you can get it from my repository. Just add this to your
  pom.xml file:
 
  1. Under dependencies
 
  dependency
groupIdnet.sourceforge.stripes/groupId
artifactIdstripes/artifactId
version1.6-SNAPSHOT/version
  /dependency
 
  2. Under project
 
repositories
  repository
idwww.stripesbook.comhttp://www.stripesbook.com/id
urlhttp://www.stripesbook.com/maven2/url
  /repository
/repositories
 
  Cheers,
  Freddy
  http://www.stripesbook.com
 
 
 
  --
  Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
  trial. Simplify your report design, integration and deployment - and focus 
  on
  what you do best, core application coding. Discover what's new with
  Crystal Reports now.  http://p.sf.net/sfu/bobj-july
  ___
  Stripes-users mailing list
  Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/stripes-users
 
 
 
  --
  Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
  trial. Simplify your report design, integration and deployment - and focus 
  on
  what you do best, core application coding. Discover what's new with
  Crystal Reports now.  http://p.sf.net/sfu/bobj-july
  ___
  Stripes-users mailing list
  Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/stripes-users
 



 --
 Richard Hauswald
 Blog: http://tnfstacc.blogspot.com/
 LinkedIn: http://www.linkedin.com/in/richardhauswald
 Xing: http://www.xing.com/profile/Richard_Hauswald

 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day
 trial. Simplify your report design, integration and deployment - and
 focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net

Re: [Stripes-users] RedirectResolution using POST

2009-11-10 Thread Newman, John W
You could also use apache http client to build  execute the post and send the 
resulting input stream to your httpresponse.  Might be a bit overkill but is 
probably a not so bad way of doing it.  I'm sure there's an easier way?

I've used http client a few times, it is pretty simple to get up and running.  
It's just the error handling that can take time, but your use case any errors 
would just be a pass through.

From: Stone, Timothy [mailto:tst...@barclaycardus.com]
Sent: Tuesday, November 10, 2009 5:08 PM
To: Stripes Users List
Subject: Re: [Stripes-users] RedirectResolution using POST

Jocke,

I personally would like to hear more about this solution and possibly see some 
code samples.

Generally speaking, I have found that many applications do not really correctly 
implement GET and POST. Many leverage POST to circumvent GET limitations or 
prevent information from being written to logs.

The use of mod_rewrite + mod_proxy is really just masking the problem and 
working around the specification, but I like the solution better than a form 
shell that auto submits (for reasons of accessibility, though those can be 
worked around by providing a button when Javascript is disabled...).

A controller solution is very intriguing as, while another specification 
workaround, it is hidden from the view and the protocol layers preserving the 
data being passed around.

Regards,
TIm


On 11/10/09 2:15 AM, Jocke Eriksson jockeeriks...@msn.com wrote:
I would go with the URL Connection class, this will give you the possibility to 
implement failover when
needed.

 Date: Mon, 9 Nov 2009 19:54:48 +0100
 From: g...@karko.net
 To: stripes-users@lists.sourceforge.net
 Subject: [Stripes-users] RedirectResolution using POST

 Hi,

 I'm integrating with an online payments service and would love to POST
 to their URL instead of GETting it. Is it possible to do so using
 RedirectResolution or some other means?

 Best regards,
 Grzegorz


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
 trial. Simplify your report design, integration and deployment - and focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users


Hitta kärleken! Klicka här Hitta en dator som passar dig! 
http://windows.microsoft.com/shop

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

--
Timothy Stone   |   Application Developer Technical Lead
Barclaycard   |Business Technology Group, Strategic Development
125 S. West Street   |   Wilmington, DE|   19801
USA   |   www.barclaycardus.com
+1 302 255 8044 direct |   +1 410 441 9450 cell

COMPANY CONFIDENTIAL

P Before printing this e-mail, or any other document, ask yourself whether you 
need a hard copy



___

Barclays
www.barclaycardus.com
___

This e-mail and any files transmitted with it may contain confidential and/or 
proprietary information. It is intended solely for the use of the individual or 
entity who is the intended recipient. Unauthorized use of this information is 
prohibited. If you have received this in error, please contact the sender by 
replying to this message and delete this material from any system it may be on.
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] RedirectResolution using POST

2009-11-10 Thread Newman, John W
AH I hit ctrl+enter, instead of enter, before I was finished.  I need to change 
that setting..

I wanted to add, it is kind of weird to have your web server also acting like a 
web client.  Here we have 0 visibility to the production machine, so it may 
have some sort of outbound proxy or something preventing a POST or a GET from 
that machine to another one.  If it doesn't for initial release, they might 
install something tomorrow who knows.

So I would probably go with the forward to a page with form action=http://... 
and scriptform.submit()... that is weird, but not quite as weird as making 
your server ask for pages.  And if you put a button inside the noscript tag, 
it's still accessible.  It is still pretty odd though, there's got to be a 
better way?

From: Newman, John W [mailto:john.new...@viaoncology.com]
Sent: Tuesday, November 10, 2009 5:37 PM
To: Stripes Users List
Subject: Re: [Stripes-users] RedirectResolution using POST

You could also use apache http client to build  execute the post and send the 
resulting input stream to your httpresponse.  Might be a bit overkill but is 
probably a not so bad way of doing it.  I'm sure there's an easier way?

I've used http client a few times, it is pretty simple to get up and running.  
It's just the error handling that can take time, but your use case any errors 
would just be a pass through.

From: Stone, Timothy [mailto:tst...@barclaycardus.com]
Sent: Tuesday, November 10, 2009 5:08 PM
To: Stripes Users List
Subject: Re: [Stripes-users] RedirectResolution using POST

Jocke,

I personally would like to hear more about this solution and possibly see some 
code samples.

Generally speaking, I have found that many applications do not really correctly 
implement GET and POST. Many leverage POST to circumvent GET limitations or 
prevent information from being written to logs.

The use of mod_rewrite + mod_proxy is really just masking the problem and 
working around the specification, but I like the solution better than a form 
shell that auto submits (for reasons of accessibility, though those can be 
worked around by providing a button when Javascript is disabled...).

A controller solution is very intriguing as, while another specification 
workaround, it is hidden from the view and the protocol layers preserving the 
data being passed around.

Regards,
TIm


On 11/10/09 2:15 AM, Jocke Eriksson jockeeriks...@msn.com wrote:
I would go with the URL Connection class, this will give you the possibility to 
implement failover when
needed.

 Date: Mon, 9 Nov 2009 19:54:48 +0100
 From: g...@karko.net
 To: stripes-users@lists.sourceforge.net
 Subject: [Stripes-users] RedirectResolution using POST

 Hi,

 I'm integrating with an online payments service and would love to POST
 to their URL instead of GETting it. Is it possible to do so using
 RedirectResolution or some other means?

 Best regards,
 Grzegorz


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
 trial. Simplify your report design, integration and deployment - and focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users


Hitta kärleken! Klicka här Hitta en dator som passar dig! 
http://windows.microsoft.com/shop

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

--
Timothy Stone   |   Application Developer Technical Lead
Barclaycard   |Business Technology Group, Strategic Development
125 S. West Street   |   Wilmington, DE|   19801
USA   |   www.barclaycardus.com
+1 302 255 8044 direct |   +1 410 441 9450 cell

COMPANY CONFIDENTIAL

P Before printing this e-mail, or any other document, ask yourself whether you 
need a hard copy



___

Barclays
www.barclaycardus.com
___

This e-mail and any files transmitted with it may contain confidential and/or 
proprietary information. It is intended solely for the use of the individual or 
entity who is the intended recipient. Unauthorized use of this information is 
prohibited. If you have received this in error, please contact the sender by 
replying to this message and delete this material from any system it may be on.
--
Let Crystal Reports handle

Re: [Stripes-users] Bean Population with XMLBeans and Stripes?

2009-10-28 Thread Newman, John W
Yes we had to setup spring pooling of the marshaller/unmarshaller for anything  
to work under load.  They (or maybe just one of the two.. I forget) are not 
threadsafe.. and the create() operation can be expensive.  We can't even use 
validation due to a bug with xerces choking on one of the schemas we are 
importing =)

I would just checkout the stripes trunk and browse around, find the object 
factory and trace it up.  It's not very complicated

Re subclassing, I think you might be able to extend the property binder  
population strategy.  But last I looked, the property binder didn't have a 
clean hook for instantiation so you may have to duplicate a lot of code in a 
large method in your subclass..  =(

also changes parameters names to plural for arrays and such

That's nice.  All of our collections are singular names which frequently 
confuses me ... there is a jaxb plugin for adding the S, but it doesn't exactly 
work right ListPlan currentPlans ends up being ListPlan currentPlen .. etc, 
it is 'too smart'.

JAXB itself isn't that bad.  In fact I could see myself using it again for 
something else in the future.  For xml-java it works well and is quite fast 
enough.

But using xjc has been, well, a bit of a burden.  When we first started it was 
a big win, just grab the xsd and run instead of crafting and updating the .java 
files. But like I said there's no Sets, and getBoolean (which I've worked 
around) are the main two problems.  Oh and no Map support last I tried.   I 
know there are a few other nagging things with xjc I can't recall now.  But 
really having generated entities that you can't add calculations / validation 
into can be a bit crippling sometimes.  It's nice in the spirit of MDA but in 
practice that didn't really work out 100% for us.  Plugging correct equals  
hashcode methods into a superclass is tricky and required a plugin.  That then 
breaks MDA since I have some abstract getXXX() methods in a super type above 
the generated one and just have to hope that the generated one still correctly 
overrides that =)


From: Brown, Alex [mailto:abr...@barclaycardus.com]
Sent: Wednesday, October 28, 2009 12:34 PM
To: Stripes Users List
Cc: Stone, Timothy; Smith, Ken
Subject: Re: [Stripes-users] Bean Population with XMLBeans and Stripes?

Hey John,
So Stripes 1.6 will have the ability to use factories with the population 
strategy?  Is this documented anywhere as far as how it works or should I just 
peruse the code?
Not sure what you mean about subclassing, subclassing the population  strategy?

Why do you like or not like jaxb?  XMLBeans not only uses is instead of 
get, but it also changes parameters names to plural for arrays and such.  It 
is also not Java 5 code and uses a goofy enumeration strategy etc.  It also 
uses arrays instead of Lists or Sets, sort of  You use the factory to add 
the elements and build the object from each parent for the most part.

Main issue with JAXB at this point for me is that validation is goofy and you 
need to cache the marshler or it is crazy slow.

I did a speed analysis and they are extremely close speedwise if you cache the 
marshler with JAXB.

Thanks


From: Newman, John W [mailto:john.new...@viaoncology.com]
Sent: Wednesday, October 28, 2009 10:35 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Bean Population with XMLBeans and Stripes?

Stripes 1.6 will have the object factory - anywhere newInstance() was used is 
replaced with yourObjectFactory.newInstance();  .. this was stable in the trunk 
when I last tried it out, about 2 months ago.   The @Before method probably 
wont work too well for very long.  You could subclass

We are currently using jaxb.  It is definitely working fine for us, but I've 
been lightly looking into a switch to xml beans.  If you can use that, I would 
try to stick with it.  We had to hack our way through a few custom plugins and 
xjc changes to get jaxb to behave correctly for us.  The biggest problem is 
they botched the boolean is/get convention 
http://www.mojavelinux.com/blog/archives/2006/09/the_great_jaxb_api_blunder/  
.. among other things .. the other big one is they only use List for 
collections, no Sets .. and absolutely forget about maps (which are often so 
useful).



From: Brown, Alex [mailto:abr...@barclaycardus.com]
Sent: Tuesday, October 27, 2009 3:04 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Bean Population with XMLBeans and Stripes?

Hello all,
I am working with XMLBean objects, Spring webservices and of course Stripes.  
XMLBeans utilize factories to create new object instances for an object graph 
like this:

obj = Object.Factory.newInstance();
newObj = obj.addNewObject();

The issue I have is that a given form may have information to build an unknown 
set of objects on an object graph.  We need to maintain this flexibility as the 
pages are dynamic.

We want to use the XMLBean object as the form object on the action bean

Re: [Stripes-users] error when testing

2009-09-24 Thread Newman, John W
Hi,

See 
http://www.nabble.com/StripesFilter.getConfiguration%28%29-and-JUnit%284%29-under-Maven-%28or-JUnit-test-suits%29-to20619084.html#a21045598

And http://www.stripesframework.org/jira/browse/STS-714 which was just resolved

-Original Message-
From: Rusty Wright [mailto:rusty.wri...@gmail.com] 
Sent: Thursday, September 24, 2009 1:24 PM
To: Stripes Users List
Subject: [Stripes-users] error when testing

Any ideas why I'm getting the following error when running unit tests?  The 
first test doesn't get the error, which makes me think that something is not 
being closed, shut down, etc. properly.

First the error listing, after that is my test harness.

(messages about scanning for classes removed)
INFO : 10:16:04,311: net.sourceforge.stripes.util.Log.info(Log.java:172): 
Stripes Initialization Complete. Version: 1.5.1, Build: 1102
MockServletContext: Initializing Spring root WebApplicationContext
INFO : 10:16:04,311: 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189):
 Root WebApplicationContext: initialization started
INFO : 10:16:04,311: 
org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:411):
 Refreshing 
org.springframework.web.context.support.xmlwebapplicationcont...@4865ce: 
display name [Root WebApplicationContext]; startup date [Thu Sep 24 10:16:04 
PDT 2009]; root of context hierarchy
INFO : 10:16:04,311: 
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:323):
 Loading XML bean definitions from URL 
[file:/C:/users/rusty/workspaces/spring_samples/sample005/target/classes/spring/applicationContext.xml]
INFO : 10:16:04,343: 
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:426):
 Bean factory for application context 
[org.springframework.web.context.support.xmlwebapplicationcont...@4865ce]: 
org.springframework.beans.factory.support.defaultlistablebeanfact...@747fa2
INFO : 10:16:04,343: 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:414):
 Pre-instantiating singletons in 
org.springframework.beans.factory.support.defaultlistablebeanfact...@747fa2: 
defining beans 
[org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,dateDao,desiredDateFactory,dateService,dateFormBacker,desiredDateValidator];
 root of factory hierarchy
DEBUG: 10:16:04,343: 
com.objecteffects.sample.web.dto.DateFormBacker.generateDaysOfWeek(DateFormBacker.java:106):
 minDayOfWeek: 1
DEBUG: 10:16:04,343: 
com.objecteffects.sample.web.dto.DateFormBacker.generateDaysOfWeek(DateFormBacker.java:107):
 maxDayOfWeek: 7
INFO : 10:16:04,343: 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:209):
 Root WebApplicationContext: initialization completed in 32 ms
DEBUG: 10:16:04,343: 
com.objecteffects.sample.web.action.StartActionBeanTest.testSubmit(StartActionBeanTest.java:62):
 called
ERROR: 10:16:04,343: net.sourceforge.stripes.util.Log.error(Log.java:78): 
net.sourceforge.stripes.exception.StripesRuntimeException: Something is trying 
to access the current Stripes configuration but the current request was never 
routed through the StripesFilter! As a result the appropriate Configuration 
object cannot be located. Please take a look at the exact URL in your browser's 
address bar and ensure that any requests to that URL will be filtered through 
the StripesFilter according to the filter mappings in your web.xml.
at 
net.sourceforge.stripes.controller.StripesFilter.getConfiguration(StripesFilter.java:161)
at net.sourceforge.stripes.util.CryptoUtil.encrypt(CryptoUtil.java:123)
at 
net.sourceforge.stripes.mock.MockRoundtrip.setSourcePage(MockRoundtrip.java:234)
at 
net.sourceforge.stripes.mock.MockRoundtrip.init(MockRoundtrip.java:160)
at 
net.sourceforge.stripes.mock.MockRoundtrip.init(MockRoundtrip.java:93)
at 
net.sourceforge.stripes.mock.MockRoundtrip.init(MockRoundtrip.java:79)
at 
com.objecteffects.sample.web.action.StartActionBeanTest.testSubmit(StartActionBeanTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at 

Re: [Stripes-users] jsp:include of Stripes action results in FileNotFoundException

2009-09-24 Thread Newman, John W
Have you seen the useactionbean tag?

http://www.nabble.com/Stripes-Best-Practises-to11970249.html#a11974525


-Original Message-
From: Grzegorz Krugły [mailto:g...@karko.net] 
Sent: Thursday, September 24, 2009 1:30 PM
To: Stripes Users List
Subject: Re: [Stripes-users] jsp:include of Stripes action results in 
FileNotFoundException


 errors, it doesn't trap the FileNotFoundException which is thrown. Is 
 this a bug?

I now believe that this IS a bug and have filed it to Jira 
http://www.stripesframework.org/jira/browse/STS-715 along with the 
detailed description and my workaround.

HTH someone :-)

Kind regards,
Grzegorz


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Trying to do UrlBinding(/)... somehow :-)

2009-09-10 Thread Newman, John W
We have this working in jboss using the DynamicMappingFilter. See 
http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/DynamicMappingFilter.html


Web.xml:
filter
display-nameStripes Filter/display-name
filter-nameStripesFilter/filter-name

filter-classnet.sourceforge.stripes.controller.StripesFilter/filter-class
init-param
/filter
filter-mapping
filter-nameStripesFilter/filter-name
servlet-nameStripesDispatcher/servlet-name
dispatcherREQUEST/dispatcher
/filter-mapping

filter
filter-nameDynamicMappingFilter/filter-name

filter-classnet.sourceforge.stripes.controller.DynamicMappingFilter/filter-class
/filter
filter-mapping
filter-nameDynamicMappingFilter/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherFORWARD/dispatcher
dispatcherINCLUDE/dispatcher
/filter-mapping

welcome-file-list
welcome-fileindex.jsp/welcome-file
/welcome-file-list


@UrlBinding(/)
public class Home implements ActionBean  {

@DefaultHandler
public Resolution gotoIndexPage()  {
return new ForwardResolution(/WEB-INF/home/); // index.jsp is 
in welcome file list
}
}

If you don't want to use DynamicMappingFilter, I made a while ago about how to 
do the same thing before the filter was created, see 
http://www.nabble.com/Binding-an-ActionBean-to-%22-%22---to9574712.html for 
another approach.

Hope that helps

-John



-Original Message-
From: Grzegorz Krugły [mailto:g...@karko.net] 
Sent: Thursday, September 10, 2009 2:48 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Trying to do UrlBinding(/)... somehow :-)

Hi,

I have an action which binds to /home like this:

@UrlBinding(/home)
public class HomePageAction extends BaseAction {

and I'm trying to use something like this in web.xml:

welcome-file-list
welcome-filehome/welcome-file
/welcome-file-list

to make my http://domain.tld/ display my home page without redirecting 
to http://domain.tld/home first (which is bad for SEO reasons). I'm 
using Glassfish 2.1 and it doesn't work unless I create a file called 
home :-(

Is there a way to use a Stripe Action as a welcome-file? Or is there a 
way to do @UrlBinding(/)?

Two solutions I'd like NOT to use are:

* using Apache front with mod_proxy and mod_rewrite
* creating index.jsp that redirects to /home


Best regards,
Grzegorz

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Trying to do UrlBinding(/)... somehow :-)

2009-09-10 Thread Newman, John W
Hmm it should just work then.  I don't think it's due to war/ear as I've 
successfully deployed both using the same technique.  So I think maybe it's a 
glassfish setting since you're getting a dir listing. ?  If whatever you've 
requested is in the web app's context, you should get to the page or a 404 if 
the app isn't directing to anything for /.  To me a dir listing means that 
request is outside of any web app.


-Original Message-
From: Grzegorz Krugły [mailto:g...@karko.net] 
Sent: Thursday, September 10, 2009 3:48 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Trying to do UrlBinding(/)... somehow :-)

Newman, John W pisze:
 We have this working in jboss using the DynamicMappingFilter. See 
 http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/controller/DynamicMappingFilter.html
   


I'm already using DynamicMappingFilter. My web.xml is virtually the same 
as You've mentioned.

If I bind to /home and go to http://mydomain.tld/home - it works. If I 
bind to / and go to http://mydomain.tld/ - all I get is a directory 
listing from Glassfish.

Should following action just work at / URL? Could it be the problem with 
Glassfish or maybe I should put something to application.xml (I deploy 
inside an EAR)? I already deploy my webapp to /

@UrlBinding(/)
public class HomePageAction extends BaseAction {
private static final String INDEX = /WEB-INF/jsp/home/index.jsp;

@DefaultHandler
public Resolution index() {
return new ForwardResolution(INDEX);
}
}

Thanks,
Grzegorz


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] ForwardResolution does not go to right target

2009-08-18 Thread Newman, John W
If you're going outside of the currently running webapp, I don't believe you 
can't forward.  You'll have to use

public RedirectResolution(String url, boolean prependContext)

if prependContext is false stripes doesn't tack on /url_a allowing you to 
redirect to xyz.com or localhost/AnotherApp/.  You'll probably have to do 
.addParameter(x, getX()).addParameter(y, getY()) to pass any params over.



From: Gerardo Corro [mailto:rob_gar_...@hotmail.com]
Sent: Tuesday, August 18, 2009 11:57 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] ForwardResolution does not go to right target

Hi all,


I'm using the ForwardResolution, I want to make an internal redirection from:

http://localhost:8081/url_a

to:

http://localhost:8081/url_x/?extras=yes

So, when getting a request for /url_a in my front action bean I have:

return new ForwardResolution(/url_x/?extras=yes);

but at the end the resource is resolved as:

HTTP Status 404 - /url_a/url_x/
type Status report
message /url_a/url_x/
description The requested resource (/url_a/url_x/) is not available.

What I'm doing wrong?

Thanks!

check out the rest of the Windows Live(tm). More than mail-Windows Live(tm) 
goes way beyond your inbox. More than 
messageshttp://www.microsoft.com/windows/windowslive/
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] ConcurrentModificationException

2009-08-05 Thread Newman, John W
Do you have before/after method interceptor listed in web.xml?You should 
see something like 'BeforeAfterMethodInterceptor is configured to run twice' in 
the logs at startup.  If so you can remove it from there, since 1.5 that has 
been configured as a 'core' interceptor.  I suppose that could cause that

From: carlos peña [mailto:shinme...@gmail.com]
Sent: Wednesday, August 05, 2009 3:59 PM
To: Stripes Users List; spyd...@gmail.com
Subject: Re: [Stripes-users] ConcurrentModificationException

Hi, ive already experienced a similar problem before. Check if you're using a 
collection iterator correctly or iterating the collection the right way. This 
exception is thrown when a thread is iterating over a collection (using an 
iterator) and other thread, or the same thread tries to modify the collection. 
IE:

Iterator it  = myList.getIterator();
while(it.hasNext()){
MyClass item = it.next();
myLis.remove(0); // the exception will be thrown here because youre 
iterating the collection named myList with the iterator it
   // and while doing that you modify the collection removing a item directly ( 
not using the iterator as it should be).
}

Check if youre not doing this. Hope this helps.

Best regards.
On Wed, Aug 5, 2009 at 6:13 AM, Simon 
spyd...@gmail.commailto:spyd...@gmail.com wrote:
Hello !!

We are using Stripes for our web applications and we are really happy with it.

However, today we got a strange exception :

java.util.ConcurrentModificationException
 at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
 at java.util.AbstractList$Itr.next(AbstractList.java:343)
 at 
net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:101)
 at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
 at 
net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
 at 
net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:190)
 at 
net.sourceforge.stripes.controller.DispatcherServlet.doBindingAndValidation(DispatcherServlet.java:254)
 at 
net.sourceforge.stripes.controller.DispatcherServlet.service(DispatcherServlet.java:148)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)



 at 
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
 at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:420)
 at com.caucho.server.port.TcpConnection.run(TcpConnection.java:514)
 at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520)
 at com.caucho.util.ThreadPool.run(ThreadPool.java:442)
 at java.lang.Thread.run(Thread.java:619)

This is our actual configuration :

stripes version : 1.5.1
web container : Caucho Resin 3.0.24
java version : 1.6.0_13
OS : SunOS 5.10 sparc


Any clue on this exception ? :)

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Exception Handler and Spring

2009-07-14 Thread Newman, John W
The only way I've been able to do it is to extend Configuration, override 
initExceptionHandler, and use static bean lookup.   Our configuration overrides 
many other init methods to lookup spring beans.

With the coming stripes 1.6 object factory all this goes away and it's pure and 
simple...  can't wait for that =)


From: Andy [mailto:andrh...@hotmail.com]
Sent: Tuesday, July 14, 2009 10:10 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Exception Handler and Spring

Hi, I created an exception handler and would like to inject a spring bean 
(errorService) so that I can log the error.  I am currently using the 
stripes-spring.jar.  Is it possible to make the exception handler spring 
managed?  http://www.silvermindsoftware.com/stripes/??

Thanks
Andy


import net.sourceforge.stripes.exception.ExceptionHandler;
import net.sourceforge.stripes.config.Configuration;
import net.sourceforge.stripes.action.RedirectResolution;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
import java.io.IOException;

public class MyExceptionHandler implements ExceptionHandler {
public void init(Configuration configuration) throws Exception {
}

public void handle(Throwable throwable, HttpServletRequest request, 
HttpServletResponse response) throws ServletException, IOException {
new RedirectResolution(/content/jsp/error.jsp).execute(request, 
response);
}
}

Hotmail(r) has ever-growing storage! Don't worry about storage limits. Check it 
out.http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Defaulthandler ForwardResolution question

2009-07-13 Thread Newman, John W
AFAIK there's no way to send NO response to the browser.  That would be a 
timeout..  You may want to look at 
getContext().getResponse().sendError(HttpServletResponse.SC_???)  SC_NO_CONTENT 
is probably the best fit.  But if you want a valid, empty response, return new 
StreamingResolution(text/html, ); will do the trick

From: Andy [mailto:andrh...@hotmail.com]
Sent: Monday, July 13, 2009 11:58 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Defaulthandler ForwardResolution question

Hi, should I return a null if I want my default handler to return nothing (ie I 
do not want a response sent back to the browser)?

Thanks!

Insert movie times and more without leaving Hotmail(r). See 
how.http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Permanent redirect?

2009-07-13 Thread Newman, John W
You probably want 
getContext().getResponse().sendError(HttpServletResponse.SC_MOVED_PERMANENTLY);

You could wrap that inside a subclass of Resolution, execute method, if you 
want.

-Original Message-
From: Stone, Timothy [mailto:tst...@barclaycardus.com] 
Sent: Monday, July 13, 2009 10:09 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Permanent redirect?

Without writing your own Resolution, e.g., PermanentRedirectResolution,
you might try:

1. a ForwardResolution to a resource that generates your 301
2. a ForwardResolution to a resource that performs mapped lookup in
Apache (or other HTTPD), using a query or path element, for a 301.

Writing your own Resolution, extending RedirectResolution, overriding
the execute method, seems plausible. In order of complexity, it might be
the most complex, with #1 being the easiest, IMHO.

Regards,
Tim

 -Original Message-
 From: Ray Vanderborght [mailto:voids...@gmail.com] 
 Sent: Sunday, July 12, 2009 12:40 AM
 To: stripes-users@lists.sourceforge.net
 Subject: [Stripes-users] Permanent redirect?
 
 Is there a way to do a permanent (301) redirect from inside a 
 stripes action?
 
 What I'm doing is adding keywords to the end of my urls for 
 better SEO, and I'm redirecting existing urls to the new ones 
 with the keywords added.  I'm using a RedirectResolution now 
 to accomplish this but it's issuing a temporary (302) 
 redirect instead of a permanent redirect.
 
 This article on a related topic (the canonical tag) mentions 
 a 301 redirect as being the right thing to do in this case:
 http://www.mattcutts.com/blog/canonical-link-tag/ (slide #4).
 
 Anyhow I'm not too hung up on it, but if there's a way to do 
 a permanent redirect that I'm just missing let me know.  Thanks.
 


Barclays www.barclaycardus.com

This e-mail and any files transmitted with it may contain confidential and/or 
proprietary information. It is intended solely for the use of the individual or 
entity who is the intended recipient. Unauthorized use of this information is 
prohibited. If you have received this in error, please contact the sender by 
replying to this message and delete this material from any system it may be on.



--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] RTL support for Integer Type Converter

2009-07-08 Thread Newman, John W
Stripes simply uses NumberFormat under the hood, that is where this behavior is 
coming from.  So it's either a jdk bug or not a bug at all.  See 
http://stripes.svn.sourceforge.net/viewvc/stripes/trunk/stripes/src/net/sourceforge/stripes/validation/NumberTypeConverterSupport.java?revision=783view=markup


Also faield is spelled wrong there. 


public class NumberFormatTest  {

public static void main(String[] args) {
Locale locale = new Locale(ar, AE);
NumberFormat format = NumberFormat.getInstance(locale);

convert(locale, format, -1);
convert(locale, format, 1-);
}

private static void convert(Locale locale, NumberFormat format, String 
input) {
ParsePosition pp = new ParsePosition(0);
pp.setIndex(0);

Number number = format.parse(input, pp);
if (number != null  input.length() == pp.getIndex()) {
System.out.println(Successfully converted  + input + 
 to 
+ number);
} else {
System.out.println(Failed to convert  + input +  
using locale 
+ locale);
}
}
}


-Original Message-
From: Martin Walsh [mailto:martin.wa...@sun.com] 
Sent: Wednesday, July 08, 2009 7:49 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] RTL support for Integer Type Converter

It seems as though there is a bug in the Stripes IntegerTypeConverter 
when it is used with right to left languages.  When a negative value is 
supplied, stripes fails validation.

I believe the problem is that the converter expects 1- for RTL 
languages, when in fact it should be expecting -1. This is because in 
RTL languages, numbers are still written the same as in LTR languages.

Could someone confirm this.

Here is a list of the failing locales:

Faield to convert -1 using locale ar_AE
Faield to convert -1 using locale ar_IQ
Faield to convert -1 using locale ar_YE
Faield to convert -1 using locale ar_QA
Faield to convert -1 using locale mk_MK
Faield to convert -1 using locale ar_SA
Faield to convert -1 using locale ar_LB
Faield to convert -1 using locale ar_KW
Faield to convert -1 using locale ar_SD
Faield to convert -1 using locale ar_SY
Faield to convert -1 using locale ar_BH
Faield to convert -1 using locale ar_TN
Faield to convert -1 using locale ar_JO
Faield to convert -1 using locale ar_EG
Faield to convert -1 using locale ar_MA
Faield to convert -1 using locale ar_DZ
Faield to convert -1 using locale ar_LY
Faield to convert -1 using locale ar
Faield to convert -1 using locale ar_OM


Thanks,

Martin.

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Parameters in Actionbean won't save

2009-07-06 Thread Newman, John W
You're redirecting to the jsp which creates a whole new http request with null 
parameters.

Instead, you'll want to stash your jsps under WEB-INF so they are protected and 
can't be accessed directly; have your action beans return new 
ForwardResolution(to-the.jsp) instead.  You'll probably have to convert your 
first request from a direct jsp to an action bean which has a @DefaultHandler 
to forward you to the index jsp.  This approach may initially sound like a bit 
of extra work but it really is much nicer once you get comfortable with it.

See the preactions paragraph at 
http://www.stripesframework.org/display/stripes/Best+Practices






From: b l [mailto:blake1...@gmail.com]
Sent: Monday, July 06, 2009 11:07 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Parameters in Actionbean won't save

I'm having trouble with something that seems very simple.  Here is my ActionBean


package action;

import net.sourceforge.stripes.
action.RedirectResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.UrlBinding;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.DontValidate;
import net.sourceforge.stripes.action.HandlesEvent;

import pojo.ImgCal;
import service.DailyDataImageService;

import org.apache.log4j.Logger;


@UrlBinding(/DailyData.action)
public class DailyDataActionBean extends W2BActionBean {
private static final Logger logger = 
Logger.getLogger(DailyDataActionBean.class);

private DailyDataImageService imgService = new DailyDataImageService();

private ImgCal imgCal;

private int curMonth;
private int prevCurMonth;
private int curYear;

public int getCurMonth() {
return curMonth;
}

public void setCurMonth(int curMonth) {
this.curMonth = curMonth;
}

public int getCurYear() {
return curYear;
}

public void setCurYear(int curYear) {
this.curYear = curYear;
}

public ImgCal getImgCal() {
logger.debug(GET IMG CAL: );
if(this.imgCal == null) {
logger.debug(NULL!);
this.imgCal = imgService.getImageCalendar(getCurMonth(), 
getCurYear());
}
return imgCal;
}

public void setImgCal(ImgCal imgCal) {
this.imgCal = imgCal;
}

public int getPrevCurMonth() {
return prevCurMonth;
}

public void setPrevCurMonth(int prevCurMonth) {
this.prevCurMonth = prevCurMonth;
}


@DontValidate
@DefaultHandler
public Resolution view() {
logger.debug(VIEW BEING CALLED);
this.curMonth = imgService.getCurMonth();
this.curYear = imgService.getCurYear();
this.prevCurMonth = imgService.getCurMonth();

this.imgCal = imgService.getImageCalendar(getCurMonth(), getCurYear());

logger.debug(IMG CAL:  + getImgCal().getMonthHeader());
return new RedirectResolution(/DailyData.jsp);
}

@HandlesEvent(update)
@DontValidate
public Resolution update() {
logger.debug(In Update: month  + getCurMonth() +  year  + 
getCurYear());
imgCal = imgService.getImageCalendar(getCurMonth(), getCurYear());
prevCurMonth = curMonth;
return new RedirectResolution(/DailyData.jsp);
}
}

When the action is called, view() is called correctly.  The imgCal is then 
built correctly (I print it out to verify) and then the resolution to the jsp 
works right.  However, once getImgCal() is called from the jsp, imgCal is then 
null (all my bean parameters are then null).  I don't understand why everything 
is null after I've initialized them in view().  If I reinitialize everything 
inside their getters then everything works correctly, but this is extremely 
inefficient as it takes a long time to build imgCal.  I've also tried using the 
StripesStuff plugin and the @Session notation, with the same result.  Is there 
something I'm missing?  This seems like this should be very basic 
functionality.  I have other actions that work, so to my knowledge, I don't 
think the problem is with my web.xml or setup in general.  Any ideas?
--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Spring managed action beans - any change?

2009-06-24 Thread Newman, John W
The stripes-spring project is only for action beans.  This works for any 
stripes components (interceptors, converters, formatters, action bean context, 
factories, etc.) as well as fields in your action bean that are instantiated 
during binding.  I usually don't make entities spring beans, but I've seen some 
people do that..

And it's real simple... just extend object factory and put the package name in 
your Extension.Packages.  

IMO this is the cleanest way, ObjectFactory is the correct hook instead of 
sub-classing every factory.  This is probably one reason why it was created for 
1.6.  I'd like to see all the existing spring stuff deprecated, and a new 
SpringObjectFactory, EJB3ObjectFactory, etc make it into the trunk.
 
I haven't really had time to test it too thoroughly, I'm not sure why there are 
6 or so variants of newInstance in there. I did override the few that were 
actually referenced by another class within stripes to check my spring context 
first, and as far as I can tell it works great, very clean.

-Original Message-
From: Dmitri Colebatch [mailto:d...@colebatch.com] 
Sent: Wednesday, June 24, 2009 8:50 AM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] Spring managed action beans - any change?

 Using the current trunk (not released yet .. I can?t wait), I?ve extended 
 DefaultObjectFactory, and overrode the newInstance methods to look in my 
 spring context for a matching bean first.  This simple trick has given me 
 full transparent spring integration of all stripes components - action beans, 
 converters, interceptors, etc all configured in my spring context.  =)  I?ve 
 been waiting for this for a long time, can?t wait for this to make it into 
 production.  Now if I could just get jboss to do the same thing for servlet 
 listeners etc I?d be in great shape. =)

 If you can?t use the trunk or wait for 1.6, there?s not much hope.

What's the difference between this and the stripes spring work?  Is it
the same functionality, but built in?  Or does it do something else?

I'm perfectly happy to use trunk - this is just a little side-project.

Cheers,
Dim

--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Spring managed action beans - any change?

2009-06-24 Thread Newman, John W
I have not submitted a patch yet as the ObjectFactory stuff is still brand new 
and may undergo further changes at this point.   I haven't had a chance to test 
any of the the constructor args variants yet either.  This probably means I 
need to enhance the api for looking up beans, stripes' SpringHelper class might 
be what I need to look at.   And I'm actually using a singleton class for bean 
lookup this which I know is bad, but it can't be a spring bean so...

Basically I have the standard spring ServletContextListener, and on 
contextInitialized() I pass the servlet context to this singleton 
SpringBeanLocator thing that does the famous this.springContext = 
WebApplicationContextUtils.getRequiredWebApplicationContext(ctx);  and has 
methods like T T getBean(ClassT beanClass)


public class SpringObjectFactory extends DefaultObjectFactory {

  private SpringBeanLocator springBeanLocator;


  @Override
  public void init(Configuration configuration) throws Exception {
super.init(configuration);
this.springBeanLocator = SpringBeanLocator.getInstance();
  }


  @Override
  public T T newInstance(ClassT clazz) {
T springBean = springBeanLocator.getBean(clazz);
return springBean != null ? springBean : super.newInstance(clazz);
  }
  // other variants still need tested
}



From: Brandon Goodin [mailto:brandon.goo...@gmail.com]
Sent: Wednesday, June 24, 2009 10:36 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Spring managed action beans - any change?

That sound fantastic. Have you submitted a patch? You'll run up against the Tim 
(Mr Why would want to do that!!!? ;-) -- notice the wink don't hate me). 
There are several things that I like about the Stripes-Guice integration that i 
wrote. I didn't have to invent any annotations. I don't like that with my 
current implementation. It's super nice to simply allow the injection framework 
do all the work. With the Stripes-Spring I just had to override all the yucky 
object creation innards. I was looking to do the same with Spring. I'd love to 
see your 1.6 code as I have yet to add the 1.6 version to the Stripes-Guice or 
Stripes-Spring stuff. With Stripes-Spring I should be able to create consistent 
functionality across the 1.5 and 1.6 Stripes dependent versions. In the 
Stripes-Guice integration I have interceptor injection as well and the 
potential really to inject into any component.

Brandon Goodin
Silver Mind Software
http://www.silvermindsoftware.com
bgoo...@silvermindsoftware.commailto:bgoo...@silvermindsoftware.com
615-306-3652
http://www.linkedin.com/in/bgoodin

On Wed, Jun 24, 2009 at 9:04 AM, Newman, John W 
newma...@upmc.edumailto:newma...@upmc.edu wrote:
The stripes-spring project is only for action beans.  This works for any 
stripes components (interceptors, converters, formatters, action bean context, 
factories, etc.) as well as fields in your action bean that are instantiated 
during binding.  I usually don't make entities spring beans, but I've seen some 
people do that..

And it's real simple... just extend object factory and put the package name in 
your Extension.Packages.

IMO this is the cleanest way, ObjectFactory is the correct hook instead of 
sub-classing every factory.  This is probably one reason why it was created for 
1.6.  I'd like to see all the existing spring stuff deprecated, and a new 
SpringObjectFactory, EJB3ObjectFactory, etc make it into the trunk.

I haven't really had time to test it too thoroughly, I'm not sure why there are 
6 or so variants of newInstance in there. I did override the few that were 
actually referenced by another class within stripes to check my spring context 
first, and as far as I can tell it works great, very clean.

-Original Message-
From: Dmitri Colebatch [mailto:d...@colebatch.commailto:d...@colebatch.com]
Sent: Wednesday, June 24, 2009 8:50 AM
To: 
stripes-users@lists.sourceforge.netmailto:stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] Spring managed action beans - any change?

 Using the current trunk (not released yet .. I can?t wait), I?ve extended 
 DefaultObjectFactory, and overrode the newInstance methods to look in my 
 spring context for a matching bean first.  This simple trick has given me 
 full transparent spring integration of all stripes components - action beans, 
 converters, interceptors, etc all configured in my spring context.  =)  I?ve 
 been waiting for this for a long time, can?t wait for this to make it into 
 production.  Now if I could just get jboss to do the same thing for servlet 
 listeners etc I?d be in great shape. =)

 If you can?t use the trunk or wait for 1.6, there?s not much hope.

What's the difference between this and the stripes spring work?  Is it
the same functionality, but built in?  Or does it do something else?

I'm perfectly happy to use trunk - this is just a little side-project.

Cheers,
Dim

Re: [Stripes-users] Stripes tag - disabled=true will bind a null value?

2009-06-23 Thread Newman, John W
Yep, disabled form fields are not included in the HTTP post.  
http://www.w3.org/TR/html401/interact/forms.html#adef-disabled Stupid decision 
that only causes problems IMO..

You have to use readonly=true and some css to simulate disabled if you need it 
to be included the post.



From: CN Yee [mailto:yeec...@gmail.com]
Sent: Tuesday, June 23, 2009 2:25 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Stripes tag - disabled=true will bind a null value?

Hi,

I have a stripes:select disabled=true tag.
I just discovered that the disabled=true is setting null to my actionBean 
object.

Is that the intended behavior? Is there a way to disable it?

Many thanks
Yee
--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Spring managed action beans - any change?

2009-06-23 Thread Newman, John W
Hello,

Using the current trunk (not released yet .. I can’t wait), I’ve extended 
DefaultObjectFactory, and overrode the newInstance methods to look in my spring 
context for a matching bean first.  This simple trick has given me full 
transparent spring integration of all stripes components - action beans, 
converters, interceptors, etc all configured in my spring context.  =)  I’ve 
been waiting for this for a long time, can’t wait for this to make it into 
production.  Now if I could just get jboss to do the same thing for servlet 
listeners etc I’d be in great shape. =)

If you can’t use the trunk or wait for 1.6, there’s not much hope.



From: Dmitri Colebatch [mailto:d...@colebatch.com]
Sent: Tuesday, June 23, 2009 7:29 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Spring managed action beans - any change?

Hi All,

Its been a long time since I've been involved with Stripes, but I've recently 
started scratching an itch in my spare time and have been struggling with 
something.  I have a typical webapp, stripes/spring/hibernate and would like to 
use spring's tx support, however I want to use it on actionbeans rather than 
separately managed spring beans.  A little research shows me that this has been 
covered at quite some length - I've found a couple of different efforts in this 
area:

1. stripes-stuff-spring
http://article.gmane.org/gmane.comp.java.stripes.user/9051/match=spring+annotation
- Seems to have been abandoned - claims to need 1.6, I didn't get it working, 
and it doesn't seem to be mentioned much in general googling.

2. stripes-spring
http://stripesframework.org/display/stripes/Extended+Stripes-Spring+Support
- Doesn't allow me to use annotations, as is documented in a few posts around 
the place, the cglib actionbean subclass doesn't have the method annotations.

Everything I've found in these areas seems to be a little dated.  Am I right in 
thinking that its just not possible to do what I'd like to do (put a 
@Transactional attribute on a handler method within a stripes actionbean)?  
This seems like something that a few people have wanted already, but doesn't 
exist, so i assume there's a good reason behind it that I'm not seeing.

Thanks for any guideance.

Cheers,
Dim
--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Data validation

2009-06-17 Thread Newman, John W
The behavior is coming from SimpleDateFormat which stripes uses under the hood. 
See 
http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html#year  

For parsing, if the number of pattern letters is more than 2, the year is 
interpreted literally, regardless of the number of digits. So using the pattern 
MM/dd/, 01/11/12 parses to Jan 11, 12 A.D.

What we have done to prevent these valid dates from getting in, is extend 
DateTypeConverter and restricted the input to a particular date range.  I doubt 
dates from the year 12 are of any interest to your app. FYI, 1753 was a pretty 
crazy year and if you are persisting the date into a MS SQL database, it has to 
be between 01/01/1753 and 12/31/ anyway.  

We also use this jquery input mask plugin and the dhtml-calendar to help the 
user.  http://digitalbush.com/projects/masked-input-plugin/#demo  It works 
pretty well, but I did have to make some small changes to it to allow partial 
input and clear the mask on empty fields so they didn't get submitted.  You may 
find it useful, if so I can send the patch which has made it work correctly 
for us.

 




-Original Message-
From: Lionel [mailto:lio...@art-informatique.com] 
Sent: Wednesday, June 17, 2009 11:14 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Data validation

Hi all,

I'd like to force users to use the pattern dd/MM/ when they type a date.
By default, stripes allows lots of patterns.
To avoid mistakes, I want the same pattern for every user (I have french 
users on english or chinese computers)
I added the following key in my properties file:
stripes.dateTypeConverter.formatStrings=dd MM 

But it seems 01/01/9 is still valid and parsed as 01/01/0009.

I think a missed something.

I don't want to add a minlength=10 for all my dates.

Is it possible to do what I want ?




--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] access session from a TypeConverter

2009-06-08 Thread Newman, John W
Thread local FTW ... make a simple class with public static User 
getCurrentUser()  { return threadLocal.get(); }  .. set the user in there after 
access is granted to the event in your interceptor.

No more passing user all the way down to every call etc, it's always just right 
there in a static method.  Use of a ThreadLocal here is almost too good to be 
true,  things normally aren't this easy.

From: Poitras Christian [mailto:christian.poit...@ircm.qc.ca]
Sent: Monday, June 08, 2009 10:39 AM
To: 'Stripes Users List'
Subject: Re: [Stripes-users] access session from a TypeConverter

Another way would be to link session to a ThreadLocal inside an interceptor.

Christian


From: Daniil Sosonkin [mailto:dan...@orbisfn.com]
Sent: Monday, June 08, 2009 10:30 AM
To: Stripes Users List
Subject: Re: [Stripes-users] access session from a TypeConverter
This is for a trading application and my type converter converts a String that 
represents a ticker symbol into a Quote object. Due to security requirements, 
access control privileges, etc... I need to know some information about a user 
currently logged in before a Quote can be obtained from the provider. All that 
information is stored in the session.

Poatris - thank you for the recommendation. Unfortunately we don't use Spring 
anywhere and as a result I don't understand the code.

Still looking for a solution other than having String converted into Quote 
object in the ActionBeans. TypeConverter comes in very handy.

Sincerely,
Daniil

Richard Hauswald wrote:

What do you want to do in a type converter what needs a session?



On Fri, Jun 5, 2009 at 9:34 PM, Daniil 
Sosonkindan...@orbisfn.commailto:dan...@orbisfn.com wrote:



Here's a good one. I have a TypeConverter that needs to access some

variables for the current session. So far, I haven't found a way of doing

that via library. I could be missing something. Can someone point me in the

right direction?



Daniil



--

OpenSolaris 2009.06 is a cutting edge operating system for enterprises

looking to deploy the next generation of Solaris that includes the latest

innovations from Sun and the OpenSource community. Download a copy and

enjoy capabilities such as Networking, Storage and Virtualization.

Go to: http://p.sf.net/sfu/opensolaris-get

___

Stripes-users mailing list

Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/stripes-users









--

OpenSolaris 2009.06 is a cutting edge operating system for enterprises

looking to deploy the next generation of Solaris that includes the latest

innovations from Sun and the OpenSource community. Download a copy and

enjoy capabilities such as Networking, Storage and Virtualization.

Go to: http://p.sf.net/sfu/opensolaris-get

___

Stripes-users mailing list

Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] [stripes-users] synchronized Resolution ?

2009-05-26 Thread Newman, John W
We've hacked a good bit around the double submit problem.  Redirect after post 
is certainty a must, but they can still click the button twice and send 2 
requests, which will still cause problems.

Javascript is probably the best way to do it, syncing server-side like that 
scares me and prevents 2 windows.  We block anyone without js turned on, via a 
meta refresh in a noscript - fortunately we are able to do this.  A web app 
that has to work for users without javascript would really suck to do.. ugggh..

We have this code with prototype  jquery that seems to work quite well: 
anything that causes a post has class=trigger, id=somethingUnique, and the 
submit happens in the onclick function.
 
Lock.js: 
// a map of form submitting trigger elements that are locked.  ($H is 
prototype's hash)
var lockedTriggers = $H();

// lock all visible triggers on the page and stash their event handlers
// called when a submit happens
function lock()  {
$j('.trigger:visible').each(function()  {
lockedTriggers.set(this.id, this.onclick);
this.onclick = function() { return false; };
});
}

// clean out the map, find the element on the page and restore the onclick
// only called from the onComplete callback for ajax, not needed if the page is 
wiped out
function unlock()  {
lockedTriggers.each(function(entry) {
var id = entry.key;
var trigger = $(id);
if (trigger)  {
trigger.onclick = entry.value;
}
lockedTriggers.unset(id);
});
}

input type=button value=Submit class=trigger red id=submitButton_1 
onclick=this.form.submit(); /

Footer page:
script type=text/javascript
$j('form').submit(function(event){ // whenever any form 
submits, lock any trigger on the page so they can't click it again
lock();
showLoadingIndicator();
return true;
});
/script

=)
 
-Original Message-
From: Laurent Perez [mailto:hak...@gmail.com] 
Sent: Monday, May 25, 2009 7:44 PM
To: Stripes Users List
Subject: Re: [Stripes-users] [stripes-users] synchronized Resolution ?

Thanks for the clarifications.

We finally figured out the problem, there was a thread safety issue
caused by an unhandled double submit.

laurent


2009/5/25 Ben Gunter gunter...@gmail.com:
 Normally, each request gets its own instance of an ActionBean class so you
 don't have to worry about synchronization in the ActionBean itself. It is
 possible that your ActionBean uses another class that is not thread-safe.

 If you use @SessionScope, then one instance of the ActionBean class is
 created per session so thread-safety is a bit of a concern there.

 -Ben

 On Mon, May 25, 2009 at 9:13 AM, Laurent Perez hak...@gmail.com wrote:

 Hi

 I'm trying to figure out an error randomly repeating itself on a
 production system, which I can't reproduce locally. Stripes version is
 1.5.

 I believe this may be linked to concurrency issues, however, I'm not
 sure if this could happen : are ActionBean expected to be thread-safe
 ? By thread-safe, I mean can I run into unexpected problems whenever
 two different browsers hit the same method of an ActionBean ? Is the
 ActionBeanContext safe, too ?

 If so, is it meaningfull to synchronize sensitive Resolutions, as in
 public synchronized Resolution process() {}, or would it make no
 difference ?

 Thanks
 laurent


 --
 Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
 is a gathering of tech-side developers  brand creativity professionals.
 Meet
 the minds behind Google Creative Lab, Visual Complexity, Processing, 
 iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
 Group, R/GA,  Big Spaceship. http://www.creativitycat.com
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users





-- 
a href=http://in-pocket.blogspot.com;http://in-pocket.blogspot.com
- Mobile world, technology and more/a

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA,  Big Spaceship. http://www.creativitycat.com 
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a 

Re: [Stripes-users] Filtering output from options-enumeration

2009-05-21 Thread Newman, John W
That is a separate lack-of-feature then, you should create a ticket in jira to 
get that added to the enumeration tag.

Alternatively you could not use that tag, and instead use a for-each loop over 
the enum.values() method and render a single stripes:option or option tag for 
each enum constant.  =)

-Original Message-
From: Stone, Timothy [mailto:tst...@barclaycardus.com] 
Sent: Wednesday, May 20, 2009 5:04 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Filtering output from options-enumeration

Ben Gunter seems to be on to a half-fix... half-fix because
options-enumeration is empty, no tag body. I'm stuck with re-encoded
entities. No good.

Tim

 -Original Message-
 From: Newman, John W [mailto:newma...@upmc.edu] 
 Sent: Wednesday, May 20, 2009 4:42 PM
 To: Stripes Users List
 Subject: Re: [Stripes-users] Filtering output from options-enumeration
 
 I think this one 
 http://www.stripesframework.org/jira/browse/STS-251 is related ... 
 
 -Original Message-
 From: Stone, Timothy [mailto:tst...@barclaycardus.com] 
 Sent: Wednesday, May 20, 2009 3:58 PM
 To: Stripes Users List
 Subject: [Stripes-users] Filtering output from options-enumeration
 
 I need to get the output of an options-enumeration un-encoded.
 
 Consider the following:
 
 public enum GPA {
   F   (1, lt;2.00),
   D   (2, 2.00#8211;2.49),
   C   (3, 2.50#8211;2.99),
   B   (4, 3.00#8211;3.49),
   A   (5, 3.50#8211;3.99),
   A_PLUS  (6, 4.00),
   OTHER   (0, Other);
 
 ...
 
 public String getGpa() { return this.gpa; }
 
 ...
 
 
 The output from the options-enumeration results in:
 
 option value=Famp;lt;2.00/option
 option value=D2.00amp;#8211;2.49/option
 ...
 ...
 
 This might be good for most users, but bad for me/us, as we are using
 entity notations like the endash to express ranges, e.g., 
 #8211; (the
 correct use of endashes*). 
 
 Any ideas for a workaround? I'm considering something in the return
 method, but I think something is happening in the tag itself 
 that would
 defeat me.
 
 Thanks,
 Tim
 
 PS. #8211; is an endash. It is specifically used to indicate ranges
 (http://www.alistapart.com/articles/emen/)
 
 --
 
 Timothy Stone  |  Application Developer Technical Lead
 Strategic Development, Business Technology Group  |  Barclaycard US
 direct 302.255.8044  |  cell 410.441.9450
 
 COMPANY CONFIDENTIAL
 
 
 
 Barclays www.barclaycardus.com
 
 This e-mail and any files transmitted with it may contain 
 confidential and/or proprietary information. It is intended 
 solely for the use of the individual or entity who is the 
 intended recipient. Unauthorized use of this information is 
 prohibited. If you have received this in error, please 
 contact the sender by replying to this message and delete 
 this material from any system it may be on.
 
 
 
 --
 
 Crystal Reports - New Free Runtime and 30 Day Trial
 Check out the new simplified licensing option that enables 
 unlimited royalty-free distribution of the report engine 
 for externally facing server and web deployment. 
 http://p.sf.net/sfu/businessobjects
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users
 
 --
 
 Crystal Reports - New Free Runtime and 30 Day Trial
 Check out the new simplified licensing option that enables 
 unlimited royalty-free distribution of the report engine 
 for externally facing server and web deployment. 
 http://p.sf.net/sfu/businessobjects
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users
 
 


Barclays www.barclaycardus.com

This e-mail and any files transmitted with it may contain confidential and/or 
proprietary information. It is intended solely for the use of the individual or 
entity who is the intended recipient. Unauthorized use of this information is 
prohibited. If you have received this in error, please contact the sender by 
replying to this message and delete this material from any system it may be on.



--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Register Now for Creativity and Technology (CaT), June 3rd

Re: [Stripes-users] Vedr.: Re: options-collection tag and selections

2009-04-28 Thread Newman, John W
Yeah I ran into this awhile ago.  See 
http://www.nabble.com/Can-I-extend-InputSelectTag-and-drop-in--to20919043.html#a20920018

What I did was extend input select tag, override the is option selected method 
with object.equals(other).  I also had to copy the stripes tld, strip all the 
other tags out except select, and replace the class name with mine.  Then of 
course I had to reference the new tld in the app.  Works much closer to what 
I'd expect, I'm not sure why the existing tag does something like  
format(o.toString()).equals(format(o2.toString()) instead of o.equals(o2)


From: d...@sparnord.dk [mailto:d...@sparnord.dk]
Sent: Tuesday, April 28, 2009 9:21 AM
To: Stripes Users List
Subject: [Stripes-users] Vedr.: Re: options-collection tag and selections


Right,

But my problem is that I am also using toString() for another purpuse, and I'd 
kind of like to keep doing that.

I was looking into the value= attribute of the stripes:select tag, but that 
doesn't seem to work as expected either.

-dennis


Morten Matras kodekon...@gmail.com skrev den 28-04-2009 14:54:44:

 What I've done is to make the toString return the id of the object.
 It's not perfect, but it solves your issue.

 Regards

 Morten Matras
 Consultant Blob Communication ApS, Odense, Denmark

 2009/4/28 d...@sparnord.dk

 Hi,

 In the documentation of the options-collecton tag there is the following:

 would cause the container to look for a Collection called cats
 across the various JSP scopes and set it on the tag. The tag
 would then proceed to iterate through that collection calling
 getCatId() and getName() on each cat to produce HTML option tags.

 In my case let's say I'm displaying a collection of Cat instances.
 When the tag (through the option tag)
 determines if each option is selected it seems to be using the
 toString() method of the selected cat and
 comparing this to the getCatId() value.

 Should it be like that? Any ideas on how to work around this?

 -dennis
 --
 Register Now  Save for Velocity, the Web Performance  Operations
 Conference from O'Reilly Media. Velocity features a full day of
 expert-led, hands-on workshops and two days of sessions from industry
 leaders in dedicated Performance  Operations tracks. Use code vel09scf
 and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users




 --
  Morten Matras
  Consultant
  Blob Communication ApS
  Svendsagervej 42
  DK-5240 Odense NØ
  P: (+45) 76 6-5-4-3-2-1
  W: www.blobcom.com
  E: morten.mat...@gmail.com
 --
 Register Now  Save for Velocity, the Web Performance  Operations
 Conference from O'Reilly Media. Velocity features a full day of
 expert-led, hands-on workshops and two days of sessions from industry
 leaders in dedicated Performance  Operations tracks. Use code vel09scf
 and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users
--
Register Now  Save for Velocity, the Web Performance  Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance  Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Large file upload does not stop after FileUploadLimitExceededException

2009-04-20 Thread Newman, John W
You said you have handle(FileUPloadExcceded) in DelegatingExceptionHandler ...

Take a look at its parent class DefaultExceptionHandler  - you are overriding 
this:

/**
 * p
 * {...@link FileUploadLimitExceededException} is notoriously difficult to 
handle for several
 * reasons:
 * ul
 * liThe exception is thrown during construction of the {...@link 
StripesRequestWrapper}. Many
 * Stripes components rely on the presence of this wrapper, yet it cannot 
be created normally./li
 * liIt happens before the request lifecycle has begun. There is no 
{...@link ExecutionContext},
 * {...@link ActionBeanContext}, or {...@link ActionBean} associated with 
the request yet./li
 * liNone of the request parameters in the POST body can be read without 
risking denial of
 * service. That includes the {...@code _sourcePage} parameter that 
indicates the page from which
 * the request was submitted./li
 * /ul
 * /p
 * p
 * This exception handler makes an attempt to handle the exception as 
gracefully as possible. It
 * relies on the HTTP Referer header to determine where the request was 
submitted from. It uses
 * introspection to guess the field name of the {...@link FileBean} field 
that exceeded the POST
 * limit. It instantiates an {...@link ActionBean} and {...@link 
ActionBeanContext} and adds a
 * validation error to report the field name, maximum POST size, and actual 
POST size. Finally,
 * it forwards to the referer.
 * /p
 * p
 * While this is a best effort, it won't be ideal for all situations. If 
this method is unable
 * to handle the exception properly for any reason, it rethrows the 
exception. Subclasses can
 * call this method in a {...@code try} block, providing additional 
processing in the {...@code catch}
 * block.
 * /p
 * p
 * A simple way to provide a single, global error page for this type of 
exception is to override
 * {...@link #getFileUploadExceededExceptionPath(HttpServletRequest)} to 
return the path to your
 * global error page.
 * p
 * 
 * @param exception The exception that needs to be handled
 * @param request The servlet request
 * @param response The servlet response
 * @return A {...@link Resolution} to forward to the path returned by
 * {...@link 
#getFileUploadExceededExceptionPath(HttpServletRequest)}
 * @throws FileUploadLimitExceededException If
 * {...@link 
#getFileUploadExceededExceptionPath(HttpServletRequest)} returns null or
 * this method is unable for any other reason to forward to the 
error page
 */
protected Resolution handle(FileUploadLimitExceededException exception,
HttpServletRequest request, HttpServletResponse response)
throws FileUploadLimitExceededException {
// Get the path to which we will forward to display the message
final String path = getFileUploadExceededExceptionPath(request);
if (path == null)
throw exception;

final StripesRequestWrapper wrapper;
final ActionBeanContext context;
final ActionBean actionBean;
try {
// Create a new request wrapper, avoiding the pitfalls of multipart
wrapper = new StripesRequestWrapper(request) {
@Override
protected void constructMultipartWrapper(HttpServletRequest 
request)
throws StripesServletException {

setLocale(configuration.getLocalePicker().pickLocale(request));
}
};

// Create the ActionBean and ActionBeanContext
context = 
configuration.getActionBeanContextFactory().getContextInstance(wrapper,
response);
actionBean = 
configuration.getActionResolver().getActionBean(context);
wrapper.setAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN, 
actionBean);
}
catch (ServletException e) {
log.error(e);
throw exception;
}

// Try to guess the field name by finding exactly one FileBean field
String fieldName = null;
try {
BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
if (FileBean.class.isAssignableFrom(pd.getPropertyType())) {
if (fieldName == null) {
// First FileBean field found so set the field name
fieldName = pd.getName();
}
else {
// There's more than one FileBean field so don't use a 
field name
fieldName = null;
break;
}
}
}
}
catch (Exception e) {
// Not a big deal if we can't 

Re: [Stripes-users] Problems with FlashScope - Lifetime of Object

2009-04-20 Thread Newman, John W
This works for the most cases, but not for mine. Because I have to save 
a more complex object and references within this object have to keep 
alive too. So I think the way of buffering these object into hidden 
fields is not a good idea in this special case.

Can you explain why you can't reconstruct everything? I probably don't know 
nearly enough about your use case, but I can't see why you can't rebuild 
everything.

We do have one section of a site that is basically a wizard.  We started with 
just using the session but this wasted too much server resources under load, 
plus some users don't understand session timeouts and will open a support 
ticket.  Generally I try to avoid the session as much as possible.  I looked at 
@Wizard, but decided there are too many events and too many logical branches, 
so an @Wizard bean could be somewhat unwieldy (split into two action beans 
right now).  We are just writing out all the properties of this object manually 
which is pretty lousy, but I don't see any reason why we couldn't use an xml or 
json library to write the data of this whole object out into one field.  
(encrypted).  You might be able to do that.  Then the real fields on the page 
would get bound in afterward and augment/overwrite the giant xml field.

I also thought it might be useful if there were a stripes:complexHidden 
name=someComplexThing / tag that went out over the graph and deeply wrote 
out stripes:hidden tags for all the leaf nodes.  I think the code to do the 
heavy lifting is already somewhere within stripes, if anyone thinks this 
feature is useful enough it probably wouldn't be too difficult to write.

-Original Message-
From: Christoph Oberhofer [mailto:zitronenmeli...@gmx.at] 
Sent: Monday, April 20, 2009 5:46 PM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] Problems with FlashScope - Lifetime of Object

Hi Christian,

thank you for the quick response and very good explanation.

Poitras Christian wrote:
 You have a many possibilities. But unless you put the ActionBean in session 
 (@SessionScope), a new instance will be created for each request.
 1) Use @SessionScope. See 
 http://www.stripesframework.org/display/stripes/annotation+reference#annotationreferen...@sessionscope
 Only one instance of this ActionBean will exists for each session.

Okey, this seems to be the only good approach for my problem I think, 
because everything stays the way it was before. Even the objects are the 
same (Reference).

 2) Use @Wizard. See 
 http://www.stripesframework.org/display/stripes/annotation+reference#annotationreferen...@wizard
 Request parameters that are not hidden in page will be automatically added at 
 the end of the form in hidden fields. This is the closest solution to what 
 you want.

This works for the most cases, but not for mine. Because I have to save 
a more complex object and references within this object have to keep 
alive too. So I think the way of buffering these object into hidden 
fields is not a good idea in this special case.

 3) Use @Session on the complex fields. See 
 http://www.stripesframework.org/display/stripes/Save+ActionBean+fields+in+session

This is also possible for me, thanks for it.

 4) Save complex fields in session manually: 
 getContext().getSession().setAttribute().

Okey, this is the exact same way I'm doing it now. But not as nice as 
the annotaion things.

 The reason FlashScope does not work is that it exists only to execute 
 redirect-after-post.
 It is well documented here: 
 http://www.stripesframework.org/display/stripes/State+Management#StateManagement-RedirectafterPost

Thanks for this explanation. I read this paragraph many times, but could 
not really understand it. Especially this sentence confused me:

This list is stored in flash scope so that the messages are available 
to the current request (should the ActionBean forward to a page) and in 
the next request (should the ActionBean redirect to a page).

and I thought this value will be available in the next request too, but 
thanks for the explanation anyway.

Regards,
Christoph

 -Original Message-
 From: Christoph Oberhofer [mailto:zitronenmeli...@gmx.at]
 Sent: Monday, April 20, 2009 4:36 PM
 To: stripes-users@lists.sourceforge.net
 Subject: [Stripes-users] Problems with FlashScope - Lifetime of Object
 
 Hi there,
 
 What I want to achieve:
 I want to make a wizard which goes from one step to another and saves a 
 complex object between all these requests. I thought about FlashScope but it 
 does not work the way I want.
 
 I have troubles when using the FlashScope - approach to store Objects between 
 two requests. The problem is, that the ActionBean which I flash is not 
 populated in the next request. Which means, regarding to the example at the 
 end, when the method step2 is called, the Set is null.
 But why?
 
 Anyone an idea how to store and repopulate ActionBeans for using ONE and the 
 SAME instance for the whole wizard?
 
 

Re: [Stripes-users] Dynamic Radio Button List

2009-04-17 Thread Newman, John W
Hm try this ..


stripes:radio name=isDefault id=isDefault${stat.index} 
value=${dashboard.defaultDashboard} /

or this

stripes:radio name=isDefault id=isDefault${stat.index} 
value=${dashboard.defaultDashboard} 
checked=${dashboard.defaultDashboard} /

I will agree the checked/value attributes with radios can be tricky.  I have 
freemarker code to generate a list of radio buttons for a collection of 
objects, so it can be done just fine, but we don't use the checked attribute 
since it is auto checked from the bean first population strategy and an @Before 
method to load the objects up for the page.  =)  If the 2nd one works but the 
1st one doesn't, take a look at switching your population strategy - some agree 
that the default is not as smooth as bean first.

If neither work, well, have a good weekend. :P

-Original Message-
From: jborys [mailto:john_bo...@comcast.net] 
Sent: Friday, April 17, 2009 4:14 PM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] Dynamic Radio Button List


Nope.   Gives the same error as my code.

Mike McNally-3 wrote:
 
 The error probably came from trying to get the checked attribute in
 there conditionally. What should work instead is
 
   s:radio ... checked='${predicate ? true : false}' ... /
 
 
 On Fri, Apr 17, 2009 at 11:40 AM, jborys john_bo...@comcast.net wrote:

  s:checkbox id=isDefault${stat.index} name=isDefault
 checked=${dashboard.defaultDashboard} /

  I changed this code to this:

 input type=radio id=isDefault${stat.index} name=isDefault
 value=${dashboard.defaultDashboard} ${(dashboard.defaultDashboard) ? '
 checked=checked' : ''}    /

 And it does the job.  But for some reason I can not use the the stripes
 radio tag.  It can't seem to translate it. Instead I get this error:

 org.apache.jasper.JasperException:
 /dashboard/manage_dashboards.jsp(132,78)
 Unterminated lt;s:radio tag

 Oh well.  I guess I don't have to use the Stripes tag.

 Do you ever feel like your have a conversation all by yourself?

 Me neither.



 --
 Stay on top of everything new and different, both inside and
 around Java (TM) technology - register by April 22, and save
 $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
 300 plus technical and hands-on sessions. Register today.
 Use priority code J9JMT32. http://p.sf.net/sfu/p
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users



 --
 View this message in context:
 http://www.nabble.com/Dynamic-Radio-Button-List-tp23097529p23101308.html
 Sent from the stripes-users mailing list archive at Nabble.com.


 --
 Stay on top of everything new and different, both inside and
 around Java (TM) technology - register by April 22, and save
 $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
 300 plus technical and hands-on sessions. Register today.
 Use priority code J9JMT32. http://p.sf.net/sfu/p
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users

 
 
 
 -- 
 Turtle, turtle, on the ground,
 Pink and shiny, turn around.
 
 --
 Stay on top of everything new and different, both inside and 
 around Java (TM) technology - register by April 22, and save
 $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
 300 plus technical and hands-on sessions. Register today. 
 Use priority code J9JMT32. http://p.sf.net/sfu/p
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users
 
 

-- 
View this message in context: 
http://www.nabble.com/Dynamic-Radio-Button-List-tp23097529p23105188.html
Sent from the stripes-users mailing list archive at Nabble.com.


--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical 

[Stripes-users] Adding freemarker servlet into stripes mock container tests?

2009-04-14 Thread Newman, John W
Hello,

We are in the midst of writing some concurrent integration tests of this 
application using MockRoundtrip.  It's pretty neat, we can run all these 
concurrent tests concurrently in a while(true) loop to simulate real live usage 
of the app with N users doing every possible operation.  The major limitation 
is the 32 bit OS has a pretty low thread count limit (~400 depending on stack 
size).

The other issue is, ½ of the server side code isn't hit with these tests - 
namely freemarker servlet's template processing.  I'd love to extend the 
stripes mock API to pass forwards onto FM servlet, run through the template 
processing code and verify that the template processed fine with no exceptions 
being thrown.  I also need to time some of the templates for performance.

I understand the mock api was never designed with this sort of thing in mind,
Being mock objects, and not a full servlet container, there are several 
limitations of which you should be aware:

 *   There's no URL matching; all Filters are applied to every request
 *   A MockServletContext supports only a single Servlet, so you can only test 
on thing at a time
 *   Forwards, Redirects and Includes are not processed (but information about 
them is recorded for verification)
But I think it might be time to add this in, any ideas how I would go about 
adjusting the behavior of the second two points (url matching could come last)? 
 Has anyone already done this?
I have extensions of MockServletContext and MockRequestDispatcher but this is 
looking like it will be somewhat involved..  I've replaced private Servlet 
servlet with private SetServlet servlets; but now the dispatcher has to have 
mappings etc.
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Password Logging as plain text

2009-04-14 Thread Newman, John W
Yeah, it probably shouldn't log stripes:password values, but really that post 
has to be under SSL or you're still open to much larger problems. 

Unencrypted Login Form/Password Sent in the Clear
An unencrypted login form has been discovered. Any area of a web application 
that possibly contains sensitive information or access to privileged 
functionality such as remote site administration functionality should utilize 
SSL or another form of encryption to prevent login information from being 
sniffed or otherwise intercepted or stolen. A page containing a login form 
should be SSL as well as the Action of the form. This will prevent 
Man-in-the-Middle attacks on the login form. Recommendations include ensuring 
that sensitive areas of your web application have proper encryption protocols 
in place to prevent login information and other data that could be helpful to 
an attacker from being intercepted.

SOLUTION
For Security Operations:
Ensure that sensitive areas of your web application have proper encryption 
protocols in place to prevent login information and other data that could be 
helpful to an attacker from being intercepted.

For Development:
Ensure that sensitive areas of your web application have proper encryption 
protocols in place to prevent login information and other data that could be 
helpful to an attacker from being intercepted.

For QA:
Test the application not only from the perspective of a normal user, but also 
from the perspective of a malicious one.



-Original Message-
From: Thomas Schlosser [mailto:tho...@schlosser-home.de] 
Sent: Tuesday, April 14, 2009 3:17 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Password Logging as plain text

Hi,
I have found out that stripes logs the values(also values from 
stipes-password-tag) as plain text, when the Validation-annotation is 
used with the required-param.
2009-04-14 17:13:08,246 DEBUG [http-8080-Processor25] (Log.java:183) - 
Checking required field: password, with values: [secret]

I think this is a security hole, therefore I wrote my own 
ActionBeanPropertyBinder and removed the logging of the value.
But isn't it a generally problem, which should be fixed in the 
DefaultActionBeanPropertyBinder?

Cheers,
Thomas

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Can I get init-params out of web.xml? (BootstrapPropertyResolver)

2009-04-07 Thread Newman, John W
 looking at DefaultConfiguration, wouldn't it be possible to wrap the 
BootstrapPropertyResolver passed to setBootstrapPropertyResolver in your 
RuntimeConfiguration subclass? So you'd have something like

@Override
public void setBootstrapPropertyResolver(BootstrapPropertyResolver 
resolver) {

super.setBootstrapPropertyResolver(DecoratedBootstrapPropertyResolver(resolver));
}

That way, you could override certain properties, whereas you can fall back to 
the default bootstrap property resolver when needed.

Regards,
  Levi
On Tue, Apr 7, 2009 at 4:47 PM, Newman, John W 
newma...@upmc.edumailto:newma...@upmc.edu wrote:

Hello,



We are currently revisiting all this property file/filtering mess in our app.   
 One thing we had setup was to put all config settings in a master property 
file, and use maven resource filtering in web.xml.



init-param

  param-nameActionResolver.Packages/param-name

  param-value

${stripes.actionPackages}

  /param-value

/init-param

init-param

  param-nameActionBeanContext.Class/param-name

  param-value${stripes.actionBeanContextClass}/param-value

/init-param

init-param

  param-nameInterceptor.Classes/param-name

  param-value

${stripes.interceptorClasses}

  /param-value

/init-param



We used to have these hard coded, but they started changing from env to env so 
we moved them into our filter files.  Now we are experimenting with some 
cleaner spring classes for this, but we're not able to get web.xml filtered 
like that.  So I'm looking to remove these settings from here, and set them in 
the code of our Configuration subclass with 
appProperties.getString(stripes.actionPackages)



However digging through the stripes code a bit it appears this is not possible? 
 Configuration just grabs the BootstrapPropertyResolver and goes through 
web-xml etc.  It doesn't appear there is a way to customize this behavior?  It 
looks like they must be specified in web.xml.  Can I just put dummy values in 
there and change them at a later point?



Also if anyone knows of a simple easy best practice solution for international, 
multi env app property management please share.  We haven't really run across a 
tried and true best practice approach for this, it seems like everyone does 
something different and it ends up getting tricky in the end.



Thanks

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] tieTYT blog post Wicket/Stripes

2009-03-27 Thread Newman, John W
p wicket:id=messageThis is replaced/p

public HelloWorldPage() {
   Label component = new Label(message, Hello World!);
   add(component);
   add(new Label(wicketId, dynamicTitle);.
}

UGH  ... Why would you want to write an app like that?  It's like a swing app, 
which is ok, except you still _have_ the template only you've moved what would 
be simple template code into their strange java api.  If that's really how you 
add the title to the page I'd imagine new developers will be bringing up the 
javadoc for a long time.  I've looked at the stripes java doc maybe 15 times 
over 2 years, it's so simple the wiki covers 80% in 60 minutes.
 
I might give it a try just to see how awkward it is, maybe it eventually leads 
to benefits and I am being shortsighted.  I definitely buy the 'more java code 
is good for refactoring tools' argument.  Even if you use wicket and refactor 
like crazy you still have to go over your templates by hand like stripes ... so 
at the end of the day it's probably not a huge gain.  I'd like to see a 
reasonably sized example, like the stripes calculator written in wicket.  

 
-Original Message-
From: Mike McNally [mailto:emmecin...@gmail.com] 
Sent: Friday, March 27, 2009 10:08 AM
To: Stripes Users List
Subject: Re: [Stripes-users] tieTYT blog post Wicket/Stripes

Well to each his own, and that's one nice thing about the Java
framework world - there's something for everybody. However I looked at
Wicket and Tapestry for a while and could never figure out why anybody
would ever want to write an application that way, so I decided it must
be one of those basic brain wiring issues. I suppose my preferences
seem bizarre to a Wicket fan :-)


On Fri, Mar 27, 2009 at 8:52 AM, VANKEISBELCK Remi r...@rvkb.com wrote:
 I think it's the first really negative post I read about Wicket, and I
 second Freddy, it's nicely written, good points.

 Cheers

 Remi

 2009/3/27 Freddy Daoud xf2...@fastmail.fm:
 A nice nod to Stripes at the end.
 Nice write-up, tieTYT!

 http://tietyt.blogspot.com/2009/03/top-8-reasons-i-dont-use-wicket.html



 --
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users


 --
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users




-- 
Turtle, turtle, on the ground,
Pink and shiny, turn around.

--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Streaming FTL Pages for AJAX

2009-03-26 Thread Newman, John W
I've been through all that before, I think that snippet came from me.  You can 
actually just do

return new ForwardResolution(/WEB-INF/template.ftl);

And the container will process the template and the text will end up in your 
div.  It's nice when things just work like that.



-Original Message-
From: Mick [mailto:ruaspam...@gmail.com] 
Sent: Thursday, March 26, 2009 1:09 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Streaming FTL Pages for AJAX

I would like to return the output of FreeMarker templates to the client as a
file and for use in AJAX calls rather than using the standard forward
resolution. Is there a way to access the Stripes FTL configuration so that I can
simply get the templates myself rather than creating a new FTL configuration and
merging the bean data?

The closest thing I saw in the list is this:
return new StreamingResolution(text/html, freemarkerUtil.process(
someTemplate, dataModel));

But it appears that freemarkerUtil is a custom function written by the message
author.


--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Streaming FTL Pages for AJAX

2009-03-26 Thread Newman, John W
Can you post your freemarkerUtil.process() code?

Nope, it has long since been deleted since we found out that forward works.  
You don't want/need to do that anyway.  The IE issue you are having is due to 
the character encoding is not set for freemarker servlet in web.xml.

servlet
servlet-nameFreemarker/servlet-name
servlet-class
freemarker.ext.FreemarkerServlet/servlet-class
init-param
param-nameTemplatePath/param-name
param-value//param-value
/init-param
init-param
param-namedefault_encoding/param-name
param-valueUTF-8/param-value
/init-param
init-param
param-nameoutput_encoding/param-name
param-valueUTF-8/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

Adjust utf-8 to whatever you require.  Without setting those IE will ignore 
ajax input.  Quirks 


For some reason we have this snippet as well, try adding those 2 settings 
above, and if it still doesn't work try adding this as a param to stripes 
filter:
init-param
param-nameLocalePicker.Locales/param-name
param-valueen_US:UTF-8/param-value
/init-param



-Original Message-
From: Mick [mailto:ruaspam...@gmail.com] 
Sent: Thursday, March 26, 2009 3:28 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Streaming FTL Pages for AJAX

Yea I am just trying to fill the contents of a div with AJAX. I though it would
be as easy as you said. The normal forward works fine in FireFox but fails in
IE. Can you post your freemarkerUtil.process() code?

This works in both IE and FireFox:
  Java: return new StreamingResolution(text/json, jsonStr);
  JS:   $.get(uoutputDiv.text(eval(data)['result']);

This works in FireFox but fails in IE: 
  Java: return new ForwardResolution(page_fragment.ftl);
  JS:   $('#ajaxContentDiv').load(url1);

I know that I can make it work in IE if I just return the page fragment in a
SteamingResolution. I would prefer to access the FreeMarker configuration that
is already configured by Stripes rather than configuring a second instance for
streaming templates.



--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Problems with @ValidationMethod

2009-03-20 Thread Newman, John W
I believe this line return new ForwardResolution(VIEW);

Should be return getContext().getSourcePageResolution(); since you are adding 
errors  ?

I have seen this stack trace at random points in the past but never frequent 
enough to actually do anything about it.  I haven't seen it pop up for several 
months.

From: CN Yee [mailto:yeec...@gmail.com]
Sent: Friday, March 20, 2009 7:24 AM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] Problems with @ValidationMethod

Hi Marcus,

What I did was like the following, syntax could be a bit off:

public Resolution save() {
... check for error...
if (errorFound) {
SimpleError error = new SimpleError(Error found!);
getContext().getValidationErrors().addGlobalError(error);
SimpleMessage msg = new SimpleMessage(Double check);
getContext().getMessages.add(msg);
return new ForwardResolution(VIEW);
}
...
}


Sorry I am using gmail to post the reply - I could not figure out how to place 
my message under yours.

Regards,
Yee
--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Problems with @ValidationMethod

2009-03-20 Thread Newman, John W
This is probably a bug then.  I would file a report in jira.


-Original Message-
From: M.C.S. [mailto:m...@syn-online.de] 
Sent: Friday, March 20, 2009 12:13 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Problems with @ValidationMethod

Hi John,

in general I would agree with you, but in this special case (using
layout-render) the usage of getContext().getSourcePageResolution()
raises the described exception. By using a forward resolution to a
concrete view, no exception is thrown. Surely a workaround, but it works ;-)

Greetings,
Marcus


Newman, John W schrieb:

 I believe this line return new ForwardResolution(VIEW);

  

 Should be return getContext().getSourcePageResolution(); since you are
 adding errors  ?

  

 I have seen this stack trace at random points in the past but never
 frequent enough to actually do anything about it.  I haven’t seen it
 pop up for several months.

  

 *From:* CN Yee [mailto:yeec...@gmail.com]
 *Sent:* Friday, March 20, 2009 7:24 AM
 *To:* stripes-users@lists.sourceforge.net
 *Subject:* Re: [Stripes-users] Problems with @ValidationMethod

  

 Hi Marcus,

 What I did was like the following, syntax could be a bit off:

 public Resolution save() {
 ... check for error...
 if (errorFound) {
 SimpleError error = new SimpleError(Error found!);
 getContext().getValidationErrors().addGlobalError(error);
 SimpleMessage msg = new SimpleMessage(Double check);
 getContext().getMessages.add(msg);
 return new ForwardResolution(VIEW);
 }
 ...
 }


 Sorry I am using gmail to post the reply - I could not figure out how
 to place my message under yours.

 Regards,
 Yee

 

 --
 Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
 powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
 easily build your RIAs with Flex Builder, the Eclipse(TM)based development
 software that enables intelligent coding and step-through debugging.
 Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
 

 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users
   


--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Need advice on dependent menu design

2009-03-17 Thread Newman, John W
Instead of manipulating the dom and creating option objects, why not just have 
the select box in its own jsp, surround it with a div, and use an ajax updater:

 
select id=firstSelect onchange=updateOtherOptions()/
div id=otherSelect
  jsp:include otherSelect.jsp /
/div

Other select.jsp
s:form partial=true beanclass=actionBean.beanclass
select .../
/s:form

function updateOtherOptions ()  {
var parameters = $('form').serialize(true);
parameters['_eventName'] = updateOtherOptions;
new Ajax.Updater('otherSelect', '/yourActionBeanUrl', 
{parameters: parameters});
}


@DontValidate
public Resolution updateOtherOptions()  {
// logic here to pull other menu options by looking at post- 
this can also be done in an @Before method
return new ForwardResolution(/otherSelect.jsp);
}


-Original Message-
From: Lionel [mailto:lio...@art-informatique.com] 
Sent: Tuesday, March 17, 2009 6:23 AM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] Need advice on dependent menu design

AK wrote:
 This is not specifically a Stripes issue, but I suspect someone here
 has dealt with this problem and can provide some advice.

 I'm trying to build a set of dependent drop-down menus, State and
 City.  When one of the 50 states is selected from the 1st drop-down,
 the City menu is populated with all the cities in that state.

 What's the best way to do something like this (w/ Stripes)?  Also,
 anyone know where I can get this data?!

Using any Javascript framework and a JavascriptResolution, it is really 
easy.

Something like this will do the work with Prototype:

new Ajax.Request(url, {
parameters: $(idSourceDropdown).name+'='+$F(idSourceDropdown),
onSuccess: function(request) {
$(destDropdown).options.length=0;

   eval(request.responseText).each(function(item, i){
 $(destDropdown).options[i] = new Option(item.label, item.value);

  });
},
method:'post'
});


In your actionBean:
Just populate a ListLabelValueBean and return new 
JavascriptResolution(theList) 




--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] srtripes:checkbox checked attribute

2009-02-19 Thread Newman, John W
Try BeanFirstPopulationStrategy instead of the default, request first.  I 
struggled with the checkboxes and radio button values a while ago, we switched 
to bean first which makes sense if you are using preactions to pull data.  
Since we made that switch stripes just works more like I'd expect.   Some will 
argue bean first should be default, especially now since preactions are widely 
encouraged as a best practice.

Can someone clear up why request first is the default?


From: Ross Sargant [mailto:rsarg...@tvrc.com]
Sent: Thursday, February 19, 2009 2:16 PM
To: Stripes Users List
Subject: [Stripes-users] srtripes:checkbox checked attribute

Hi,
  Can someone give me a quick explanation on the intended usage pattern for the 
stripes:checkbox checked attribute.
I feel like I'm fighting stripes somewhat when I use it so I might be missing 
something.

I'm generating a list of checkboxes to manage a many to many relationship in my 
db.  I use the checked attribute to pre-check the checkboxes indicating the 
current relationships when the page first loads. A preaction rounds up the 
necessary data.

table class=sortableResults
tr
th/th
thName/th
thEnabled/th
/tr
  c:forEach var=role items=${actionBean.allRoles}
tr
  tdstripes:checkbox name=roleIds value=${role} 
checked=${actionBean.systemReport.roles}//td
  td${role.namehttp://role.name}/td
  td${role.enabled}/td
/tr
  /c:forEach
/table


This works fine, but if my action bean (to which this form submits) has a 
getter for roleIds the checked attribute is ignored (as described in the 
pre-population priority rules).

Problem:

1) I don't want to write code in my action bean to copy 
${actionBean.systemReport.roles}  into my roleIds array so  I don't have a 
getter for roleIds. This makes the checked attribute work.

2) Without the getter present. When no checkboxes are checked, stripes nulls  
out the roleIds field in my action bean using the setter.  By default, I 
initialize it to an empty array. I want to work with the empty array and not a 
null array if no checkboxes are checked.

I can obviously work-around either of these issues but the workarounds are 
kludgy. I thought there might be something fundamentally wrong with the 
approach I'm taking here..

--
Ross Sargant

TVR Communications LLC
Software Engineer
3275 W Hillsboro Blvd,Suite 300,Deerfield Beach, Florida,33442

http://www.tvrc.com

p: 954-571-2017 x2108

email: rsarg...@tvrc.commailto:rsarg...@tvrc.com
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Is XSS filter still needed?

2009-02-06 Thread Newman, John W
it's a gross oversimplification to assume that the transformation to be 
applied to user data is to HTML escape it

Can you elaborate on this please?

If I put script into a field and the app html escapes it when it's output on 
the next page, there's no issue.  Where is the oversimplification?



-Original Message-
From: Mike McNally [mailto:emmecin...@gmail.com] 
Sent: Friday, February 06, 2009 7:01 AM
To: Stripes Users List
Subject: Re: [Stripes-users] Is XSS filter still needed?

In my opinion that filter is a terrible idea anyway. XSS is a real
concern, but it's a gross oversimplification to assume that the
transformation to be applied to user data is to HTML escape it.



-- 
Turtle, turtle, on the ground,
Pink and shiny, turn around.

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] Help with UTF-16 - can't post

2009-01-30 Thread Newman, John W
Hello,

The app we are currently developing has to support UTF-16LE.   I've got all of 
our pages rendering correctly, this was a small challenge in itself.   However 
when I do a post request, the parameter names and values are not encoded 
correctly, just a bunch of square blocks. =)

I have added
init-param
  param-nameLocalePicker.Locales/param-name
  param-valueen_US:UTF-16LE/param-value
/init-param
To web.xml.


I also have meta http-equiv=Content-Type content=text/html; 
charset=UTF-16LE / at the top of every page, and freemarker servlet is all 
set to UTF-16LE.

In the logs I see:

12:12:40,229 INFO  [STDOUT] 12:12:40,229 DEBUG StripesFilter:194 - Intercepting 
request to URL: /patient/search
12:12:40,229 INFO  [STDOUT] 12:12:40,229 DEBUG StripesFilter:183 - LocalePicker 
selected locale: en_US
12:12:40,229 INFO  [STDOUT] 12:12:40,229 DEBUG StripesFilter:183 - LocalePicker 
selected character encoding: UTF-16LE   YES

Looking at the code for stripes filter, I see this statement just before the 
logging above:

httpRequest.setCharacterEncoding(encoding);

so the request character encoding is set to UTF-16LE as I need it to be. BUT 
the post isn't getting in correctly,

12:12:40,276 INFO  [STDOUT] 12:12:40,276 DEBUG 
DefaultActionBeanPropertyBinder:194 - Running binding for property with name: ??
12:12:40,276 INFO  [STDOUT] 12:12:40,276 DEBUG 
DefaultActionBeanPropertyBinder:183 - Could not bind property with name [??] to 
bean of type: PatientSearch : Bean class 
com.upmc.cancercenters.pathways.core.PatientSearch does not contain a property 
called '??'. As a result the following expression could not be evaluated: ??
12:12:40,276 INFO  [STDOUT] 12:12:40,276 DEBUG 
DefaultActionBeanPropertyBinder:194 - Running binding for property with name: 
?
12:12:40,291 INFO  [STDOUT] 12:12:40,291 DEBUG 
DefaultActionBeanPropertyBinder:183 - Could not bind property with name [?] 
to bean of type: PatientSearch : Bean class 
com.upmc.cancercenters.pathways.core.PatientSearch does not contain a property 
called '?'. As a result the following expression could not be evaluated: 
?



So what am I missing here?  Anyone ?  Please help!  I have tried adding 
acceptcharset=UTF-16LE to the form tags and it didn't have any effect..

Thanks!

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Help with UTF-16 - can't post

2009-01-30 Thread Newman, John W
We are actually going to just use UTF-8 which should work fine.  We didn't 
realize UTF8 can still represent all the characters of UTF-16, albeit a bit 
less efficiently.


See http://www.javaworld.com/javaworld/jw-04-2004/jw-0419-multibytes.html .  
That is actually a great article to read if you are ever in character encoding 
HELL.


Basically, IE always encodes the post as UTF-8 if the page's content type is 
UTF-16, since IIS (and possibly other web servers) flat out do not understand 
UTF-16.  So I've told stripes to encode AND decode as UTF-16, but it will have 
to decode as UTF-8.  UTF-16 characters in GET links is not possible at all.. 
This whole thing is flat out ridiculous.  

Thanks for your help though..  I'm off to go bang my head against the wall.
 
 
-Original Message-
From: Oscar Westra van Holthe - Kind [mailto:kin...@xs4all.nl] 
Sent: Friday, January 30, 2009 4:05 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Help with UTF-16 - can't post

On 30-01-2009 at 12:39, Newman, John W wrote:
 Hello,
 
 The app we are currently developing has to support UTF-16LE.   I've got all
 of our pages rendering correctly, this was a small challenge in itself.
 However when I do a post request, the parameter names and values are not
 encoded correctly, just a bunch of square blocks. =)

I had this problem myself one time. The correct locale was selected and all.
In my case, it turned out that the problem was Tomcat, combined with a filter
mapped to a servlet (instead of to a URL pattern).

In bypassing the need to repeat all URL patterns for the Stripes servlet, I
mapped the StripesFilter directly to the DispatcherServlet. As it happens,
Tomcat parses the request using the (then) request character encoding to
interpret the request to determine the filter and/or servlet to invoke. But
the correct encoding is set in the StripesFilter, which happened later than
that.

Mapping the filter to the URL patterns fixed my problem.


-- 
   ,-_  Oscar Westra van holthe - Kind  http://www.xs4all.nl/~kindop/
  /() )
 (__ (  Inequality is the inevitable consequence of liberty.
=/  ()  -- Salvador De Madariaga - Anarchy or Hierarchy (1937)

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] ForwardResolution addParameter

2008-12-19 Thread Newman, John W
Hi,

This part of our app is a bit strange: one action takes in some input, and for 
certain events it has to jump over to another action bean to finish the job.  
I've been doing new RedirectResolution(Step2.class).addParameter(stuff, 
stuff);  and that works fine, but it puts them as GET params and our urls are 
totally clean everywhere except for that.

Since step1 doesn't actually write anything, there's no problem with doing a 
forward instead of a redirect.  But ForwardResolution.addParameter(stuff, 
stuff) leaves stuff as null in step2.  Is this expected behavior?   If so 
should forward really derive from onward resolution?  Anyone know what is going 
on here or how I can forward things over to another bean without messing up the 
URL or using the session?

TIA!
--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] Can I extend InputSelectTag and drop in?

2008-12-09 Thread Newman, John W
Hi,

Our current project has 2 issues with the way InputSelectTag does repopulation: 
first, the formatter facility is called unnecessarily often, and we can't rely 
on the formatted values to determine equality - object.equals(other) is all we 
need.  I need to override InputTagSupport.isItemSelected in InputSelectTag.   I 
can fork the stripes project and keep that going, but is there a way to extend 
this tag as a drop in?

Say you have a select tag with 10 options and step through this method.  The 
formatter gets used 10 times to render each option's value on the page (OK).  
Then to determine if an option is selected, each option is formatted a 2nd time 
(probably unnecessary), but worse the value object is formatted once for every 
option, even though it is the same every time.  So a select box with 10 options 
makes 30 calls to the formatter, when really only 11 are required.  In our case 
the format operation is a bit expensive..

The real problem for us is that we cannot guarantee that the formatted output 
will be the same two times for the same object (xml  jaxb).  We have 
overridden equals to just compare the identity property, this is all the select 
tag needs to do.  So my question is, can I make input select tag use 
object.equals instead of format format format, without forking our own 
stripes.jar?  Or do we have to provide a stripesExtension:select / that 
extends from the existing InputSelectTag instead?  Any ideas how we can 
implement either of these?

Thanks in advance,
John
--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Can I extend InputSelectTag and drop in?

2008-12-09 Thread Newman, John W
Great thanks Chris, I'll see if I can get that to work.

From: Chris Herron [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 09, 2008 12:16 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Can I extend InputSelectTag and drop in?

John,

I don't have specific advice on your InputSelectTag question, but I've 
implemented a couple of my own tags by just extending existing Stripes 
implementations and defining the new tags in their own tld. It worked out fine.

Chris.

On Dec 9, 2008, at 12:08 PM, Newman, John W wrote:


Hi,

Our current project has 2 issues with the way InputSelectTag does repopulation: 
first, the formatter facility is called unnecessarily often, and we can't rely 
on the formatted values to determine equality - object.equals(other) is all we 
need.  I need to override InputTagSupport.isItemSelected in InputSelectTag.   I 
can fork the stripes project and keep that going, but is there a way to extend 
this tag as a drop in?

Say you have a select tag with 10 options and step through this method.  The 
formatter gets used 10 times to render each option's value on the page (OK).  
Then to determine if an option is selected, each option is formatted a 2nd time 
(probably unnecessary), but worse the value object is formatted once for every 
option, even though it is the same every time.  So a select box with 10 options 
makes 30 calls to the formatter, when really only 11 are required.  In our case 
the format operation is a bit expensive..

The real problem for us is that we cannot guarantee that the formatted output 
will be the same two times for the same object (xml  jaxb).  We have 
overridden equals to just compare the identity property, this is all the select 
tag needs to do.  So my question is, can I make input select tag use 
object.equals instead of format format format, without forking our own 
stripes.jar?  Or do we have to provide a stripesExtension:select / that 
extends from the existing InputSelectTag instead?  Any ideas how we can 
implement either of these?

Thanks in advance,
John
--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] freemaker templates under the WEB-INF

2008-10-21 Thread Newman, John W
Here's what we have

servlet
servlet-nameFreemarker/servlet-name

servlet-classcom.upmc.cancercenters.pathways.web.FreemarkerServlet/servlet-class
init-param
param-nameTemplatePath/param-name
param-value//param-value
/init-param
init-param
param-namedefault_encoding/param-name
param-valueISO-8859-1/param-value
/init-param
load-on-startup1/load-on-startup
/servlet
servlet-mapping
servlet-nameFreemarker/servlet-name
url-pattern*.ftl/url-pattern
/servlet-mapping

Also if you add

welcome-file-list
welcome-fileindex.ftl/welcome-file
/welcome-file-list

You can do return new ForwardResolution(/WEB-INF/someDir/); and it will pick 
up index.ftl for you.

Hope that helps

-Original Message-
From: Freddy Daoud [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 21, 2008 3:50 PM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] freemaker templates under the WEB-INF

Marcus, try it with this, since you are giving the full path to your
template in your Action Bean:

web.xml:

  param-nameTemplatePath/param-name
  param-value//param-value

Freddy



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] Collections, textareas, OneToManyTypeConverter, and no possiblitity of inverse formatting

2008-10-02 Thread Newman, John W
Hi,

One of the requirements of the app I'm currently working on is to enter comma 
delimited codes into a text area.  I found the useful OneToManyTypeConverter, 
which transparently allows my bean to use a SetString, while the user enters 
a delimited string.

@Validate(converter=OneToManyTypeConverter.class)
SetString codes;

stripes:textarea name=codes1234, 2346, 2345/stripes:textarea

That's pretty decent, but when the user goes to edit to set I just saved for 
them, the population strategy doesn't provide a delimited string into the text 
area.  I initially figured it was due to the formatter factory not having an 
inverse formatter, so I wrote my own OneToManyFormatter that loops over the 
collection and builds a string.  I subclassed formatter factory, added this 
thing in there, but it never gets called.  What's odd is the first item in the 
set does show up in the text area as a string.

So I went digging through the code, and I found

InputTextAreaTag:
  @Override
public int doEndInputTag() throws JspException {
try {
// Find out if we have a value from the PopulationStrategy
Object value = getSingleOverrideValue();

InputTagSupport:
  protected Object getSingleOverrideValue() throws StripesJspException {
Object unknown = getOverrideValueOrValues();
Object returnValue = null;

if (unknown != null  unknown.getClass().isArray()) {
if (Array.getLength(unknown)  0) {
returnValue = Array.get(unknown, 0);
}
}
else if (unknown != null  unknown instanceof Collection) {
Collection? collection = (Collection?) unknown;
if (collection.size()  0) {
returnValue = collection.iterator().next();
}
}
else {
returnValue = unknown;
}

return returnValue;
}

So if a text area is trying to populate with a collection, all I can 
potentially format is collection.iterator().next();  the formatter factory 
never gets asked for the set formatter.  The javadoc states:

This can be used to ensure that
 * only a single value is returned by the population strategy, which is 
useful in the case
 * of text inputs etc. which can have only a single value.

Right, but it doesn't allow the possibility of multiple values being later 
formatted into a single one.  I don't think this is ideal behavior.  Thoughts?

Thanks,
John
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Collections, textareas, OneToManyTypeConverter, and no possiblitity of inverse formatting

2008-10-02 Thread Newman, John W
Well I went into InputTextAreaTag and changed

// Find out if we have a value from the PopulationStrategy
Object value = getSingleOverrideValue();
To
Object value = getOverrideValueOrValues();

And my formatter is getting called and I see a nice comma delimited set of 
codes in the text area!   So my question for the devs is can we do something 
differently here?

getSingleOverrideValue() is used by the text, textarea, and radio button tags.  
All it really does differently is return the first element in the case of 
arrays/collections, which seems totally unexpected to me.  Can we provide a 
default array/collection formatter and eliminate that method?  Or am I not 
seeing a legitimate reason for why this happens?

Thanks,
John

From: Newman, John W [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2008 12:36 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Collections, textareas, OneToManyTypeConverter, and no 
possiblitity of inverse formatting

Hi,

One of the requirements of the app I'm currently working on is to enter comma 
delimited codes into a text area.  I found the useful OneToManyTypeConverter, 
which transparently allows my bean to use a SetString, while the user enters 
a delimited string.

@Validate(converter=OneToManyTypeConverter.class)
SetString codes;

stripes:textarea name=codes1234, 2346, 2345/stripes:textarea

That's pretty decent, but when the user goes to edit to set I just saved for 
them, the population strategy doesn't provide a delimited string into the text 
area.  I initially figured it was due to the formatter factory not having an 
inverse formatter, so I wrote my own OneToManyFormatter that loops over the 
collection and builds a string.  I subclassed formatter factory, added this 
thing in there, but it never gets called.  What's odd is the first item in the 
set does show up in the text area as a string.

So I went digging through the code, and I found

InputTextAreaTag:
  @Override
public int doEndInputTag() throws JspException {
try {
// Find out if we have a value from the PopulationStrategy
Object value = getSingleOverrideValue();

InputTagSupport:
  protected Object getSingleOverrideValue() throws StripesJspException {
Object unknown = getOverrideValueOrValues();
Object returnValue = null;

if (unknown != null  unknown.getClass().isArray()) {
if (Array.getLength(unknown)  0) {
returnValue = Array.get(unknown, 0);
}
}
else if (unknown != null  unknown instanceof Collection) {
Collection? collection = (Collection?) unknown;
if (collection.size()  0) {
returnValue = collection.iterator().next();
}
}
else {
returnValue = unknown;
}

return returnValue;
}

So if a text area is trying to populate with a collection, all I can 
potentially format is collection.iterator().next();  the formatter factory 
never gets asked for the set formatter.  The javadoc states:

This can be used to ensure that
 * only a single value is returned by the population strategy, which is 
useful in the case
 * of text inputs etc. which can have only a single value.

Right, but it doesn't allow the possibility of multiple values being later 
formatted into a single one.  I don't think this is ideal behavior.  Thoughts?

Thanks,
John
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Stripersist and cglib proxified class

2008-09-17 Thread Newman, John W
I had written my own deproxifier thing for the .equals() method of all my 
entities, and then I found out about this one

Hibernate.getClass(o);  
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Hibernate.html#getClass(java.lang.Object)

Hope that helps




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lionel
Sent: Wednesday, September 17, 2008 9:36 AM
To: stripes-users@lists.sourceforge.net
Subject: Re: [Stripes-users] Stripersist and cglib proxified class

Lionel wrote:
 Hi Aaron


 I add logs to EntityUtil.java: I can see that the
 deproxifyCglibClass() works fine: the Field accessor containing the
 Id is found. But ((Field) accessor).get(entity) always return null.
 I've logged the value of entity.toString (which return the Id value):
 the right value is displayed.

 Did someone manage to use stripersist with lazy loaded @ManyToOne ?



Found a solution: invoking the getter of the property instead of getting its
value solves the problem.
this doesn't work:
return ((Field) accessor).get(entity);

this works:
return org.apache.commons.beanutils.PropertyUtils.getProperty(entity,
((Field) accessor).getName());

I also had to remove the check for Entity annotation in
entityFormatter.format(Object) (called before deproxification...)



Lionel




-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] maps and @ValidateNestedProperties

2008-08-19 Thread Newman, John W
but adds validation errors under the key preferences.PAGE_SIZE instead of the 
expected preferences[PAGE_SIZE].

I noticed this the other day - I sent an email to the list about it but got no 
response.  Is that the correct behavior?  Without the index in the error's 
field name, the widget can't get the error css.  Why aren't error field names 
and the widget names a one to one match when using indexed properties?



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Levi Hoogenberg
Sent: Tuesday, August 19, 2008 2:27 AM
To: Stripes Users List
Subject: Re: [Stripes-users] maps and @ValidateNestedProperties

Followup: Stripes does process the validation annotations, but adds validation 
errors under the key preferences.PAGE_SIZE instead of the expected 
preferences[PAGE_SIZE].
On Mon, Aug 18, 2008 at 10:38 PM, Levi Hoogenberg [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED] wrote:
Hi,

today I've been binding into a Map for the first time using Stripes and I must 
say it was much less painful than I feared :) Now I'm trying to validate the 
map's contents by using something like:

@ValidateNestedProperties({
@Validate(field = PAGE_SIZE, required = true)
})
private MapPreference, String preferences;

Preference is an enum. This doesn't seem to work - is it supposed to work (and 
if so, how?), or is this use so rare that it's not supported? I've looked 
through the source code and I can't find any code that seems to deal with this, 
but then again, that part of Stripes is quite complex, IMO.

Another quick question: I'm using clean URLs (who doesn't nowadays, thanks Ben) 
and one of my parameters is an enum value (a PreferenceCategory to be exact). 
Now the EnumeratedTypeConverter only understands the actual name() of enum 
constants. Since I write my constants in upper case, I'd end up with URLs like 
/members/preferences/DISPLAY, if I would use the default enumerated type 
converter. To avoid this, I subclassed the type converter. Now for the (not so 
quick anymore) question: would a hook in EnumeratedTypeConverter to tweak the 
input that would get sent to Enum.valueOf make sense, or would it be 
unnecessary since the user would be subclassing the type converter anyway? 
Another option would be to abstract this naming conversion into an interface so 
that the formatter could use it too (eg. for generating URLs), but that's just 
me thinking out loud.

  Levi

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] maps and @ValidateNestedProperties

2008-08-19 Thread Newman, John W
Yes, can a dev please verify that this a feature?

See my post 
http://www.nabble.com/Indexed-properties---validation-errors-td18855702.html#a18855702
 for a test case and more detailed  explanation of what I'm thinking might be a 
bug.  The error css class is great but it mysteriously doesn't work with 
indexed properties and this is confusing to users.



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Levi Hoogenberg
Sent: Tuesday, August 19, 2008 3:38 PM
To: Stripes Users List
Subject: Re: [Stripes-users] maps and @ValidateNestedProperties

The values of a map. At first I wasn't even going to try, but I thought: hey, 
I've been surprised by Stripes before. Anyway, it almost works (and with a 
little @After method that tweaks the keys of the validation errors map 
[replacing a.b with a[b] it works as expected) and it would be nice if it could 
work out of the box, because the current behaviour seems (no offense intended, 
of course) accidental.

Anyway, I'd like to do

@ValidateNestedProperties({
@Validate(field = key, required = true)
})
private MapString, String map;

Where the 'field' key is the key of the map that has the value key. I expect 
validation errors if no such key is present or when its value in the map is 
null. (Again, I'd like to point out the fact that validation does happen, but 
that the field name under which the validation error is stored is map.key and 
not map[key], which would match my expectations.)

Ideally, I thought, with the correct type converter in place, the following 
should work as well:

@ValidateNestedProperties({
@Validate(field = key, required = true)
})
private MapBean, String map;

Again, this works partially. So I'm not sure that the annotations are the 
problem, but please feel free to educate me :)
On Tue, Aug 19, 2008 at 8:44 PM, Poitras Christian [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED] wrote:
Can you explain what you are trying to validate? I'll try to help you write an 
appropriate validate annotation.

Christian


From: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]] On Behalf Of Poitras Christian
Sent: Tuesday, August 19, 2008 12:39 PM

To: 'Stripes Users List'
Subject: Re: [Stripes-users] maps and @ValidateNestedProperties

If i'm guessing correctly, you're currently trying to validate the PAGE_SIZE 
property of a java.lang.String. This is incorrect.
ValidateNestedProperties is used to validate sub properties of an object (if 
indexed, the ? in List?, if mapped the ? in MapsomeKey, ?).

Christian


From: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]] On Behalf Of Newman, John W
Sent: Tuesday, August 19, 2008 11:41 AM
To: Stripes Users List
Subject: Re: [Stripes-users] maps and @ValidateNestedProperties

but adds validation errors under the key preferences.PAGE_SIZE instead of the 
expected preferences[PAGE_SIZE].



I noticed this the other day - I sent an email to the list about it but got no 
response.  Is that the correct behavior?  Without the index in the error's 
field name, the widget can't get the error css.  Why aren't error field names 
and the widget names a one to one match when using indexed properties?







From: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]] On Behalf Of Levi Hoogenberg
Sent: Tuesday, August 19, 2008 2:27 AM
To: Stripes Users List
Subject: Re: [Stripes-users] maps and @ValidateNestedProperties



Followup: Stripes does process the validation annotations, but adds validation 
errors under the key preferences.PAGE_SIZE instead of the expected 
preferences[PAGE_SIZE].

On Mon, Aug 18, 2008 at 10:38 PM, Levi Hoogenberg [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED] wrote:

Hi,

today I've been binding into a Map for the first time using Stripes and I must 
say it was much less painful than I feared :) Now I'm trying to validate the 
map's contents by using something like:

@ValidateNestedProperties({
@Validate(field = PAGE_SIZE, required = true)
})
private MapPreference, String preferences;

Preference is an enum. This doesn't seem to work - is it supposed to work (and 
if so, how?), or is this use so rare that it's not supported? I've looked 
through the source code and I can't find any code that seems to deal with this, 
but then again, that part of Stripes is quite complex, IMO.

Another quick question: I'm using clean URLs (who doesn't nowadays, thanks Ben) 
and one of my parameters is an enum value (a PreferenceCategory to be exact). 
Now the EnumeratedTypeConverter only understands the actual name() of enum 
constants. Since I write my constants in upper case, I'd end up with URLs like 
/members/preferences/DISPLAY, if I would use the default enumerated type 
converter. To avoid this, I subclassed the type converter. Now for the (not so 
quick

Re: [Stripes-users] Freemarker Integration with Stripes?

2008-08-14 Thread Newman, John W
You can just extend freemarker servlet and put your class name in web.xml 
instead of freemarker.ext.FreemarkerServlet.

Also most IDEs can generate those getter  setter methods for you.  Eclipse 
will even rename them if you rename the field.




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of MassimoH
Sent: Thursday, August 14, 2008 1:34 PM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Freemarker Integration with Stripes?


I have a simple Stripes app running with freemarker templates.

How do I customize the freemarker BeansWrapper instance and the
ScopesHashModel instance?

With Struts 2, I can define a subclass of
org.apache.struts2.views.freemarker.FreemarkerManager that lets me do this:

public class CustomFreemarkerManager extends FreemarkerManager {
@Override
protected BeansWrapper getObjectWrapper() {
BeansWrapper beansWrapperInstance = super.getObjectWrapper();
beansWrapperInstance.setExposeFields(true);

return beansWrapperInstance;
}

@Override
protected ScopesHashModel buildScopesHashModel(ServletContext
servletContext, HttpServletRequest request, HttpServletResponse response,
ObjectWrapper wrapper, ValueStack stack) {
ScopesHashModel model = 
super.buildScopesHashModel(servletContext,
request, response, wrapper, stack);
BeansWrapper beansWrapperInstance = getObjectWrapper();

model.put(statics, beansWrapperInstance.getStaticModels());
model.put(enums, beansWrapperInstance.getEnumModels());

return model;
}
}

I'm doing this so that:
- My templates can read bean properties without writing/maintaining a
getter method for every single property.
- My templates can access data/methods in static classes and enums.

Is there any way to do this in Stripes?

(I'm using most recent versions: Stripes 1.5rc1 + Freemarker 2.3.13 + JDK
1.6.07)

--
View this message in context: 
http://www.nabble.com/Freemarker-Integration-with-Stripes--tp18986194p18986194.html
Sent from the stripes-users mailing list archive at Nabble.com.


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Error Ordering

2008-08-06 Thread Newman, John W

http://www.stripesframework.org/jira/browse/STS-356

(this
may be a pain to implement)

It certainly will, I don't think it's even possible .. you'd have to look at 
the source of the page and find the stripes form tags, and absolutely forget 
about it if you're using any kind of dhtml.  The only thing I've really been 
able to think of is to use the tabindex attribute, but that is not very good 
and probably wouldn't even work anyway.

Is there any framework out there that shows errors in the same order that the 
fields appear?


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Wawok
Sent: Wednesday, August 06, 2008 1:34 AM
To: stripes-users@lists.sourceforge.net
Subject: [Stripes-users] Error Ordering

Stripes is pretty big into the magically work school of thought.  I am not sure
if I am missing some functionality or not, but I found the following situation
odd:

Validation Errors are stored in the context as a HashMap. This means if we have
10 fields and 5 of those contain an error, we will see a random ordering of
those errors during display.

Would it make sense for stripes to either
1) Order errors in the same order it sees the fields in the form below? (this
may be a pain to implement)
2) Order the errors in the order we enter them (i.e. use a linked list of pair
not a map to store them)


Sure I can write my own ordered list of errors and deal with it myself, but that
seems anti stripes.

Thoughts?




-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] ActionBeanContext and MockRoundtrip

2008-07-31 Thread Newman, John W
need to see the code for createMockContext.

Are you following section 2 of 
http://stripesframework.org/display/stripes/Unit+Testing ?



From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Karsten Strunk [EMAIL 
PROTECTED]
Sent: Thursday, July 31, 2008 4:36 PM
To: Stripes Users List
Subject: Re: [Stripes-users] ActionBeanContext and MockRoundtrip

Hi,

Ah, I unterstand. If I use a mock to prepare the data in HTTP session
mocking my test class should work.

But unfortunately a new session is created with every new trip although
I pass the MockHttpSession instance to each new mock.
Maybe this exception I get is the cause of the problem:

net.sourceforge.stripes.exception.StripesRuntimeException: Something is
trying to access the current Stripes configuration but the current
request was never routed through the StripesFilter! As a result the
appropriate Configuration object cannot be located. Please take a look
at the exact URL in your browser's address bar and ensure that any
requests to that URL will be filtered through the StripesFilter
according to the filter mappings in your web.xml.
at
net.sourceforge.stripes.controller.StripesFilter.getConfiguration(StripesFilter.java:160)
at net.sourceforge.stripes.util.CryptoUtil.encrypt(CryptoUtil.java:123)
at
net.sourceforge.stripes.mock.MockRoundtrip.setSourcePage(MockRoundtrip.java:184)
at
net.sourceforge.stripes.mock.MockRoundtrip.init(MockRoundtrip.java:119)
at
net.sourceforge.stripes.mock.MockRoundtrip.init(MockRoundtrip.java:88)
at
net.sourceforge.stripes.mock.MockRoundtrip.init(MockRoundtrip.java:74)


Here's what I'm doing:

// Login user
MockServletContext mockContext = createMockContext();
MockRoundtrip trip = new MockRoundtrip(mockContext,
LoginActionBean.class);
trip.setParameter(username, username);
trip.setParameter(password, password);
trip.execute();
MockHttpSession mockSession = (MockHttpSession)
trip.getRequest().getSession();

// Perform password change
MockRoundtrip trip = new MockRoundtrip(mockContext,
ChangePasswordActionBean.class, mockSession);
trip.setParameter(username, username);
trip.setParameter(oldPassword, password);
trip.setParameter(newPassword, newPassword);
trip.setParameter(newPasswordRep, newPassword);
trip.execute();


Any ideas?


Newman, John W wrote:
 How do you fill the action bean context outside of the tests?  Make a mock 
 trip to that event handler first, then pull the http session out of that 
 trip, and pass it over to a new trip.  The MockRoundTrip constructor with the 
 HttpSession argument is what you want.

 i.e. we have


 class SomeTest extends SecureTestFixtureUser  {

 public void testBody()  {
 MockRoundTrip trip = createSecureTrip(SomeAction.class);
 trip.execute();
 }
 }

 class SecureTestFixtureUser extends BaseUser?  {

 protected MockRoundtrip createSecureTrip(
 Class? extends ActionBean beanClass,
 String loginName) {
 return new MockRoundtrip(getMockContext(), beanClass, 
 getSecureSession(loginName));
 }

 protected MockHttpSession getSecureSession(String loginName) {
 MockRoundtrip trip = 
 createInSecureTrip(getTestLoginActionBeanClass());
 trip.addParameter(potentialUser.loginName, loginName);
 trip.addParameter(potentialUser.password, fakepassword);
 try {
 trip.execute(Events.LOGIN_LOGIN);
 } catch (Exception e) {
 throw new IllegalStateException(e);
 }
 return (MockHttpSession) trip.getRequest().getSession();
 }

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Karsten Strunk
 Sent: Thursday, July 31, 2008 1:13 PM
 To: stripes-users@lists.sourceforge.net
 Subject: [Stripes-users] ActionBeanContext and MockRoundtrip

 Hi,

 I'm trying to implement JUnit tests for my Stripes actions. But there
 I've a problem.

 As described in the Stripes State Management article my ActionBeans use
 a subclass of ActionBeanContext to store application wide data instead
 of accessing the HttpSession directly. The problem is now how to prepare
 the ActionBeanContext with data my actions rely on?
 I tried:

 MockServletContext ctx = createMockContext();
 MockRoundtrip trip = new MockRoundtrip(ctx, MyActionBean.class);
 ActionBeanContext actionBeanContext =
 trip.getActionBean(MyActionBean.class).getContext();

 But actionBeanContext is null until I call

trip.execute()

 So how can I prefill my context before(!) executing an ActionBean?

 Hope somebody can help me here!

 Best regards,
 Karsten

Re: [Stripes-users] specifying html's anchor element

2008-07-18 Thread Newman, John W
Could we add an anchor attribute to the tag?   That should be a pretty trivial 
patch, and I know I've wanted this a few times this before (I just fell back to 
the html tags)

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Gunter
Sent: Friday, July 18, 2008 9:10 AM
To: Stripes Users List
Subject: Re: [Stripes-users] specifying html's anchor element

There's no way to do it with one tag if you're using the beanclass attribute, 
but you can do it with two if you'd like:

s:url var=url beanclass=com.myco.stripes.FooActionBean /
s:link href=${url}#someSections:param name=foo  
value=bar/Blah/s:link

Not ideal, but it should work. You can add an anchor to your s:link or s:url if 
you're using href instead of beanclass, and Stripes will handle it correctly.

-Ben
On Fri, Jul 18, 2008 at 6:40 AM, Karol [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] wrote:
Hello,
Is it possible to specify html anchor element for the link and url tags?
I would like to provide a beanclass attribute and somehow specify the anchor
element to construct the url which would look like:
http://foo.com/fooContext/Bar.action#someSection.
I am using Stripes 1.5RC1.



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.netmailto:Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Ben Gunter
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Maven2 - does anyone use it

2008-07-14 Thread Newman, John W
I would be very interested in this.  I've been casually migrating our stuff to 
maven2 over the past month and have found that it has a bit of a learning 
curve.  I do like it though, eventually I'd like to build our own archetype and 
even some plugins.  Stripes + spring + hibernate + freemarker is what we are 
using

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David G Friedman
Sent: Friday, July 11, 2008 9:03 PM
To: Stripes Users List
Subject: [Stripes-users] Maven2 - does anyone use it

Does anyone use Maven 2?  I recently found it has a project template
system archetype:generate which does not include any type of Stripes
projects.I am thinking, when 1.5 finalizes, of making an archetype
for a few different types of Stripes projects:

1. Stripes alone (nothing else)
2. Stripes with Freemarker and Hibernate
3. Stripes with Freemarker and DataNucleus (formerly called JPOX [LOVE IT!])

Is there any interest in this plus corresponding instructions in the
user section of the StripesFramework.org site?  Are there other Stripes
+ something projects I should probably consider for maven archetypes?

As a side note, while looking into this I was glad to find the jar
dependencies for 1.5 have streamlined.  I remember looking at a 1.5 svn
trunk and noticing odd dependencies like slf4j and a few others which at
that time made little sense to me.  As for the newest Developer's
release it looks great to have only 3 key dependencies where anything
else is totally at the programmer's discretion.

Regards,
David G. Friedman


-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] @DefaultHandler tag just stopped working...

2008-07-08 Thread Newman, John W
Ok I restarted my machine and it is working now... very strange the eclipse 
compiler must have some strange bug with annotation retention.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Newman, John W
Sent: Monday, July 07, 2008 5:27 PM
To: Stripes Users List
Subject: Re: [Stripes-users] @DefaultHandler tag just stopped working...

Latest svn trunk...

No idea why this is happening

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Poitras Christian
Sent: Monday, July 07, 2008 5:14 PM
To: 'Stripes Users List'
Subject: Re: [Stripes-users] @DefaultHandler tag just stopped working...

What version are you using?


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Newman, John W
Sent: Monday, July 07, 2008 4:53 PM
To: Stripes Users List
Subject: Re: [Stripes-users] @DefaultHandler tag just stopped working...
Did something here change recently?  I'm getting this error in all projects 
with the latest build...

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Newman, John W
Sent: Monday, July 07, 2008 4:22 PM
To: Stripes Users List
Subject: [Stripes-users] @DefaultHandler tag just stopped working...

Hi,

I think I've got something wrong, but I've been chasing my tail for an hour 
here.  The following stack trace always comes up no matter what I pass in for 
the event  Does anybody know what is going on?

16:10:51,192 ERROR ExceptionHandler:46 - No default handler could be found for 
ActionBean of type: com.x.y.patient.PatientAction
net.sourceforge.stripes.exception.StripesServletException: No default handler 
could be found for ActionBean of type: com.x.y.patient.PatientAction
  at 
net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getDefaultHandler(AnnotatedClassActionResolver.java:620)
  at 
net.sourceforge.stripes.controller.DispatcherHelper$2.intercept(DispatcherHelper.java:147)
  at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
  at 
net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
  at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
  at 
net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
  at 
net.sourceforge.stripes.controller.DispatcherHelper.resolveHandler(DispatcherHelper.java:132)
  at 
net.sourceforge.stripes.controller.DispatcherServlet.resolveHandler(DispatcherServlet.java:253)
  at 
net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:151)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:66)
  at 
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:246)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:63)
  at 
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:63)
  at 
net.sourceforge.stripes.mock.MockServletContext.acceptRequest(MockServletContext.java:255)
  at 
net.sourceforge.stripes.mock.MockRoundtrip.execute(MockRoundtrip.java:195)
  at 
test.com.x.y.unit.TestPatientAction.testGotoIndexPage(TestPatientAction.java:24)
  at test.com.x.y.unit.TestPatientAction.testBody(TestPatientAction.java:17)
  ...

Here's the test


public class TestPatientAction extends TestFixture  {

  @Test
  public void testBody() throws Exception  {
testGotoIndexPage();
testPatientCreate();
  }


  private void testGotoIndexPage() throws Exception {
MockRoundtrip trip = createSecureTrip(PatientAction.class);
trip.execute();   // fail w/ no default handler
  // trip.execute(createPatient); gives same message
Assert.assertEquals(trip.getDestination(), Urls.PATIENT_CREATE);
  }


  private void testPatientCreate() throws Exception {
MockRoundtrip trip = createSecureTrip(PatientAction.class);
trip.addParameter(patient.name.first, First);
trip.addParameter(patient.name.last, Last);
trip.addParameter(patient.surgeon, 6);
trip.addParameter(patient.ctDate, 10/28/2011);
trip.execute(Events.PATIENT_CREATE);
Assert.assertNotNull(trip.getActionBean(PatientAction.class)
.getPatient().getId());
  }
}

Here's the bean

@UrlBinding(ActionUrls.PATIENT)
public class PatientAction extends SecureActionBeanUser, ActionBeanContext {

  @SpringBean
  private PatientManager

Re: [Stripes-users] AJAX form success/validation error flag

2008-07-08 Thread Newman, John W
For ajax events, instead of forwarding to the source page on errors, we produce 
the error message and stream it back.  The javascript uses a dirty string split 
to see if the errors thing is there or not.  If it is, it sets the inner html 
of the #error div and sets the error class on any fields (again found out via a 
string split) .  Certainly not a great solution at all but from a pragmatic 
standpoint it is ok.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Levi Hoogenberg
Sent: Tuesday, July 08, 2008 4:48 PM
To: Stripes Users List
Subject: Re: [Stripes-users] AJAX form success/validation error flag

Hi Freddy,

the response header seems to be the most suitable option. Setting it should be 
as easy as

return new ForwardResolution(/path/to/your/page.jsp) {
@Override
public void execute(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
response.addHeader(success, true);

super.execute(request, response);
}
};

I tested this with Jetty 6.1.7 and Firebug show the response header. I've never 
used jQuery, so I can't tell you how to read it.

Another option is to completely replace the divs (use outerHTML instead of 
innerHTML) and check the ID. Again, I can't tell you how easy that would be 
using jQuery.

Kind regards,
  Levi
On Tue, Jul 8, 2008 at 10:06 PM, Freddy Daoud [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] wrote:
Stripers,

I've run into a problem for which I found a simple but somewhat ugly
solution. I'm trying to find a more elegant solution that doesn't
increase complexity tenfold.

Consider a page with a list of people in a div id=people and a form,
in the same page, in a div id=form. The form gets submitted via
AJAX. If no validation errors occur, the response is the fragment that
contains the refreshed list of people and should replace the people div.
Validation errors return the form, much like the standard Stripes
source page resolution except that it's just the form, not the entire
page. In that case, the response fragment should replace the form
div.

The problem consists of receiving the page fragment and deciding where
it should go: people or form? In other words, how would you
signal, in the response, a success/validatione error flag along with
the page fragment?

To be clear and save everyone time, allow me to enumerate some
solutions that do not satisfy my requirements:

- returning an HTTP error code. When validation errors occur, the HTTP
 status is still successful and the page fragment is valid; it
 contains the form with the validation errors.

- using JavaScriptResolution, JSON, XML data, etc. I do not want to
 send raw data and have to rebuild the list of people or the form with
 validation errors using JavaScript. That makes me feel like I'm back
 in 1998, writing HTML code in Java Servlets. I want to send the page
 fragments in the response, clean and simple.

- setting an HTTP response header. I tried this and correct me if I'm
 wrong, but setting a response header and then returning a
 ForwardResolution does not work. I've also had some difficulty
 retrieving the response header in the AJAX callback function (with
 jQuery). I should mention that I'm open to this solution but I haven't
 found how to resolve these issues.

Right now I have an HTML comment in the list of people fragment. When
receiving the response data, finding that comment in the data means
success, and so put the fragment in people. Otherwise, put the fragment
in form. Like I said: simple, but ugly.

I also tried returning a JavaScriptResolution(url) upon success and
the form with validation errors upon failure. If eval(response) works,
I use the URL to refresh the list of people. This is similar to a
redirect. Not bad, but I have to do a try/catch on the call to eval()
because the HTML fragment with the form is obviously not valid
JavaScript. So I find this solution almost as brittle as the previous
one. If I return a JavaScriptResolution(true, url) on success and
JavaScriptResolution(false, url) upon failure, I'd have to submit the
form a second time, with some kind of indicator, to get the Stripes-
generated form with validation errors. Somewhat a steep price to pay
for elegance...

Ideally, I would love to be able to just return a JavaScriptResolution
(or JSON, whatever) with a simple Map:
{success: true, data: (html fragment)}
Then I could just check the flag to decide which div id to update with
the data. The HTML page fragment, however, would have to be generated
normally. That's the problem. I tried to executing a
ForwardResolution with an HttpServletResponseWrapper to capture the
output in a String, and put that in the JavaScriptResolution.
Surprisingly complicated, and it doesn't even work. Jetty complains of
an already committed response (even if I override isCommitted() to
return false) and Tomcat throws an InvalidStateException. Even if I

[Stripes-users] @DefaultHandler tag just stopped working...

2008-07-07 Thread Newman, John W
Hi,

I think I've got something wrong, but I've been chasing my tail for an hour 
here.  The following stack trace always comes up no matter what I pass in for 
the event  Does anybody know what is going on?

16:10:51,192 ERROR ExceptionHandler:46 - No default handler could be found for 
ActionBean of type: com.x.y.patient.PatientAction
net.sourceforge.stripes.exception.StripesServletException: No default handler 
could be found for ActionBean of type: com.x.y.patient.PatientAction
  at 
net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getDefaultHandler(AnnotatedClassActionResolver.java:620)
  at 
net.sourceforge.stripes.controller.DispatcherHelper$2.intercept(DispatcherHelper.java:147)
  at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
  at 
net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
  at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
  at 
net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
  at 
net.sourceforge.stripes.controller.DispatcherHelper.resolveHandler(DispatcherHelper.java:132)
  at 
net.sourceforge.stripes.controller.DispatcherServlet.resolveHandler(DispatcherServlet.java:253)
  at 
net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:151)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:66)
  at 
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:246)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:63)
  at 
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:63)
  at 
net.sourceforge.stripes.mock.MockServletContext.acceptRequest(MockServletContext.java:255)
  at 
net.sourceforge.stripes.mock.MockRoundtrip.execute(MockRoundtrip.java:195)
  at 
test.com.x.y.unit.TestPatientAction.testGotoIndexPage(TestPatientAction.java:24)
  at test.com.x.y.unit.TestPatientAction.testBody(TestPatientAction.java:17)
  ...

Here's the test


public class TestPatientAction extends TestFixture  {

  @Test
  public void testBody() throws Exception  {
testGotoIndexPage();
testPatientCreate();
  }


  private void testGotoIndexPage() throws Exception {
MockRoundtrip trip = createSecureTrip(PatientAction.class);
trip.execute();   // fail w/ no default handler
  // trip.execute(createPatient); gives same message
Assert.assertEquals(trip.getDestination(), Urls.PATIENT_CREATE);
  }


  private void testPatientCreate() throws Exception {
MockRoundtrip trip = createSecureTrip(PatientAction.class);
trip.addParameter(patient.name.first, First);
trip.addParameter(patient.name.last, Last);
trip.addParameter(patient.surgeon, 6);
trip.addParameter(patient.ctDate, 10/28/2011);
trip.execute(Events.PATIENT_CREATE);
Assert.assertNotNull(trip.getActionBean(PatientAction.class)
.getPatient().getId());
  }
}

Here's the bean

@UrlBinding(ActionUrls.PATIENT)
public class PatientAction extends SecureActionBeanUser, ActionBeanContext {

  @SpringBean
  private PatientManager patientManager;


  @ValidateNestedProperties({
@Validate(field=name.first, required=true),
@Validate(field=name.last, required=true),
@Validate(field=surgeon, required=true),
@Validate(field=ctDate, required=true)
  })
  private Patient patient;


  @DontValidate
  @DefaultHandler   // there it is... only one occurrence
  public Resolution gotoIndexPage() {
return forward(Urls.PATIENT_CREATE);
  }


@HandlesEvent(Events.PATIENT_CREATE)
  public Resolution createPatient()  {
patientManager.create(getPatient(), getUser());
addMsg(patient.created);
return redirect(Home.class);
  }


  @HandlesEvent(Events.PATIENT_UPDATE)
  public Resolution updatePatient()  {
patientManager.update(getPatient(), getUser());
addMsg(patient.updated);
return redirect(Home.class);
  }



public Patient getPatient() {
return this.patient;
  }
  public void setPatient(Patient patient) {
this.patient = patient;
  }
}


???
-

Re: [Stripes-users] @DefaultHandler tag just stopped working...

2008-07-07 Thread Newman, John W
Did something here change recently?  I'm getting this error in all projects 
with the latest build...

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Newman, John W
Sent: Monday, July 07, 2008 4:22 PM
To: Stripes Users List
Subject: [Stripes-users] @DefaultHandler tag just stopped working...

Hi,

I think I've got something wrong, but I've been chasing my tail for an hour 
here.  The following stack trace always comes up no matter what I pass in for 
the event  Does anybody know what is going on?

16:10:51,192 ERROR ExceptionHandler:46 - No default handler could be found for 
ActionBean of type: com.x.y.patient.PatientAction
net.sourceforge.stripes.exception.StripesServletException: No default handler 
could be found for ActionBean of type: com.x.y.patient.PatientAction
  at 
net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getDefaultHandler(AnnotatedClassActionResolver.java:620)
  at 
net.sourceforge.stripes.controller.DispatcherHelper$2.intercept(DispatcherHelper.java:147)
  at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
  at 
net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
  at 
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
  at 
net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
  at 
net.sourceforge.stripes.controller.DispatcherHelper.resolveHandler(DispatcherHelper.java:132)
  at 
net.sourceforge.stripes.controller.DispatcherServlet.resolveHandler(DispatcherServlet.java:253)
  at 
net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:151)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:66)
  at 
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:246)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:63)
  at 
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
  at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
  at 
net.sourceforge.stripes.mock.MockFilterChain.doFilter(MockFilterChain.java:63)
  at 
net.sourceforge.stripes.mock.MockServletContext.acceptRequest(MockServletContext.java:255)
  at 
net.sourceforge.stripes.mock.MockRoundtrip.execute(MockRoundtrip.java:195)
  at 
test.com.x.y.unit.TestPatientAction.testGotoIndexPage(TestPatientAction.java:24)
  at test.com.x.y.unit.TestPatientAction.testBody(TestPatientAction.java:17)
  ...

Here's the test


public class TestPatientAction extends TestFixture  {

  @Test
  public void testBody() throws Exception  {
testGotoIndexPage();
testPatientCreate();
  }


  private void testGotoIndexPage() throws Exception {
MockRoundtrip trip = createSecureTrip(PatientAction.class);
trip.execute();   // fail w/ no default handler
  // trip.execute(createPatient); gives same message
Assert.assertEquals(trip.getDestination(), Urls.PATIENT_CREATE);
  }


  private void testPatientCreate() throws Exception {
MockRoundtrip trip = createSecureTrip(PatientAction.class);
trip.addParameter(patient.name.first, First);
trip.addParameter(patient.name.last, Last);
trip.addParameter(patient.surgeon, 6);
trip.addParameter(patient.ctDate, 10/28/2011);
trip.execute(Events.PATIENT_CREATE);
Assert.assertNotNull(trip.getActionBean(PatientAction.class)
.getPatient().getId());
  }
}

Here's the bean

@UrlBinding(ActionUrls.PATIENT)
public class PatientAction extends SecureActionBeanUser, ActionBeanContext {

  @SpringBean
  private PatientManager patientManager;


  @ValidateNestedProperties({
@Validate(field=name.first, required=true),
@Validate(field=name.last, required=true),
@Validate(field=surgeon, required=true),
@Validate(field=ctDate, required=true)
  })
  private Patient patient;


  @DontValidate
  @DefaultHandler   // there it is... only one occurrence
  public Resolution gotoIndexPage() {
return forward(Urls.PATIENT_CREATE);
  }


@HandlesEvent(Events.PATIENT_CREATE)
  public Resolution createPatient()  {
patientManager.create(getPatient(), getUser());
addMsg(patient.created);
return redirect(Home.class);
  }


  @HandlesEvent(Events.PATIENT_UPDATE)
  public Resolution updatePatient()  {
patientManager.update(getPatient(), getUser());
addMsg

  1   2   >