[Stripes-users] Better REST support

2017-07-30 Thread Nestor Hernandez
Hi Stripes users, here I make so suggestions in order to give a better REST
support.


   - REST support uses naming patterns which is discouraged because
   typographical errors may result in silent failures and other points
   described by Bloch (
   
http://jtechies.blogspot.pe/2012/07/item-35-prefer-annotations-to-naming.html).
   Now we have annotations. Look at JUnit, they are no more using naming
   patterns to test classes, they have @Test. Naming patterns seems like we're
   back in Java 1.4. Please let's use @POST, @
GET, @DELETE,etc.
   *Right now the annotations just doesn't work*. These annotations should
   work even if the ActionBean is not marked with the RestActionBean
   annotation.
   - REST support by default, and with no chance for further customization,
   packages up all the validation errors in a defined way. It will be better
   if we leave the developer free to change it respecting
   ValidationErrorHandler. Look line 447 of DispatcherHelper.
   - REST support doesn't have an expressive way to return headers or error
   codes. It will be nice if we create a base class called HttpResolution
   where we can set headers, error codes, check ResponseEntity of Spring MVC
   or DefaultHttpHeaders of Struts2.
   - The new class JsonResolution is tightly coupled with Jackson because
   JsonBuilder uses Jackson directly. What if need Gson? We need a
   JsonBuilderFactory there.
   - The parsing of JSON body is tightly coupled with Jackson. I developed
   in my fork a pluggable content type request wrapper and a Gson
   implementation.

Thank you so much. I'm open to code these features.
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Empty requests parameters

2017-07-13 Thread Nestor Hernandez
Hi, can you show some code?. An ActionBean? It's hard to tell what is the
problem with no more information.

2017-07-13 5:20 GMT-05:00 MJ :

> Hi all,
>
> I have a serious problem with stripes, Several queries are erroneous with
> empty parameters.
> The framework is unable to answer request and i have no default handler
> exception in the log.
> Making the application unusable
>
> This problem is random, in dev does not reproduce but in prod with for many
> connected user the application unusable.
>
> Thank you for your urgent help.
>
>
>
> --
> View this message in context: http://stripes.996289.n3.
> nabble.com/Empty-requests-parameters-tp18061.html
> Sent from the stripes-users mailing list archive at Nabble.com.
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Stripes and Paypal IPN

2017-05-25 Thread Nestor Hernandez
The integration with any payment gateway is not necessary related with a
web framework. Furthermore, it is a responsability of the bussiness layer
not of the presentation layer (Stripes).

Regards.

2017-05-25 2:17 GMT-05:00 Heather and Jon Turgeon <
tashiba40_evergr...@hotmail.com>:

> Hi all, since I seem to get some great advice from you all I thought I
> would ask if anyone has setup a Stripes action to handle Paypal IPN? I have
> started my action but thought I would ask to see if there is a better way.
> Thanks again.
>
>
> Jon
>
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Getting the results of JSP within an Action

2017-04-07 Thread Nestor Hernandez
Uhh, it's very strange what you do because JSP are not intended for that.
Why not use a template library like Velocity, Freemaker or Mustache?

2017-04-07 1:58 GMT-05:00 Heather and Jon Turgeon <
tashiba40_evergr...@hotmail.com>:

> Hi all, within my Stripes based website I do a few of thing. One of them
> is to create emails to send out to users. I am using HTML emails with the
> bodies written as strings (a bit of work and very messy). What I would like
> to do is use an Action to get the data from the db, then do a Resolution to
> a JSP, but get the results of the resolution within the Action in the form
> of a String. This way I can use JSP as an email template, grab the result
> and use this as the body of an email. Hopefully this is possible and thanks
> for any help.
>
>
> Jon
>
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] stripes 1.7

2017-03-30 Thread Nestor Hernandez
The Crsf integration is interesting: I have a couple of suggestions

   - It should not throw an generic IOException when Crsf fails, but a
   custom exception, maybe an CrsfValidationException
   - Prevent create new sessions with getRequest().getSession( false ). If
   there is no session it should throw the exception.
   - There's no need to introduce the interface CsrfProtected in order to
   get the current crsfToken. The crsfToken should be always in a request
   attribute for the user and the interceptor to use, something like JAX-RS
   MVC 1.0 does or even ASP.NET MVC does. Please check out
   http://www.agilejava.eu/2015/11/17/cool-security-feature-in-mvc-1-0/
   -


2017-03-30 13:23 GMT-05:00 Juan Pablo Santos Rodríguez <
juanpablo.san...@gmail.com>:

> Hi,
>
> AFAIK, big major changes are REST and async ActionBeans. Because of the
> latter ones, minimum servlet-api is 3.0. Don't know anything about 1.7
> release, though.
>
>
> br,
> juan pablo
>
> p.s.: couldn't resist, also an Stripes - Spring Boot integration at
> https://github.com/juanpablo-santos/stripes-spring-boot O:-)
>
> On Thu, Mar 30, 2017 at 3:05 AM, Daniil S  wrote:
>
>> Working on extracting CSRF for Stripes from our internal project. May be
>> useful to some - https://github.com/SirDaniil/StripesCSRF (I remember
>> there was a thread about this some time ago).
>>
>> On 3/28/2017 8:22 PM, Joaquin Valdez wrote:
>>
>> Hello!
>>
>> Just curious if there is any news on the release of Stripes 1.7?  Or is
>> there a feature list of Stripes 1.7.
>>
>> Thanks,
>> Joaquin Valdez
>> joaquinfval...@gmail.com
>>
>>
>>
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> ___
>> Stripes-users mailing 
>> listStripes-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>>
>> 
>> --
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> ___
>> Stripes-users mailing list
>> Stripes-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Stripes Interceptors for Azure Application Insight tool

2017-01-23 Thread Nestor Hernandez
Hi, in order to use interceptors you can check this page, it's very well
explained:

https://stripesframework.atlassian.net/wiki/display/STRIPES/Intercept+Execution

2017-01-22 21:28 GMT-05:00 D. Salvatore :

> Hi everyone,
> I would like to to test the Application Insight tool of Microsoft Azure.
> For this reason, I took a Java EE application, jpetshop (
> https://github.com/mybatis/jpetstore-6), and I am trying to set up the
> Application Insight on top of it following this guide:
> https://docs.microsoft.com/en-us/azure/application-insights/
> app-insights-java-get-started
>
> I added the Maven dependency and repository and, thanks to Eclipse, I
> created the ApplicationInsights.xml file with my InstrumentationKey. The
> only thing that I am not sure about is how to add is the HTTP filter on
> this application (point 4).
>
> For Struts 2 I should add this code to its XML file:
>
> * *
> *class="com.microsoft.applicationinsights.web.struts.RequestNameInterceptor"
> />*
> * *
> *  name="ApplicationInsightsRequestNameInterceptor" />*
>
> However I don't know how to provide the some information to Stripes.
>
>
>
> Do you know how can I do that?
>
> Thank you
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] Pluggable content type request wrapper

2016-11-16 Thread Nestor Hernandez
Hi,
I'm developing some features  in order to improve the current REST support.
Until now the JSON parsing of the request body is tightly coupled with a
Jackson implementation. I introduced a factory in order to provide any
implementation for a content type not just JSON, eg. XML, YAML, etc.

This is not finished yet,  I think it needs some tests, but you can check
out the code here:
https://github.com/StripesFramework/stripes/compare/master...iluvtr:master

I want to send a pull request with a JsonBuilderFactory finished in order
to decouple the JsonResolution class from the current Jackson implementation

Thanks

Nestor
--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Is there any change in Resource Bundle support since 2008?

2016-01-11 Thread Nestor Hernandez
Hi, the ResourceBundle implementation works pretty well and is enough even
for advanced cases (eg. database resource bundle). Stripes has followed an
stable path in that respect.

You can download the Stripes examples and  there there is a quickstart:
https://stripesframework.atlassian.net/wiki/display/STRIPES/Quick+Start+Guide

Cheers




2016-01-07 13:36 GMT-05:00 Tika Spic :

> Hi,
>
> In the book "Stripes...and Java Web Development is Fun Again", there is a
> note from Tim Fennell located at the very end of the chapter 11 named
> "Making it Multilingual". It can be seen that he is not quite satisfied
> with current ResourceBundles implementation and announces change in the
> next release. Since the book was written for Stripes 1.5 and the current
> version is 1.6 I would like to know whether some changes o that sort have
> been implemented in new release?
>
> p.s.
> Is there some tutorial in html or pdf regarding most recent Stripes
> release?
>
>
> --
>
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311=/4140___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Tag Library Docs

2015-12-14 Thread Nestor Hernandez
I think it's a broken link
El 14/12/2015 3:55 a. m., "Richard P. Osseweyer" 
escribió:

>
> Hi All,
>
> Has anyone noticed that the Stripes Tag Library Docs appear to be down,
> or is it just a broken link in the Stripes Framework wiki?
>
>
> https://stripesframework.ci.cloudbees.com/job/Stripes%201.6.0/ws/stripes/target/site/tlddoc/index.html
>
> - Richard
>
>
>
> --
> ___
> 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


[Stripes-users] REST Support

2015-12-13 Thread Nestor Hernandez
Hi Stripes users. I've checking out the REST support in Stripes. I see that
there are some things missing or to improve:

   - REST support uses naming patterns which is discouraged because
typographical
   errors may result in silent failures and other points described by Bloch
   (
   
http://jtechies.blogspot.pe/2012/07/item-35-prefer-annotations-to-naming.html).
   Now we have annotations. Look at JUnit, they are no more using naming
   patterns to test classes, they have @Test. Naming patterns seems like
   we're back in Java 1.4. Please let's use @POST, @GET, @DELETE,etc.
   -
   - REST support by default, and with no chance for further customization,
   packages up all the validation errors in a defined way. It will be
   better if we leave the developer free to change it respecting
   ValidationErrorHandler. Look line 357 of DispatcherHelper.
   -
   - REST support doesn't have an expressive way to return headers or error
   codes. It will be nice if we create a class called HttpResolution which can
   send headers, error codes, check  ResponseEntity of Spring MVC or
   DefaultHttpHeaders of Struts2.
   -
   - We need an enumeration for status codes something like HttpStatus of
   Spring MVC:
   
https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/http/HttpStatus.html
   -
   - The new class JsonResolution is tightly coupled with Jackson because
   JsonBuilder uses Jackson directly. What if need Gson? We need a
   JsonBuilderFactory there.
   -
   - Last, the new class HttpRequestMethod can be better called HttpMethod,
   is more shorter.

Thanks!
--
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Integrate Hibernate or eBean with Stripes

2015-08-21 Thread Nestor Hernandez
Hi Yadav, Are you sure that you want to use the Hibernate API?, We have an
standard API for ORM that is called JPA and works with multiple
providers(Hibernate, EclipseLink, etc.)

If you're deploying to a Java EE server (Full or WebProfile) then i'ts very
easy to use JPA, because it all comes integrated. There are many Java EE
servers like TomEE, Glassfish, WebLogic.

This page has a good example in order to use JPA with EJB in TomEE
https://jaxenter.com/getting-started-with-apache-tomee-105824.html. Usually
only the configuration of the database is different in servers, the API is
the same .

Once you have your Dao you can inject (@Inject) in an ActionBean. In order
to do that get this plugin
https://github.com/StripesFramework/stripes-injection-enricher

Cheers!









2015-08-21 12:58 GMT-05:00 Tom Coleman tcole...@autowares.com:


 Check out stripersist:

 http://sourceforge.net/projects/stripes-stuff/files/Stripersist/

 There is a sample program in the distribution.

 It simple and works like a charm.

 On Aug 20, 2015, at 8:27 PM, parveen yadav wrote:

 Hi All,

 This is my first interaction with Stripes. The framework looks clean and
 simple. I come from Oracle Commerce(formally ATG) background and do not
 have
 experience with any other frameworks at all. I am unable to find any step
 by
 step guide to integrate Hibernate or EBean with stripes. The documentation
 (only for Hibernate) provided on the site is more for a experienced
 programmer.

 I am developing a portal related to real-estate. It will be really helpful
 if someone could help me out on integrating ebeans or hibernate with
 Stripes

 thanks
 yadav




 --

 ___
 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] Typed Text Templates with Stripes

2015-08-05 Thread Nestor Hernandez
Hey Remi. Looks good. Seems to try to emulate ASP. NET razor template. But,
seems like you're intentionally breaking rules about the use of scriptlets.
El 5/8/2015 19:00, VANKEISBELCK Remi r...@rvkb.com escribió:

 Hi folks,

 I have managed to wrap up a 0.1-beta release for those who want to try out
 TTT templates with Stripes.

 The whole TTT fwk (compiler, build tools, IDE plugin) is there :
 https://github.com/pojosontheweb/ttt

 The Stripes integration is here :
 https://github.com/pojosontheweb/ttt/tree/master/stripes

 For the impatient, here's a TTT-style Calculator template
 https://github.com/pojosontheweb/ttt/blob/master/stripes-testprj/src/main/java/stttripes/templates/CalculatorTemplate.ttt,
 adapted from the Stripes Examples.

 I don't have much of the JSP tags ported yet (basically only s:form and
 s:link), but it's easier than I thought. I hope to continue with this and
 cover the whole features soon.

 Tell me what you think.

 Cheers

 Rémi




 --

 ___
 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] [Stripes-dev] Stripes 1.6 Released!

2015-07-24 Thread Nestor Hernandez
My wish List:
1. Sort the validation errors by the position declared in the actionbean.
2. Built in REST support
3. Verify Http methods POST, GET, etc. It could be some @HandlesMethod
4. Annotate more than one actionbean with the same @UrlBinding value and
distingish them by the Http method
 El 24/7/2015 11:50, VANKEISBELCK Remi r...@rvkb.com escribió:

 Cool ! Nice work fellows ! I thought we were pretty much dead ;P

 Is there any kinda major changes page where we can see what's really
 different compared to 1.x ? The processors etc... I've been away from the
 IRC channel for a while, but I recall that the others (Ben and the gang)
 had changed a few things like the lifecycle changes etc.

 Aside from my daily job, I've been trying Play! recently and I've been
 quite impressed. It has the strongest foundation I've seen, plus a ton of
 neat little things.

 Anyway, here' my wish list  for 2.0, inspired from Play! :
 1/ Async, non-blocking support
 2/ Dynamic action beans (ie that are resolved at run-time instead of
 startup-time)
 3/ Better flash scope (using cookies for example)
 4/ Built-in JSON support
 5/ Statically Typed templates
 6/ Full Java config (probably already doable, not sure)
 7/ Nested Validation (we do this already on 1.7 with Woko, but it's a bit
 hackish) BeanValidatio JSR ?
 8/ Hot reload (JavaRebel ?)

 I have tried 1/ over the 1.7 codebase and it seemed impossible.
 Same for 2/ : the concept of dynamic actions isn't compatible with the
 current lifecycle...

 Cheers !

 Rémi








 2015-07-23 23:09 GMT+02:00 Rick Grashel rgras...@gmail.com:

 Hi all,

 I wanted to take this opportunity to announce the formal release of
 Stripes v1.6.  For those who are running earlier versions of Stripes
 (v1.5.8 or earlier) or even earlier versions of 1.6-SNAPSHOT, there are
 significant improvements and defect fixes.  The list of items included in
 this release are at the following link:

 https://stripesframework.atlassian.net/issues/?filter=10230

 You can download the latest release from Github here:

 https://github.com/StripesFramework/stripes/releases

 Or you can download it directly from Jenkins:


 https://stripesframework.ci.cloudbees.com/job/Stripes%201.6.0/lastSuccessfulBuild/artifact/dist/target/

 The 1.6 release has been published to Sonatype repo, so it is available
 through Maven for inclusion in your POMs (thanks, Ben!).

 Planning for Stripes 2.0 is going to be underway.  If you have
 suggestions for improvements, fixes, or new features you'd like to see,
 please feel free to enter an issue request in JIRA (
 https://stripesframework.atlassian.net/), post a message here
 (stripes-users, stripes-devel), or let us know on IRC (#stripes).  There
 have been some great suggestions already for things to help take Stripes
 2.0 into the future.  We'd love to hear your feedback.

 Thanks!

 -- Rick


 --

 ___
 Stripes-development mailing list
 stripes-developm...@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-development




 --

 ___
 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] [Stripes-dev] Stripes 1.6 Released!

2015-07-23 Thread Nestor Hernandez
Great news!
El 23/7/2015 21:49, Iwao AVE! haraw...@gmail.com escribió:

 Thank you, Rick and the team!

 // Iwao


 --
 ___
 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] StreamingResolution, temporary files, and Exceptions

2015-07-09 Thread Nestor Hernandez
Well, I think that that could be much better like this. Just write to the
response outpustream.

return new StreamingResolution() {
public void stream(request, response){
 getExportCsv(response.getOutputstream());
}
}
El 9/7/2015 17:48, William Krick kr...@3feetunder.com escribió:

 Sorry to dig up an old thread but I was working on another project for a
 while and now I'm coming back to the original project and the
 StreamingResolution issue.

 The hybrid solution posted by Ben Gunter seems to work well.  Thank you.

 I have two questions/concerns.

 1) I see why tempFile needs to be declared final (to access it inside of
 the StreamingResolution), and I also see why it needs to be an array where
 we reference item 0 (to get around it being final for the method that
 populates the temp file and creates the InputStream), but it really looks
 and feels like a hack.  Isn't there a better way to do this that isn't so
 hacky?

 2) I'm doing this same thing (populating a temp file, streaming it to the
 user, deleting the temp file) in a lot of places in a multi-page web
 application.  Is there a clean way to encapsulate these 20-something lines
 of code into a class so that I'm not copy/pasting boilerplate code over and
 over again?

 Thanks


 On Tue, Jun 24, 2014 at 8:25 AM, Ben Gunter bgun...@cpons.com wrote:

 Yes, sort of a hybrid of your two approaches.

 public Resolution exportCsv() throws IOException {
 final File tempFile[] = { null };
 final InputStream is;
 try {
 tempFile[0] =
 File.createTempFile(UUID.randomUUID().toString(), null);
 getCsvData(tempFile[0]);
 is = new FileInputStream(tempFile[0]);
 } catch (IOException e) {
 logger.error(Unable to export to csv file:  + e);
 throw new IOException();
 } finally {
 FileUtils.deleteQuietly(tempFile[0]);
 }

 return new StreamingResolution(Constants.CONTENT_TYPE_CSV, is) {
 public void stream(HttpServletResponse response) throws
 Exception {
 try {
 super.stream(response);
 } finally {
 FileUtils.deleteQuietly(tempFile[0]);
 }
 }
 }.setFilename(export.csv);
 }


 On Mon, Jun 23, 2014 at 5:33 PM, William Krick kr...@3feetunder.com
 wrote:

 In my web application, I have code that generates a temporary file
 (based on user input) and streams it back to the user using a
 StreamingResolution.

 The initial implementation had a utility method that generated the file
 and passed back an InputStream...

 public Resolution exportCsv() throws IOException {
   InputStream is = getCsvData();
   StreamingResolution sr = new
 StreamingResolution(Constants.CONTENT_TYPE_CSV, is);
   sr.setFilename(export.csv);
   return sr;
 }

 However, I want to be able to clean up the temporary file after it has
 been streamed to the user.
 I thought that I could use the anonymous inner class method described in
 the stripes javadocs...

 public Resolution exportCsv() throws IOException {
   return new StreamingResolution(Constants.CONTENT_TYPE_CSV) {
 public void stream(HttpServletResponse response) throws Exception {
   File tempFile = null;
   InputStream is = null;
   try {
 tempFile = File.createTempFile(UUID.randomUUID().toString(),
 null);
 getCsvData(tempFile);
 is = new FileInputStream(tempFile);
 IOUtils.copy(is, response.getOutputStream());
 is.close();
   }
   catch(IOException e) {
 logger.error(Unable to export to csv file:  + e);
 throw new IOException();
   }
   finally {
 IOUtils.closeQuietly(is);
 FileUtils.deleteQuietly(tempFile);
   }
 }
   }.setFilename(export.csv);
 }


 I'm finding that if there's an exception, whatever error page my
 application generates gets streamed back to the user in a file called
 export.csv.  So this method isn't really viable, at least the way I'm
 using it.

 Is there a pattern for this sort of thing in Stripes?




 --
 Open source business process management suite built on Java and Eclipse
 Turn processes into business applications with Bonita BPM Community
 Edition
 Quickly connect people, data, and systems into organized workflows
 Winner of BOSSIE, CODIE, OW2 and Gartner awards
 http://p.sf.net/sfu/Bonitasoft
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users




 --
 Open source business process management suite built on Java and Eclipse
 Turn processes into business applications with Bonita BPM Community
 Edition
 Quickly connect people, data, and systems into organized 

Re: [Stripes-users] StreamingResolution, temporary files, and Exceptions

2015-07-09 Thread Nestor Hernandez
Your method getExportCsv could be like this:

getExportCsv (outpustream){
   //Write to the outpustream
}

And there is no need of temp files !
Cheers
El 9/7/2015 18:07, Nestor Hernandez ilu...@gmail.com escribió:

 Well, I think that that could be much better like this. Just write to the
 response outpustream.

 return new StreamingResolution() {
 public void stream(request, response){
  getExportCsv(response.getOutputstream());
 }
 }
 El 9/7/2015 17:48, William Krick kr...@3feetunder.com escribió:

 Sorry to dig up an old thread but I was working on another project for a
 while and now I'm coming back to the original project and the
 StreamingResolution issue.

 The hybrid solution posted by Ben Gunter seems to work well.  Thank you.

 I have two questions/concerns.

 1) I see why tempFile needs to be declared final (to access it inside of
 the StreamingResolution), and I also see why it needs to be an array where
 we reference item 0 (to get around it being final for the method that
 populates the temp file and creates the InputStream), but it really looks
 and feels like a hack.  Isn't there a better way to do this that isn't so
 hacky?

 2) I'm doing this same thing (populating a temp file, streaming it to the
 user, deleting the temp file) in a lot of places in a multi-page web
 application.  Is there a clean way to encapsulate these 20-something lines
 of code into a class so that I'm not copy/pasting boilerplate code over and
 over again?

 Thanks


 On Tue, Jun 24, 2014 at 8:25 AM, Ben Gunter bgun...@cpons.com wrote:

 Yes, sort of a hybrid of your two approaches.

 public Resolution exportCsv() throws IOException {
 final File tempFile[] = { null };
 final InputStream is;
 try {
 tempFile[0] =
 File.createTempFile(UUID.randomUUID().toString(), null);
 getCsvData(tempFile[0]);
 is = new FileInputStream(tempFile[0]);
 } catch (IOException e) {
 logger.error(Unable to export to csv file:  + e);
 throw new IOException();
 } finally {
 FileUtils.deleteQuietly(tempFile[0]);
 }

 return new StreamingResolution(Constants.CONTENT_TYPE_CSV, is) {
 public void stream(HttpServletResponse response) throws
 Exception {
 try {
 super.stream(response);
 } finally {
 FileUtils.deleteQuietly(tempFile[0]);
 }
 }
 }.setFilename(export.csv);
 }


 On Mon, Jun 23, 2014 at 5:33 PM, William Krick kr...@3feetunder.com
 wrote:

 In my web application, I have code that generates a temporary file
 (based on user input) and streams it back to the user using a
 StreamingResolution.

 The initial implementation had a utility method that generated the file
 and passed back an InputStream...

 public Resolution exportCsv() throws IOException {
   InputStream is = getCsvData();
   StreamingResolution sr = new
 StreamingResolution(Constants.CONTENT_TYPE_CSV, is);
   sr.setFilename(export.csv);
   return sr;
 }

 However, I want to be able to clean up the temporary file after it has
 been streamed to the user.
 I thought that I could use the anonymous inner class method described
 in the stripes javadocs...

 public Resolution exportCsv() throws IOException {
   return new StreamingResolution(Constants.CONTENT_TYPE_CSV) {
 public void stream(HttpServletResponse response) throws Exception {
   File tempFile = null;
   InputStream is = null;
   try {
 tempFile = File.createTempFile(UUID.randomUUID().toString(),
 null);
 getCsvData(tempFile);
 is = new FileInputStream(tempFile);
 IOUtils.copy(is, response.getOutputStream());
 is.close();
   }
   catch(IOException e) {
 logger.error(Unable to export to csv file:  + e);
 throw new IOException();
   }
   finally {
 IOUtils.closeQuietly(is);
 FileUtils.deleteQuietly(tempFile);
   }
 }
   }.setFilename(export.csv);
 }


 I'm finding that if there's an exception, whatever error page my
 application generates gets streamed back to the user in a file called
 export.csv.  So this method isn't really viable, at least the way I'm
 using it.

 Is there a pattern for this sort of thing in Stripes?




 --
 Open source business process management suite built on Java and Eclipse
 Turn processes into business applications with Bonita BPM Community
 Edition
 Quickly connect people, data, and systems into organized workflows
 Winner of BOSSIE, CODIE, OW2 and Gartner awards
 http://p.sf.net/sfu/Bonitasoft
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: [Stripes-users] StreamingResolution, temporary files, and Exceptions

2015-07-09 Thread Nestor Hernandez
In any case the solution I posted works

1. Existing file

getExportCsv(outpustream) {
File file =  ...
Inputstream in = null;
try{
in = new FileInpustream(file);
IOUtils.copy(in, outpustream)
} finally{
  IOUtils.closeQuietly(in);
}
}

2. Just write to the outpustream
El 9/7/2015 18:34, Rick Grashel rgras...@gmail.com escribió:

 I could be wrong, but it sounded to me like he was generating the CSV file
 on the filesystem based on user-input.  So it could be a file being created
 out of the database.  If the CSV file can be very large, he definitely
 should keep it on the file system and use buffered streams to send it back
 to the client.  Otherwise, he stands to consume a lot of memory on the
 server which is bad.

 It's very easy to delete the temporary file in a finally block with a high
 confidence that the deletion won't fail.

 -- Rick


 On Thu, Jul 9, 2015 at 6:27 PM, Nestor Hernandez ilu...@gmail.com wrote:

 Your method getExportCsv could be like this:

 getExportCsv (outpustream){
//Write to the outpustream
 }

 And there is no need of temp files !
 Cheers
 El 9/7/2015 18:07, Nestor Hernandez ilu...@gmail.com escribió:

 Well, I think that that could be much better like this. Just write to
 the response outpustream.

 return new StreamingResolution() {
 public void stream(request, response){
  getExportCsv(response.getOutputstream());
 }
 }
 El 9/7/2015 17:48, William Krick kr...@3feetunder.com escribió:

 Sorry to dig up an old thread but I was working on another project for
 a while and now I'm coming back to the original project and the
 StreamingResolution issue.

 The hybrid solution posted by Ben Gunter seems to work well.  Thank you.

 I have two questions/concerns.

 1) I see why tempFile needs to be declared final (to access it inside
 of the StreamingResolution), and I also see why it needs to be an array
 where we reference item 0 (to get around it being final for the method that
 populates the temp file and creates the InputStream), but it really looks
 and feels like a hack.  Isn't there a better way to do this that isn't so
 hacky?

 2) I'm doing this same thing (populating a temp file, streaming it to
 the user, deleting the temp file) in a lot of places in a multi-page web
 application.  Is there a clean way to encapsulate these 20-something lines
 of code into a class so that I'm not copy/pasting boilerplate code over and
 over again?

 Thanks


 On Tue, Jun 24, 2014 at 8:25 AM, Ben Gunter bgun...@cpons.com wrote:

 Yes, sort of a hybrid of your two approaches.

 public Resolution exportCsv() throws IOException {
 final File tempFile[] = { null };
 final InputStream is;
 try {
 tempFile[0] =
 File.createTempFile(UUID.randomUUID().toString(), null);
 getCsvData(tempFile[0]);
 is = new FileInputStream(tempFile[0]);
 } catch (IOException e) {
 logger.error(Unable to export to csv file:  + e);
 throw new IOException();
 } finally {
 FileUtils.deleteQuietly(tempFile[0]);
 }

 return new StreamingResolution(Constants.CONTENT_TYPE_CSV, is)
 {
 public void stream(HttpServletResponse response) throws
 Exception {
 try {
 super.stream(response);
 } finally {
 FileUtils.deleteQuietly(tempFile[0]);
 }
 }
 }.setFilename(export.csv);
 }


 On Mon, Jun 23, 2014 at 5:33 PM, William Krick kr...@3feetunder.com
 wrote:

 In my web application, I have code that generates a temporary file
 (based on user input) and streams it back to the user using a
 StreamingResolution.

 The initial implementation had a utility method that generated the
 file and passed back an InputStream...

 public Resolution exportCsv() throws IOException {
   InputStream is = getCsvData();
   StreamingResolution sr = new
 StreamingResolution(Constants.CONTENT_TYPE_CSV, is);
   sr.setFilename(export.csv);
   return sr;
 }

 However, I want to be able to clean up the temporary file after it
 has been streamed to the user.
 I thought that I could use the anonymous inner class method described
 in the stripes javadocs...

 public Resolution exportCsv() throws IOException {
   return new StreamingResolution(Constants.CONTENT_TYPE_CSV) {
 public void stream(HttpServletResponse response) throws Exception
 {
   File tempFile = null;
   InputStream is = null;
   try {
 tempFile = File.createTempFile(UUID.randomUUID().toString(),
 null);
 getCsvData(tempFile);
 is = new FileInputStream(tempFile);
 IOUtils.copy(is, response.getOutputStream());
 is.close();
   }
   catch(IOException e) {
 logger.error(Unable to export to csv file:  + e);
 throw new IOException();
   }
   finally {
 IOUtils.closeQuietly(is);
 FileUtils.deleteQuietly(tempFile

Re: [Stripes-users] Stripes-users Digest, Vol 107, Issue 4

2015-06-23 Thread Nestor Hernandez
Remember that the ActionBean must stream the file using range support
El jun. 22, 2015 7:30 PM, Nestor Hernandez ilu...@gmail.com escribió:

 Jon,I think the solution for content in demand is that you create a
 temporary file with that content. Then show to the user a link pointing to
 an ActionBean that will stream the previously generated file.

 Cheers
 El jun. 22, 2015 6:18 PM, Heather and Jon Turgeon 
 tashiba40_evergr...@hotmail.com escribió:

 Hi Remi, I did consider rangeSupport but I read this in the docs as a
 reason why not to use range support.

 The input to this StreamingResolution
 http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/StreamingResolution.html
 was created on-demand, and retrieving in byte ranges would redo this
 process for every byte range. 

 All my content is generated on demand, but my users often see failed
 downloads. I personally have only seen this when the internet connection is
 dropped (we are all on sailboats so our connections are either wifi or 3G).
 I guess my question is does anyone know the best practice for retrying
 dynamic content downloads? I am guessing it is something in my Javascript
 (I am using jquery and ajax to do the download) where I make sure the
 download was complete, if not try again for x numbers of times before
 giving up?

  From: stripes-users-requ...@lists.sourceforge.net
  Subject: Stripes-users Digest, Vol 107, Issue 4
  To: stripes-users@lists.sourceforge.net
  Date: Mon, 22 Jun 2015 12:00:53 +
 
  Send Stripes-users mailing list submissions to
  stripes-users@lists.sourceforge.net
 
  To subscribe or unsubscribe via the World Wide Web, visit
  https://lists.sourceforge.net/lists/listinfo/stripes-users
  or, via email, send a message with subject or body 'help' to
  stripes-users-requ...@lists.sourceforge.net
 
  You can reach the person managing the list at
  stripes-users-ow...@lists.sourceforge.net
 
  When replying, please edit your Subject line so it is more specific
  than Re: Contents of Stripes-users digest...
 
 
  Today's Topics:
 
  1. Re: File downloads, not really sure how to phrase question
  (Nestor Hernandez)
  2. Re: File downloads, not really sure how to phrase question
  (VANKEISBELCK Remi)
  3. Re: File downloads, not really sure how to phrase question
  (Nestor Hernandez)
 
 
  --
 
  Message: 1
  Date: Sun, 21 Jun 2015 11:39:56 -0500
  From: Nestor Hernandez ilu...@gmail.com
  Subject: Re: [Stripes-users] File downloads, not really sure how to
  phrase question
  To: Stripes Users List stripes-users@lists.sourceforge.net
  Message-ID:
  CAMsyVLKAgNracwgYpqoENRZDy88SNPp8akeVC1c9=5wwgh+...@mail.gmail.com
  Content-Type: text/plain; charset=utf-8
 
  Hi Jon, I think your requirement has more to do with the way you manage
  your files than with Stripes.
 
  My advise that you split the file in multiple parts and then give
 option to
  the user to download those parts
  A quick google for 'split file java' send me to
 
 http://www.eecis.udel.edu/~trnka/CISC370-05J/code/FileSplitter/FileSplitter.java
 .
  Maybe you can adapt that code.
  El jun. 21, 2015 3:42 AM, Heather and Jon Turgeon 
  tashiba40_evergr...@hotmail.com escribi?:
 
  Hi all, my app builds files to download upon a user's request. Using
  StreamingResolution seems to work well most of the time. One problem I
 seem
  to be having is my site sort of supports users with internet connections
  that are frequently less than great (it is a site used by sailors
 cruising
  in remote areas of the world). I think what I need to implement is some
  sort of multi-part with checksum for these downloads in order to get
 these
  files to my users. Could someone point me in the right direction as to
 how
  to go about this using Stripes? I am guessing something on the client
 end
  will also need to be written?
 
  Jon
 
 
 --
 
  ___
  Stripes-users mailing list
  Stripes-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/stripes-users
  -- next part --
  An HTML attachment was scrubbed...
 
  --
 
  Message: 2
  Date: Mon, 22 Jun 2015 12:55:17 +0200
  From: VANKEISBELCK Remi r...@rvkb.com
  Subject: Re: [Stripes-users] File downloads, not really sure how to
  phrase question
  To: Stripes Users List stripes-users@lists.sourceforge.net
  Message-ID:
  CAG-EEs1CwFapEPoqtjz6=k2tfj4n26xb_fa5rmvqdigccs1...@mail.gmail.com
  Content-Type: text/plain; charset=utf-8
 
  Hi
 
  Have you considered using range support ?
 
  http://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7233.html
 
  It allows a client to specify a range of the resource to be fetched, so
  that the resource can be downloaded in chunks.
 
  Stripes does provide support for Ranges :
 
 http://stripes.sourceforge.net

Re: [Stripes-users] Stripes-users Digest, Vol 107, Issue 4

2015-06-22 Thread Nestor Hernandez
Jon,I think the solution for content in demand is that you create a
temporary file with that content. Then show to the user a link pointing to
an ActionBean that will stream the previously generated file.

Cheers
El jun. 22, 2015 6:18 PM, Heather and Jon Turgeon 
tashiba40_evergr...@hotmail.com escribió:

 Hi Remi, I did consider rangeSupport but I read this in the docs as a
 reason why not to use range support.

 The input to this StreamingResolution
 http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/StreamingResolution.html
 was created on-demand, and retrieving in byte ranges would redo this
 process for every byte range. 

 All my content is generated on demand, but my users often see failed
 downloads. I personally have only seen this when the internet connection is
 dropped (we are all on sailboats so our connections are either wifi or 3G).
 I guess my question is does anyone know the best practice for retrying
 dynamic content downloads? I am guessing it is something in my Javascript
 (I am using jquery and ajax to do the download) where I make sure the
 download was complete, if not try again for x numbers of times before
 giving up?

  From: stripes-users-requ...@lists.sourceforge.net
  Subject: Stripes-users Digest, Vol 107, Issue 4
  To: stripes-users@lists.sourceforge.net
  Date: Mon, 22 Jun 2015 12:00:53 +
 
  Send Stripes-users mailing list submissions to
  stripes-users@lists.sourceforge.net
 
  To subscribe or unsubscribe via the World Wide Web, visit
  https://lists.sourceforge.net/lists/listinfo/stripes-users
  or, via email, send a message with subject or body 'help' to
  stripes-users-requ...@lists.sourceforge.net
 
  You can reach the person managing the list at
  stripes-users-ow...@lists.sourceforge.net
 
  When replying, please edit your Subject line so it is more specific
  than Re: Contents of Stripes-users digest...
 
 
  Today's Topics:
 
  1. Re: File downloads, not really sure how to phrase question
  (Nestor Hernandez)
  2. Re: File downloads, not really sure how to phrase question
  (VANKEISBELCK Remi)
  3. Re: File downloads, not really sure how to phrase question
  (Nestor Hernandez)
 
 
  --
 
  Message: 1
  Date: Sun, 21 Jun 2015 11:39:56 -0500
  From: Nestor Hernandez ilu...@gmail.com
  Subject: Re: [Stripes-users] File downloads, not really sure how to
  phrase question
  To: Stripes Users List stripes-users@lists.sourceforge.net
  Message-ID:
  CAMsyVLKAgNracwgYpqoENRZDy88SNPp8akeVC1c9=5wwgh+...@mail.gmail.com
  Content-Type: text/plain; charset=utf-8
 
  Hi Jon, I think your requirement has more to do with the way you manage
  your files than with Stripes.
 
  My advise that you split the file in multiple parts and then give option
 to
  the user to download those parts
  A quick google for 'split file java' send me to
 
 http://www.eecis.udel.edu/~trnka/CISC370-05J/code/FileSplitter/FileSplitter.java
 .
  Maybe you can adapt that code.
  El jun. 21, 2015 3:42 AM, Heather and Jon Turgeon 
  tashiba40_evergr...@hotmail.com escribi?:
 
  Hi all, my app builds files to download upon a user's request. Using
  StreamingResolution seems to work well most of the time. One problem I
 seem
  to be having is my site sort of supports users with internet connections
  that are frequently less than great (it is a site used by sailors
 cruising
  in remote areas of the world). I think what I need to implement is some
  sort of multi-part with checksum for these downloads in order to get
 these
  files to my users. Could someone point me in the right direction as to
 how
  to go about this using Stripes? I am guessing something on the client end
  will also need to be written?
 
  Jon
 
 
 --
 
  ___
  Stripes-users mailing list
  Stripes-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/stripes-users
  -- next part --
  An HTML attachment was scrubbed...
 
  --
 
  Message: 2
  Date: Mon, 22 Jun 2015 12:55:17 +0200
  From: VANKEISBELCK Remi r...@rvkb.com
  Subject: Re: [Stripes-users] File downloads, not really sure how to
  phrase question
  To: Stripes Users List stripes-users@lists.sourceforge.net
  Message-ID:
  CAG-EEs1CwFapEPoqtjz6=k2tfj4n26xb_fa5rmvqdigccs1...@mail.gmail.com
  Content-Type: text/plain; charset=utf-8
 
  Hi
 
  Have you considered using range support ?
 
  http://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7233.html
 
  It allows a client to specify a range of the resource to be fetched, so
  that the resource can be downloaded in chunks.
 
  Stripes does provide support for Ranges :
 
 http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/StreamingResolution.html#setRangeSupport(boolean)
 
  Most media players / download tools (even

Re: [Stripes-users] File downloads, not really sure how to phrase question

2015-06-22 Thread Nestor Hernandez
I didn't noticed the range support. Great idea Remi
El jun. 22, 2015 5:56 AM, VANKEISBELCK Remi r...@rvkb.com escribió:

 Hi

 Have you considered using range support ?

 http://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7233.html

 It allows a client to specify a range of the resource to be fetched, so
 that the resource can be downloaded in chunks.

 Stripes does provide support for Ranges :

 http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/action/StreamingResolution.html#setRangeSupport(boolean)

 Most media players / download tools (even the browsers) implement ranges
 client-side. For example, when you browser downloads a large file, the
 download may be interrupted several times without you even noticing it. The
 browser uses ranges to resume the download from where it last stopped.

 Cheers

 Rémi



 2015-06-21 10:42 GMT+02:00 Heather and Jon Turgeon 
 tashiba40_evergr...@hotmail.com:

 Hi all, my app builds files to download upon a user's request. Using
 StreamingResolution seems to work well most of the time. One problem I seem
 to be having is my site sort of supports users with internet connections
 that are frequently less than great (it is a site used by sailors cruising
 in remote areas of the world). I think what I need to implement is some
 sort of multi-part with checksum for these downloads in order to get these
 files to my users. Could someone point me in the right direction as to how
 to go about this using Stripes? I am guessing something on the client end
 will also need to be written?

 Jon


 --

 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users




 --
 Monitor 25 network devices or servers for free with OpManager!
 OpManager is web-based network management software that monitors
 network devices and physical  virtual servers, alerts via email  sms
 for fault. Monitor 25 devices for free with no restriction. Download now
 http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical  virtual servers, alerts via email  sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] using stripes select just for the collection feature

2015-03-17 Thread Nestor Hernandez
Hey William, I think you need to use a plain  c:forEach

select name= 
c:forEach items = ${actionBean.list } var=a
option value=${a.prop}/${a.anotherProp}/option
/c:forEach/

/select



2015-03-17 15:55 GMT-05:00 Joaquin Valdez joaquinfval...@gmail.com:

 I wonder if the dynamic tag library would help out here?

 Joaquin



 On Tue, Mar 17, 2015 at 11:08 AM, William Krick kr...@3feetunder.com
 wrote:

 I have a stripes:select that I'm using to provide a list of items to
 the user using the stripes:option-collection.

 When an item is selected in the list, some javascript is triggered that
 adds some on-screen text to a table along with some hidden input tags that
 get submitted with the page.

 However, the actual value currently selected in the stripes:select
 isn't important and I don't need or want it to be submitted.  The only
 reason I'm suing stripes:select is to take advantage of the collection
 population feature.

 The problem I'm having is that stripes:select requires a name.
 If you leave the name blank like this...

 stripes:select name=
 stripes:options-collection collection=${actionBean.itemList}
 value=id label=display /
 /stripes:select

 ...you get an error when you submit...

 [DefaultActionBeanPropertyBinder] Could not bind property with name [] to
 bean of type...

 ...followed by a NullPointerException.


 However, if you give it a dummy name like this...

 stripes:select name=dummyName
 stripes:options-collection collection=${actionBean.itemList}
 value=id label=display /
 /stripes:select

 ...you get a different error when the page loads...

 [DefaultPopulationStrategy] Could not find property [dummyName] on ...


 Obviously, out of the two choices, the second option is better because it
 doesn't cause an exception, but I was wondering if other people are using
 stripes:select this way and how they deal with the warnings/errors or if
 they just ignore them.

 I even tried this...

 select
 stripes:options-collection collection=${actionBean.itemList}
 value=id label=display /
 /select

 ...but that throws an exception when the page loads...

 net.sourceforge.stripes.exception.StripesJspException: Option tags must
 always be contained inside a select tag.



 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub
 for all
 things parallel software development, from weekly thought leadership
 blogs to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users




 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for
 all
 things parallel software development, from weekly thought leadership blogs
 to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Application Security Issue

2015-03-05 Thread Nestor Hernandez
This a very specific problem that doesn't necessarily have to do with
Stripes. I suggest that you check the logs of Tomcat and try to debug the
application.
I don't think that the problem has something to do with the the migration
to Tomcat 7 and Java 7.(I migrate to Java 7 the to Java 8 with no code
changes) Thanks God we're not using PHP and backwards compatibility in most
cases is assured.



2015-03-05 6:28 GMT-05:00 Nhlanhla Xolani Radebe mobileinfo...@gmail.com:

 Hello Stripes Users,

 I recently inherited some work to migrate a java web application from a
 physical CentOS server to an Ubuntu VPS, the application is running on the
 Stripes framework, hibernate, tomcat 6, java 6 and mysql server 5.2. The
 application is tomcat-centric meaning the whole ROOT folder in webapps
 contains pages for that specific app.

 So my attempt to reconstruct the app on tomcat 7, java 7 and mysql 5.5 has
 failed.

 What steps we took:
 1. I rebuilt everything on eclipse IDE and got everything working without
 errors
 2. I pointed the persistence.xml to the correct database
 3. I know it works properly because when running it, I enter incorrect
 login data and it tells you of the invalid details

 Where I get stuck.
 4. Upon entering the correct data, it shows there is a security error that
 says the user is unauthorised.



 Please help,

 Thanks in advance





 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for
 all
 things parallel software development, from weekly thought leadership blogs
 to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] CMS Integration with Stripes

2015-03-02 Thread Nestor Hernandez
One option could be Standard Servlet security offers Basic auth, SSL and
other goodies. Configure your web.xml pointing to an actionbean url
El mar 2, 2015 4:38 PM, Joaquin Valdez joaquinfval...@gmail.com
escribió:

 Thanks Rick!  Off topic a bit,  but how are login credentials handled with
 this framework when calling a rest method?

 Thanks
 Joaquin



 On Feb 28, 2015, at 7:13 AM, Rick Grashel rgras...@gmail.com wrote:

 Hi guys,

 I also had similar issues writing REST services with Stripes.  I
 absolutely did not want to get rid of Stripes, so I had to write a REST
 ActionBean framework for Stripes which supported all of Stripes validation
 and binding.  If you are interested, you can download it here:

 https://github.com/rgrashel/stripes-rest

 I can help anybody out with implementation of a REST service if they need
 it.  But for this library, full Stripes validation is supported.  It uses
 the same convention approach that Stripes uses, so you write get(),
 post(), delete(), head(), put() methods and they will be automatically
 called.  It also uses Stripes' own internal Javascript builder and has a
 new JsonResolution to create JSON-based responses.

 Give it a look if you are interested.  I have been using it in production
 for quite awhile and it works well.

 Thanks.

 -- Rick


 On Sat, Feb 28, 2015 at 7:17 AM, Janne Jalkanen janne.jalka...@ecyrd.com
 wrote:


 We’ve just been lazy and done

 public Resolution foo()
 {
  switch( getContext().getRequest().getMethod() )
  {
   case “post”:
 return doPost();
   case “get”
 return doGet()
   case “delete”:
 return doDelete();
   default:
 return new ErrorResolution( … );
 }
 }

 What’s a bit more difficult is to incorporate validation into this, but
 we basically have a superclass which has something like this:

 /**
  *  Normally Stripes turns validation errors into HTML, but since
 this is an API,
  *  we turn it into JSON.  Returns a JSON resolution with a single
  *  field error which then contains a number of errors.
  */
 @Override
 public Resolution handleValidationErrors( ValidationErrors errors )
 {
 JSONObject obj = new JSONObject();


 obj.put( error, constructErrorObject(errors) );


 return new JSONResolution( HttpServletResponse.SC_BAD_REQUEST,
 obj );
 }

 /**
  *  Turns a ValidationErrors document into JSON.
  *
  *  @param errors
  *  @return
  */
 private Object constructErrorObject( ValidationErrors errors )
 {
 JSONObject obj = new JSONObject();


 if( !errors.hasFieldErrors() )
 {
 if( errors.containsKey( ValidationErrors.GLOBAL_ERROR ) )
 {
 obj.put( code, ERR_VALIDATION );
 obj.put( description, errors.get( ValidationErrors.
 GLOBAL_ERROR ).get( 0 ).getMessage( getContext().getLocale() ) );
 }
 }
 else
 {
 for( ListValidationError list : errors.values() )
 {
 obj.put( code, ERR_VALIDATION );
 obj.put( description, list.get(0).getFieldName() + : +
 list.get( 0 ).getMessage( getContext().getLocale() ) );
 }
 }


 obj.put(status, 400);


 return obj;
 }

 JSONResolution is a custom class which has this in its heart:

 protected static ObjectMapper c_mapper = new ObjectMapper();
 protected static ObjectMapper c_prettyMapper = new ObjectMapper();


 static
 {
 c_prettyMapper.configure( SerializationFeature.INDENT_OUTPUT,
 true );
 }

 @Override
 public void execute( HttpServletRequest request, HttpServletResponse
 response ) throws Exception
 {
 response.setStatus( m_status );
 response.setContentType( m_contentType );
 response.setCharacterEncoding( UTF-8 );


 if( true.equals(request.getParameter( pretty )) )
 c_prettyMapper.writeValue( response.getOutputStream(),
 m_object );
 else
 c_mapper.writeValue( response.getOutputStream(), m_object );

 response.getOutputStream().flush();
 }

 This btw lets you just get nice JSON back from any API call by adding
 “pretty=true” to the request URL.  This has proven to be invaluable while
 debugging.

 One important caveat is that to protect against CSRF attacks you will
 want to make sure that every single one of your API endpoints handles GET
 requests properly. Since Stripe does not really differentiate between GET
 and POST, you might accidentally allow people to make changes to your DB
 using a GET method.  We just limit the allowable methods via an annotation
 and an interceptor.

 Stripe is OK for REST API development; more modern frameworks like
 Dropwizard do make some things a bit easier though (btw, Dropwizard+Guice
 has a lot of the same feel as Stripe for development - though Stripe’s
 templating system is still pretty darned powerful and 

Re: [Stripes-users] Problem with Stripes:param

2015-02-26 Thread Nestor Hernandez
Hi, I think this problem is related to encoding. You can try a Servlet
filter mapped to /*  and call the methods setCharacterEncoding(UTF-8) of
HttpServletResponse and HttpServletRequest
El feb 26, 2015 6:29 PM, Nahid Seidi nahid.se...@gmail.com escribió:

 Hi

 I am sending some variables from stripes:param to another actionbean in
 order to show them in another jsp file. The problem is that if a variable
 has non-english characters like (ä,ö,...) stripes:param encode them to some
 wired format. I used ecoding tags in my jsp but doesn't work. Since
 stripes:param is inside a stripes:link, could it be something with
 stripes:link? For example if 'fname' in first jsp has a character like 'ö'
 stripes converts it to some other characters when it shows it in second
 jsp! I don't think it's about encoding, because the characters are shown
 correctly in first jsp but when I pass them using stripes:param they're
 changed somehow!

 first jsp

 stripes:link 
 beanclass=se.theducation.course.ui.action.student.StudentEditExcelAction 
 event=loadStudent 
 stripes:param name=fname value=${array.getStudent().getFirstName() } 
 /
 stripes:param name=lname value=${array.getStudent().getLastName() } 
 /
 edit/stripes:link

 StudentEditExcelAction.java

 @UrlBinding(/Student/editExcel.action)public class StudentEditExcelAction 
 implements ActionBean {
 private String fname;private String lname;
 @DefaultHandler@DontValidatepublic Resolution edit() {
 return forward(editExcel);}
 @DontValidatepublic Resolution loadStudent() {
 System.out.println(utbildare:  + school); //TODO delete this later
 return forward(editExcel);}

 second jsp

 table class=solid style=margin-top: 5px; padding: 5px; width:900px
 tr class=solid
 td class=solid
 tags:labeled label=Firstname:br /
 stripes:text name=fname/
 /tags:labeled
 /td
 td class=solid
 tags:labeled label=Lastname:br /
 stripes:text name=lname/
 /tags:labeled
 /td
 /tr/table




 --
 Dive into the World of Parallel Programming The Go Parallel Website,
 sponsored
 by Intel and developed in partnership with Slashdot Media, is your hub for
 all
 things parallel software development, from weekly thought leadership blogs
 to
 news, videos, case studies, tutorials and more. Take a look and join the
 conversation now. http://goparallel.sourceforge.net/
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users


--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] Plans for Java 8

2015-01-23 Thread Nestor Hernandez
For example when returning StreamingResolutions instead of

 final Report report..;

return new StreamingResolution(application/pdf) {

@Override
protected void stream(HttpServletResponse response) throws
Exception {
report.executePdf( response.getOutputStream());
}

}.setFilename(report.pdf);


It could be short, sweet and nice like this:

Report report..;

   return new StreamingResolution(application/pdf)
  .streaming(  response  - report.executePdf(
response.getOutputStream()) )
  .setFilename(report.pdf);

Or maybe passing directly an ServletOutputStream

Report report..;

   return new StreamingResolution(application/pdf)
  .streaming(  out - report.executePdf(  out )  )
  .setFilename(report.pdf);




2015-01-23 7:44 GMT-05:00 Nestor Hernandez ilu...@gmail.com:

 Hi guys, As you Java 8 is a great leap forward in the language, I was
 wondering if there is some features planned for Stripes using Java 8
 features like lambdas, method references, streams, etc.

--
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] Plans for Java 8

2015-01-23 Thread Nestor Hernandez
Hi guys, As you Java 8 is a great leap forward in the language, I was
wondering if there is some features planned for Stripes using Java 8
features like lambdas, method references, streams, etc.
--
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users