Alessio Stalla | 10 Feb 10:07
Gravatar

Non-UTF8 URL character encoding in UrlBuilder

Hello list,

We've been using Stripes for sevaral months in our projects and so far 
it's been great. However, we stumbled upon a problem I'd like to discuss.

Tomcat by default is configured to handle ISO-8859-1 encoded URLs, that 
is, when a non-ASCII character is encoded with %nn in a URL, that nn is 
assumed to be the code for a character in the ISO-8859-1 charset. It is 
possible to change this default in Tomcat on a per-connector basis, but 
there are cases when our application runs on a Tomcat installation that 
we have no control over.
However, the Stripes UrlBuilder (or better the StringUtil class it uses) 
always encodes/decodes URLs in UTF-8. This breaks URLs with non-ASCII 
characters, as well as RedirectResolution and everything else that uses 
UrlBuilder, when used on a default Tomcat installation, or one which has 
been configured to encode URLs in some encoding different from UTF-8. 
And it's pretty much impossible to override from user code.
Since in our applications we generally try not to store anything in 
session, we tend to pass certain user-provided data around as GET 
parameters. We could manually encode that data to ASCII, but I think 
that if Stripes made the URL character encoding configurable, we could 
avoid some hassle.

Has someone else encountered the same problem? Are we doing something wrong?

Regards,
Alessio

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
(Continue reading)

Thomas Menke | 10 Feb 02:35
Picon
Gravatar

Stripes:select: force to use the value attribute?

Hi @ll,

I have a JSP page that contains:

<stripes:select name="someName" value="someValue">
   <stripes:options-enumeration enum="someClass" />
</stripes:select>

After spending a good while trying to figure out why stripes would not 
set the selected="selected" flag even though simply adding ${someValue} 
next to the select revealed that the value passed to stripes was 
correct, I discovered that stripes would simply ignore the value I 
supplied if it can find another value querying the population strategy. 
The value I supplied is overwritten in class 
net.sourceforge.stripes.tag.InputSelectTag on line 125.

Unfortunately in my case stripes found such a value on my action bean.

This leaves me with two questions:
1. Is this really intended behaviour? After all, why would I use the 
value attribute if I did not mean it?
2. Is there anything I can do about the behaviour besides changing my 
variable names or changing/extending stripes tag-lib?

Thomas

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
(Continue reading)

Chris Johnson | 7 Feb 17:06
Picon
Gravatar

Checkboxes

Can someone explain exactly when checkboxes are rendered checked.. 
I've done some playing around but it's still unclear to me how exactly
they should work:

<stripes:checkbox name="item.id" value="A" checked="A"/> not checked ?
<stripes:checkbox name="item.id" value="A" checked="B"/> not checked ?

The documentation says:  If the value of the checkbox is found to equal or be 
contained by the 'checked' object then the checkbox will default to
rendering as checked.

I find that if the value of the checkbox is found to be 
equal to the value in name then the checkbox is checked..

Can someone explain how i should be using this ? 

Thanks,
..Chris

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Nick Stuart | 6 Feb 17:29
Gravatar

New CDI Extension brewing...

Hey all, old user of Stripes (been about a year since I've used it actively) here and just wanted to let you all know I'm trying out a way to get Stripes and CDI/EE6 integration going. So far results are promising, and I'm hoping for minimal changes needed to Stripes itself to get the nicest possible integration between the two. I've got a github project setup if anyone is interested: https://github.com/nstuart/stripes-cdi

Beware, this is the result of two days of hacking, so it's very sparse at the moment, but, even with that it still is working at the basic level of interaction. (and no real test cases yet!)

I'll update the stripes wiki itself at some point if I get to the point where I feel comfortable with the working level of the code, but it's not there yet. I mainly wanted throw this out there to see if anyone else has considered this route yet and taken a look at possible issues and/or complications with it. Right now, my big issues is how to cleanly handle the Proxies CDI/Weld are returning for when Stripes tries to do some inspection on them, and this is where I think I might need to tweak some internal code a bit.

Let me know what you think! 
-Nick
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users
Moritz Petersen | 31 Jan 10:13
Picon
Gravatar

Layout reuse "like a component"

Hello everyone,

maybe I'm missing something, but I have trouble doing the following:

The idea is to define a piece of reusable JSP code, that can be
embedded into other JSP pages. I thought it should be quite simple
with Stripes' layout tags.

Take an example: in some JSP pages I'd like to display address
information, so I just want to implement that address view only once.

contact.jsp:

...
<h1>Contact Sheet</h1>
<div>${actionBean.contact.name}</div>
<stripes:layout-render name="/layout/address.jsp"
address="${actionBean.contact.address}" />
...

address.jsp:

...
<stripes:layout-definition>
  <div>${address.street}</div>
  <div>${address.city}</div>
  ...
</stripes:layout-definition>

The idea is, to pass the "address" object to the reusable layout
component and use it there.

Is there any way to do this with Stripes? Any other recommendations?

Thank you & regards,
Moritz

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
andres | 29 Jan 18:28
Picon
Picon
Favicon
Gravatar

Integrate Stripes v1.5.6 and jQuery v1.7.1 attribute name Error

Hello,
I'm developing web with Stripes. I found some problem integrate Stripes v1.5.6 and jQuery v1.7.1.
If i declare on jsp Stripes nested properties in attribute name with a dot,
like <s:text name="advert.categoryId" ...
jQuery v1.7.1 gives me a syntax error: "Syntax error, unrecognized expression: [name=advert.categoryId]"
I was looking on google but i cant found a solution with a Stripes.
One thing, it seems the jQuery guys changed treatment of selectors.
http://api.jquery.com/category/selectors/
If somebody can help me with a solution i appreciate it very much.
Thanks for attention.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users
Cliff Jones | 23 Jan 23:10
Gravatar

StackOverflowError on JBoss EAP 5.1

I have a StackOverflowError using Stripes on JBoss EAP 5.1.  The OS is REL, and 
using Sun (Oracle) Java 1.6.  Has anyone else seen this issue or maybe have an 
idea where to start?

----------
2012-01-23 13:50:15,060 ERROR [org.apache.catalina.core.ContainerBase.
[jboss.web].[localhost].[/].[StripesDispatcher]] (ajp-xxx.xxx.221.212-8009-1) 
Servlet.service() for servlet StripesDispatcher threw exception
java.lang.StackOverflowError
        at 
org.apache.catalina.core.ApplicationHttpRequest.getAttribute
(ApplicationHttpReques
t.java:220)
        at 
org.apache.catalina.core.ApplicationHttpRequest.getAttribute
(ApplicationHttpReques
t.java:222)
        at 
org.apache.catalina.core.ApplicationHttpRequest.getAttribute
(ApplicationHttpReques
t.java:222)
--------

That last line is repeated about 1000 times in each stack trace.

Let me know what information that I could provide which would be helpful in 
tracking this down.  

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
ted_smith2010 | 13 Jan 10:26
Picon

actiona name without .action suffix

I am using freemarker
 
   <servlet-mapping>
        <servlet-name>Freemarker</servlet-name>
        <url-pattern>*.ftl</url-pattern>
    </servlet-mapping>

in order to do this, I have to put .action
    <servlet-mapping>
        <servlet-name>StripesDispatcher</servlet-name>
        <url-pattern>*.action</url-pattern>
    </servlet-mapping>

without explicit suffix, if I just use <url-pattern>*</url-pattern>
*.ftl are also sent to the dispatchers instead of freemarker servlet.

Is there any way to work around this so that I can use url like
http://host/context/createuser   instead of
http://host/context/createuser.action

Thanks

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users
Samuel Santos | 12 Jan 21:10
Picon
Gravatar

Re: File inputs with the new "multiple" attribute

Does it also work with an array (does not need an index)?

In the ActionBean:
    <at> Validate
   public FileBean[] files;

In the JSP:
<stripes-dynamic:file id="files" name="files[]" multiple="multiple"/>

Cheers,

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


On Thu, Jan 12, 2012 at 7:57 PM, Mike McNally <emmecinque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
whoa that's awesome ... I'll def. give that a try.

Thanks!!!

On Thu, Jan 12, 2012 at 1:19 PM, Poitras Christian
<Christian.Poitras <at> ircm.qc.ca> wrote:
> Hi,
>
> I've managed to create a workarounf for this a while ago.
> I thought about adding it to StripesStuff project, but it would be better if it was in Stripes itself.
> I think it would be easy to change it so that we won't need to add a "[0]" at the end of the name element.
>
> In the ActionBean:
>     <at> Validate
>    public List<FileBean> files;
>
> In the JSP:
> <stripes-dynamic:file id="files" name="files[0]" multiple="multiple"/>
>
> You need a new net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.
>     <at> SuppressWarnings("unchecked")
>    public void build(HttpServletRequest request, File tempDir, long maxPostSize)
>            throws IOException, FileUploadLimitExceededException {
>        String charset;
>        Map<String,FileItem> files = new HashMap<String,FileItem>();
>        Map<String,String[]> parameters = new HashMap<String, String[]>();
>
>        try {
>            charset = request.getCharacterEncoding();
>            DiskFileItemFactory factory = new DiskFileItemFactory();
>            factory.setRepository(tempDir);
>            ServletFileUpload upload = new ServletFileUpload(factory);
>            upload.setSizeMax(maxPostSize);
>
>            List<FileItem> items = upload.parseRequest(request);
>            Map<String,List<String>> params = new HashMap<String, List<String>>();
>
>            for (FileItem item : items) {
>                // If it's a form field, add the string value to the list
>                if (item.isFormField()) {
>                    List<String> values = params.get(item.getFieldName());
>                    if (values == null) {
>                        values = new ArrayList<String>();
>                        params.put(item.getFieldName(), values);
>                    }
>                    values.add(charset == null ? item.getString() : item.getString(charset));
>                }
>                // Else store the file param
>                else {
>                    processFile(item, files);
>                }
>            }
>
>            // Now convert them down into the usual map of String->String[]
>            for (Map.Entry<String,List<String>> entry : params.entrySet()) {
>                List<String> values = entry.getValue();
>                parameters.put(entry.getKey(), values.toArray(new String[values.size()]));
>            }
>        }
>        catch (FileUploadBase.SizeLimitExceededException slee) {
>            throw new FileUploadLimitExceededException(maxPostSize, slee.getActualSize());
>        }
>        catch (FileUploadException fue) {
>            IOException ioe = new IOException("Could not parse and cache file upload data.");
>            ioe.initCause(fue);
>            throw ioe;
>        }
>
>        try {
>            Field charsetField = net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.class.getDeclaredField("charset");
>            if (!charsetField.isAccessible()) {
>                charsetField.setAccessible(true);
>            }
>            charsetField.set(this, charset);
>            Field filesField = net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.class.getDeclaredField("files");
>            if (!filesField.isAccessible()) {
>                filesField.setAccessible(true);
>            }
>            filesField.set(this, files);
>            Field parametersField = net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.class.getDeclaredField("parameters");
>            if (!parametersField.isAccessible()) {
>                parametersField.setAccessible(true);
>            }
>            parametersField.set(this, parameters);
>        } catch (NoSuchFieldException e) {
>            throw new RuntimeException("Could not set fields in super class", e);
>        } catch (IllegalAccessException e) {
>            throw new RuntimeException("Could not set fields in super class", e);
>        }
>    }
>    private void processFile(FileItem item, Map<String,FileItem> files) {
>        if (item.getFieldName().endsWith("[0]")
>                && files.containsKey(item.getFieldName())) {
>            String baseName = item.getFieldName().substring(0, item.getFieldName().length() - 3);
>            int index = 0;
>            while (files.containsKey(baseName + "[" + index + "]")) {
>                index++;
>            }
>            log.trace("renaming file parameter " + item.getFieldName() + " to " + baseName + "[" + index + "]");
>            files.put(baseName + "[" + index + "]", item);
>        } else {
>            files.put(item.getFieldName(), item);
>        }
>    }
>
> Christian
>
> -----Message d'origine-----
> De : Mike McNally [mailto:emmecinque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
> Envoyé : January-12-12 12:25 PM
> À : Stripes Users List
> Objet : [Stripes-users] File inputs with the new "multiple" attribute
>
> In newer browsers, it's possible to give input elements of type "file"
> the "multiple" attribute. That tells the browser to allow more than
> one file to be selected in the file chooser. That, in turn, results in
> a multi-valued request parameter.
>
> When I try this, however, it doesn't work, a situation which I think
> is documented on the wiki.  However that documentation was probably
> written before the advent of the "multiple" attribute, so the
> painfulness of the situation was not as evident then (and thus the
> indexed parameter name solution seemed quite reasonable). There's no
> way to fix this however; the browser is completely in charge of
> preparing the POST data.
>
> My question is, what is it that would have to be fixed in order to
> support "multiple" file parameters?  The web is moving pretty fast
> nowadays :-)
>
>
> --
> Turtle, turtle, on the ground,
> Pink and shiny, turn around.
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2
> _______________________________________________
> Stripes-users mailing list
> Stripes-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2
> _______________________________________________
> Stripes-users mailing list
> Stripes-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users



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

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Stripes-users mailing list
Stripes-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users
Mike McNally | 12 Jan 18:25
Picon
Gravatar

File inputs with the new "multiple" attribute

In newer browsers, it's possible to give input elements of type "file"
the "multiple" attribute. That tells the browser to allow more than
one file to be selected in the file chooser. That, in turn, results in
a multi-valued request parameter.

When I try this, however, it doesn't work, a situation which I think
is documented on the wiki.  However that documentation was probably
written before the advent of the "multiple" attribute, so the
painfulness of the situation was not as evident then (and thus the
indexed parameter name solution seemed quite reasonable). There's no
way to fix this however; the browser is completely in charge of
preparing the POST data.

My question is, what is it that would have to be fixed in order to
support "multiple" file parameters?  The web is moving pretty fast
nowadays :-)

--

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

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
Sonny Gill | 29 Dec 14:34
Picon
Gravatar

Restricting action invocation by HTTP method

Hi guys,


What is the Stripes approach to restricting action invocation by HTTP method?
For example, if I want to restrict my ItemEdit or ItemDelete action to only be invoked by HTTP POST method.

Cheers,
Sonny
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Gmane