FileUploadLimitExceededException and Flashscope

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

FileUploadLimitExceededException and Flashscope

samaxes
I use Stripes 1.5beta and the bug http://stripesframework.org/jira/browse/STS-402 still happens.

Using Ben hack to handle the FileUploadLimitExceededException:
public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    /*
     * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
     * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
     * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
     * construction of the FlashScope in which we need to store the error message.
     */

    // start of hack
    // wrap the request without handling multipart data
    StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
        /**
         * Ignore multipart content and set the locale at the same time.
         *
         * @param request the HTTP request to wrap.
         */
        @Override
        protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
            Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
            setLocale(locale);
        }
    };
    // end of hack

    // get referer URL
    URL referer = null;
    try {
        referer = new URL(request.getHeader("referer"));
    } catch (Exception e) {
        throw exception;
    }

    // convert referer path to context-relative path
    String path = referer.getFile();
    String contextPath = request.getContextPath();
    if (contextPath.length() > 0) {
        if (!path.startsWith(contextPath + "/"))
            throw exception;
        path = path.replace(contextPath, "");
    }

    // create action bean and context
    Configuration config = StripesFilter.getConfiguration();
    PVoucherActionBeanContext context = (MyActionBeanContext) config.getActionBeanContextFactory()
            .getContextInstance(request, response);
    ActionBean actionBean = config.getActionResolver().getActionBean(context);

    // try to guess the field name
    String fieldName = ValidationErrors.GLOBAL_ERROR;
    try {
        BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
        for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
            if (pd.getPropertyType().equals(FileBean.class)) {
                fieldName = pd.getName();
                break;
            }
        }
    } catch (Throwable t) {
    }

    // add validation error
    DecimalFormat format = new DecimalFormat("0.00");
    double max = (double) exception.getMaximum() / 1024;
    double posted = (double) exception.getPosted() / 1024;
    context.getValidationErrors().add(fieldName,
            new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

    // redirect back to referer
    return new RedirectResolution(path).flash(actionBean);
}

still crashes when flashing the action bean!

Isn't there a better way to handle this exception with Stripes 1.5?

Cheers,
Samuel

--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
Any on this issue?

I'm working with revision 910.


On Sun, May 18, 2008 at 3:17 AM, Samuel Santos <[hidden email]> wrote:
I use Stripes 1.5beta and the bug http://stripesframework.org/jira/browse/STS-402 still happens.

Using Ben hack to handle the FileUploadLimitExceededException:
public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    /*
     * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
     * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
     * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
     * construction of the FlashScope in which we need to store the error message.
     */

    // start of hack
    // wrap the request without handling multipart data
    StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
        /**
         * Ignore multipart content and set the locale at the same time.
         *
         * @param request the HTTP request to wrap.
         */
        @Override
        protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
            Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
            setLocale(locale);
        }
    };
    // end of hack

    // get referer URL
    URL referer = null;
    try {
        referer = new URL(request.getHeader("referer"));
    } catch (Exception e) {
        throw exception;
    }

    // convert referer path to context-relative path
    String path = referer.getFile();
    String contextPath = request.getContextPath();
    if (contextPath.length() > 0) {
        if (!path.startsWith(contextPath + "/"))
            throw exception;
        path = path.replace(contextPath, "");
    }

    // create action bean and context
    Configuration config = StripesFilter.getConfiguration();
    PVoucherActionBeanContext context = (MyActionBeanContext) config.getActionBeanContextFactory()
            .getContextInstance(request, response);
    ActionBean actionBean = config.getActionResolver().getActionBean(context);

    // try to guess the field name
    String fieldName = ValidationErrors.GLOBAL_ERROR;
    try {
        BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
        for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
            if (pd.getPropertyType().equals(FileBean.class)) {
                fieldName = pd.getName();
                break;
            }
        }
    } catch (Throwable t) {
    }

    // add validation error
    DecimalFormat format = new DecimalFormat("0.00");
    double max = (double) exception.getMaximum() / 1024;
    double posted = (double) exception.getPosted() / 1024;
    context.getValidationErrors().add(fieldName,
            new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

    // redirect back to referer
    return new RedirectResolution(path).flash(actionBean);
}

still crashes when flashing the action bean!

Isn't there a better way to handle this exception with Stripes 1.5?

Cheers,
Samuel

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



--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

Ben Gunter
Sorry, Samuel. I meant to respond earlier today. FileUploadExceededException is exceptional (no put intended) in that it can be thrown during the construction of the StripesRequestWrapper itself. Since the wrapper isn't created correctly, we can't pass it to the exception handler. Just about any other exception would occur after successful construction of the wrapper, and in those cases you would get the wrapper in your handler.

I don't know why you would be getting an exception when trying to flash a bean. Can you give us a stack trace?

-Ben

Samuel Santos wrote:
Any on this issue?

I'm working with revision 910.


On Sun, May 18, 2008 at 3:17 AM, Samuel Santos <[hidden email]> wrote:
I use Stripes 1.5beta and the bug http://stripesframework.org/jira/browse/STS-402 still happens.

Using Ben hack to handle the FileUploadLimitExceededException:
public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    /*
     * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
     * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
     * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
     * construction of the FlashScope in which we need to store the error message.
     */

    // start of hack
    // wrap the request without handling multipart data
    StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
        /**
         * Ignore multipart content and set the locale at the same time.
         *
         * @param request the HTTP request to wrap.
         */
        @Override
        protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
            Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
            setLocale(locale);
        }
    };
    // end of hack

    // get referer URL
    URL referer = null;
    try {
        referer = new URL(request.getHeader("referer"));
    } catch (Exception e) {
        throw exception;
    }

    // convert referer path to context-relative path
    String path = referer.getFile();
    String contextPath = request.getContextPath();
    if (contextPath.length() > 0) {
        if (!path.startsWith(contextPath + "/"))
            throw exception;
        path = path.replace(contextPath, "");
    }

    // create action bean and context
    Configuration config = StripesFilter.getConfiguration();
    PVoucherActionBeanContext context = (MyActionBeanContext) config.getActionBeanContextFactory()
            .getContextInstance(request, response);
    ActionBean actionBean = config.getActionResolver().getActionBean(context);

    // try to guess the field name
    String fieldName = ValidationErrors.GLOBAL_ERROR;
    try {
        BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
        for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
            if (pd.getPropertyType().equals(FileBean.class)) {
                fieldName = pd.getName();
                break;
            }
        }
    } catch (Throwable t) {
    }

    // add validation error
    DecimalFormat format = new DecimalFormat("0.00");
    double max = (double) exception.getMaximum() / 1024;
    double posted = (double) exception.getPosted() / 1024;
    context.getValidationErrors().add(fieldName,
            new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

    // redirect back to referer
    return new RedirectResolution(path).flash(actionBean);
}

still crashes when flashing the action bean!

Isn't there a better way to handle this exception with Stripes 1.5?

Cheers,
Samuel

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



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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
Thanks Ben,

My stack trace:
13:49:10,644 WARN  [DefaultExceptionHandler] File post limit exceeded. Limit: 10485760 bytes. Posted: 16014555 bytes.
13:49:10,649 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.FlashRequest.replaceRequest(FlashRequest.java:80)
    at net.sourceforge.stripes.controller.FlashScope.completeRequest(FlashScope.java:165)
    at net.sourceforge.stripes.controller.StripesFilter.flashOutbound(StripesFilter.java:308)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:255)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:423)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
    at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:286)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
13:49:10,662 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.FlashRequest.replaceRequest(FlashRequest.java:80)
    at net.sourceforge.stripes.controller.FlashScope.completeRequest(FlashScope.java:165)
    at net.sourceforge.stripes.controller.StripesFilter.flashOutbound(StripesFilter.java:308)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:255)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:423)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
    at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:286)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
13:49:10,663 ERROR [[localhost]] Exception Processing ErrorPage[errorCode=500, location=/WEB-INF/error.jsp?httpError=500]
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:397)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:447)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:423)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
    at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:286)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:93)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    ... 21 more
Caused by: java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.FlashRequest.replaceRequest(FlashRequest.java:80)
    at net.sourceforge.stripes.controller.FlashScope.completeRequest(FlashScope.java:165)
    at net.sourceforge.stripes.controller.StripesFilter.flashOutbound(StripesFilter.java:308)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:255)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    ... 24 more

--
Samuel

On Tue, May 20, 2008 at 3:19 AM, Ben Gunter <[hidden email]> wrote:
Sorry, Samuel. I meant to respond earlier today. FileUploadExceededException is exceptional (no put intended) in that it can be thrown during the construction of the StripesRequestWrapper itself. Since the wrapper isn't created correctly, we can't pass it to the exception handler. Just about any other exception would occur after successful construction of the wrapper, and in those cases you would get the wrapper in your handler.

I don't know why you would be getting an exception when trying to flash a bean. Can you give us a stack trace?

-Ben

Samuel Santos wrote:
Any on this issue?

I'm working with revision 910.


On Sun, May 18, 2008 at 3:17 AM, Samuel Santos <[hidden email]> wrote:
I use Stripes 1.5beta and the bug http://stripesframework.org/jira/browse/STS-402 still happens.

Using Ben hack to handle the FileUploadLimitExceededException:
public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    /*
     * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
     * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
     * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
     * construction of the FlashScope in which we need to store the error message.
     */

    // start of hack
    // wrap the request without handling multipart data
    StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
        /**
         * Ignore multipart content and set the locale at the same time.
         *
         * @param request the HTTP request to wrap.
         */
        @Override
        protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
            Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
            setLocale(locale);
        }
    };
    // end of hack

    // get referer URL
    URL referer = null;
    try {
        referer = new URL(request.getHeader("referer"));
    } catch (Exception e) {
        throw exception;
    }

    // convert referer path to context-relative path
    String path = referer.getFile();
    String contextPath = request.getContextPath();
    if (contextPath.length() > 0) {
        if (!path.startsWith(contextPath + "/"))
            throw exception;
        path = path.replace(contextPath, "");
    }

    // create action bean and context
    Configuration config = StripesFilter.getConfiguration();
    PVoucherActionBeanContext context = (MyActionBeanContext) config.getActionBeanContextFactory()
            .getContextInstance(request, response);
    ActionBean actionBean = config.getActionResolver().getActionBean(context);

    // try to guess the field name
    String fieldName = ValidationErrors.GLOBAL_ERROR;
    try {
        BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
        for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
            if (pd.getPropertyType().equals(FileBean.class)) {
                fieldName = pd.getName();
                break;
            }
        }
    } catch (Throwable t) {
    }

    // add validation error
    DecimalFormat format = new DecimalFormat("0.00");
    double max = (double) exception.getMaximum() / 1024;
    double posted = (double) exception.getPosted() / 1024;
    context.getValidationErrors().add(fieldName,
            new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

    // redirect back to referer
    return new RedirectResolution(path).flash(actionBean);
}

still crashes when flashing the action bean!

Isn't there a better way to handle this exception with Stripes 1.5?

Cheers,
Samuel

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



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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

Ben Gunter
You are creating the hacked up StripesRequestWrapper, but you're never using it. Also, we changed how localizable messages are looked up and that would cause an NPE with the code you have. I've done a little more hacking on it, and the following code will work if you make the wrapper final.
        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
                ExecutionContext exec = new ExecutionContext();
                exec.setActionBean(actionBean);
                exec.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(exec);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
  

-Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
Thanks Ben for your help, but unfortunately it doesn't work as expected.

It redirects correctly to the form page but loses all the form values and error messages.

My handle code:
    public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        LOGGER.warn(exception.getMessage());

        /*
         * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
         * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
         * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
         * construction of the FlashScope in which we need to store the error message.
         */
        final StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
            /**
             * Ignore multipart content and set the locale at the same time.
             *
             * @param request the HTTP request to wrap.
             */
            @Override
            protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
                Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
                setLocale(locale);
            }
        };

        // get referer URL
        URL referer = null;
        try {
            referer = new URL(request.getHeader("referer"));
        } catch (Exception e) {
            throw exception;
        }

        // convert referer path to context-relative path
        String path = referer.getFile();
        String contextPath = request.getContextPath();
        if (contextPath.length() > 0) {
            if (!path.startsWith(contextPath + "/"))
                throw exception;
            path = path.replace(contextPath, "");
        }

        // create action bean and context
        Configuration config = StripesFilter.getConfiguration();
        final PVoucherActionBeanContext context = (PVoucherActionBeanContext) config.getActionBeanContextFactory()
                .getContextInstance(request, response);
        final ActionBean actionBean = config.getActionResolver().getActionBean(context);

        // try to guess the field name
        String fieldName = ValidationErrors.GLOBAL_ERROR;
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
            for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
                if (pd.getPropertyType().equals(FileBean.class)) {
                    fieldName = pd.getName();
                    break;
                }
            }
        } catch (Throwable t) {
        }

        // add validation error
        DecimalFormat format = new DecimalFormat("0.00");
        double max = (double) exception.getMaximum() / 1024;
        double posted = (double) exception.getPosted() / 1024;
        context.getValidationErrors().add(fieldName,
                new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException,
                    IOException {
                ExecutionContext executionContext = new ExecutionContext();
                executionContext.setActionBean(actionBean);
                executionContext.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(executionContext);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
    }

--
Samuel


On Tue, May 20, 2008 at 5:15 PM, Ben Gunter <[hidden email]> wrote:
You are creating the hacked up StripesRequestWrapper, but you're never using it. Also, we changed how localizable messages are looked up and that would cause an NPE with the code you have. I've done a little more hacking on it, and the following code will work if you make the wrapper final.
        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
                ExecutionContext exec = new ExecutionContext();
                exec.setActionBean(actionBean);
                exec.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(exec);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
  

-Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

Ben Gunter
Unfortunately, this is as good as it gets. Take a look at this thread for more information.

http://article.gmane.org/gmane.comp.java.stripes.user/1079

-Ben

Samuel Santos wrote:
Thanks Ben for your help, but unfortunately it doesn't work as expected.

It redirects correctly to the form page but loses all the form values and error messages.

My handle code:
    public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        LOGGER.warn(exception.getMessage());

        /*
         * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
         * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
         * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
         * construction of the FlashScope in which we need to store the error message.
         */
        final StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
            /**
             * Ignore multipart content and set the locale at the same time.
             *
             * @param request the HTTP request to wrap.
             */
            @Override
            protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
                Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
                setLocale(locale);
            }
        };

        // get referer URL
        URL referer = null;
        try {
            referer = new URL(request.getHeader("referer"));
        } catch (Exception e) {
            throw exception;
        }

        // convert referer path to context-relative path
        String path = referer.getFile();
        String contextPath = request.getContextPath();
        if (contextPath.length() > 0) {
            if (!path.startsWith(contextPath + "/"))
                throw exception;
            path = path.replace(contextPath, "");
        }

        // create action bean and context
        Configuration config = StripesFilter.getConfiguration();
        final PVoucherActionBeanContext context = (PVoucherActionBeanContext) config.getActionBeanContextFactory()
                .getContextInstance(request, response);
        final ActionBean actionBean = config.getActionResolver().getActionBean(context);

        // try to guess the field name
        String fieldName = ValidationErrors.GLOBAL_ERROR;
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
            for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
                if (pd.getPropertyType().equals(FileBean.class)) {
                    fieldName = pd.getName();
                    break;
                }
            }
        } catch (Throwable t) {
        }

        // add validation error
        DecimalFormat format = new DecimalFormat("0.00");
        double max = (double) exception.getMaximum() / 1024;
        double posted = (double) exception.getPosted() / 1024;
        context.getValidationErrors().add(fieldName,
                new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException,
                    IOException {
                ExecutionContext executionContext = new ExecutionContext();
                executionContext.setActionBean(actionBean);
                executionContext.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(executionContext);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
    }

--
Samuel


On Tue, May 20, 2008 at 5:15 PM, Ben Gunter <[hidden email]> wrote:
You are creating the hacked up StripesRequestWrapper, but you're never using it. Also, we changed how localizable messages are looked up and that would cause an NPE with the code you have. I've done a little more hacking on it, and the following code will work if you make the wrapper final.
        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
                ExecutionContext exec = new ExecutionContext();
                exec.setActionBean(actionBean);
                exec.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(exec);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
  

-Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
But shouldn't it at least show the error message?


On Tue, May 20, 2008 at 7:06 PM, Ben Gunter <[hidden email]> wrote:
Unfortunately, this is as good as it gets. Take a look at this thread for more information.

http://article.gmane.org/gmane.comp.java.stripes.user/1079

-Ben

Samuel Santos wrote:
Thanks Ben for your help, but unfortunately it doesn't work as expected.

It redirects correctly to the form page but loses all the form values and error messages.

My handle code:
    public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        LOGGER.warn(exception.getMessage());

        /*
         * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
         * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
         * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
         * construction of the FlashScope in which we need to store the error message.
         */
        final StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
            /**
             * Ignore multipart content and set the locale at the same time.
             *
             * @param request the HTTP request to wrap.
             */
            @Override
            protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
                Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
                setLocale(locale);
            }
        };

        // get referer URL
        URL referer = null;
        try {
            referer = new URL(request.getHeader("referer"));
        } catch (Exception e) {
            throw exception;
        }

        // convert referer path to context-relative path
        String path = referer.getFile();
        String contextPath = request.getContextPath();
        if (contextPath.length() > 0) {
            if (!path.startsWith(contextPath + "/"))
                throw exception;
            path = path.replace(contextPath, "");
        }

        // create action bean and context
        Configuration config = StripesFilter.getConfiguration();
        final PVoucherActionBeanContext context = (PVoucherActionBeanContext) config.getActionBeanContextFactory()
                .getContextInstance(request, response);
        final ActionBean actionBean = config.getActionResolver().getActionBean(context);

        // try to guess the field name
        String fieldName = ValidationErrors.GLOBAL_ERROR;
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
            for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
                if (pd.getPropertyType().equals(FileBean.class)) {
                    fieldName = pd.getName();
                    break;
                }
            }
        } catch (Throwable t) {
        }

        // add validation error
        DecimalFormat format = new DecimalFormat("0.00");
        double max = (double) exception.getMaximum() / 1024;
        double posted = (double) exception.getPosted() / 1024;
        context.getValidationErrors().add(fieldName,
                new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException,
                    IOException {
                ExecutionContext executionContext = new ExecutionContext();
                executionContext.setActionBean(actionBean);
                executionContext.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(executionContext);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
    }

--
Samuel


On Tue, May 20, 2008 at 5:15 PM, Ben Gunter <[hidden email]> wrote:
You are creating the hacked up StripesRequestWrapper, but you're never using it. Also, we changed how localizable messages are looked up and that would cause an NPE with the code you have. I've done a little more hacking on it, and the following code will work if you make the wrapper final.
        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
                ExecutionContext exec = new ExecutionContext();
                exec.setActionBean(actionBean);
                exec.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(exec);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
  

-Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

Ben Gunter
Yes, it should. I think I know what's going on, and I'm working on something to address this. I'll get back to you later tonight or tomorrow morning (EDT) about it.

-Ben

Samuel Santos wrote:
But shouldn't it at least show the error message?


On Tue, May 20, 2008 at 7:06 PM, Ben Gunter <[hidden email]> wrote:
Unfortunately, this is as good as it gets. Take a look at this thread for more information.

http://article.gmane.org/gmane.comp.java.stripes.user/1079

-Ben

Samuel Santos wrote:
Thanks Ben for your help, but unfortunately it doesn't work as expected.

It redirects correctly to the form page but loses all the form values and error messages.

My handle code:
    public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        LOGGER.warn(exception.getMessage());

        /*
         * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
         * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
         * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
         * construction of the FlashScope in which we need to store the error message.
         */
        final StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
            /**
             * Ignore multipart content and set the locale at the same time.
             *
             * @param request the HTTP request to wrap.
             */
            @Override
            protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
                Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
                setLocale(locale);
            }
        };

        // get referer URL
        URL referer = null;
        try {
            referer = new URL(request.getHeader("referer"));
        } catch (Exception e) {
            throw exception;
        }

        // convert referer path to context-relative path
        String path = referer.getFile();
        String contextPath = request.getContextPath();
        if (contextPath.length() > 0) {
            if (!path.startsWith(contextPath + "/"))
                throw exception;
            path = path.replace(contextPath, "");
        }

        // create action bean and context
        Configuration config = StripesFilter.getConfiguration();
        final PVoucherActionBeanContext context = (PVoucherActionBeanContext) config.getActionBeanContextFactory()
                .getContextInstance(request, response);
        final ActionBean actionBean = config.getActionResolver().getActionBean(context);

        // try to guess the field name
        String fieldName = ValidationErrors.GLOBAL_ERROR;
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
            for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
                if (pd.getPropertyType().equals(FileBean.class)) {
                    fieldName = pd.getName();
                    break;
                }
            }
        } catch (Throwable t) {
        }

        // add validation error
        DecimalFormat format = new DecimalFormat("0.00");
        double max = (double) exception.getMaximum() / 1024;
        double posted = (double) exception.getPosted() / 1024;
        context.getValidationErrors().add(fieldName,
                new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException,
                    IOException {
                ExecutionContext executionContext = new ExecutionContext();
                executionContext.setActionBean(actionBean);
                executionContext.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(executionContext);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
    }

--
Samuel


On Tue, May 20, 2008 at 5:15 PM, Ben Gunter <[hidden email]> wrote:
You are creating the hacked up StripesRequestWrapper, but you're never using it. Also, we changed how localizable messages are looked up and that would cause an NPE with the code you have. I've done a little more hacking on it, and the following code will work if you make the wrapper final.
        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
                ExecutionContext exec = new ExecutionContext();
                exec.setActionBean(actionBean);
                exec.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(exec);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
  

-Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

Ben Gunter
Good morning, Samuel. We decided that since FULEE is so difficult to deal with that we should provide some code in Stripes itself to deal with it the best we can. I have added some code to DefaultExceptionHandler that specifically handles FULEE in a way very similar to what you have done. (Which was derived from a class called FULEECatcher that I posted to the list a long time ago.)

Here's what I need you to do now. Remove your FULEE handler and throw it away. Make sure your StripesResources.properties gets the new entry for "validation.file.postBodyTooBig" that has been added to the default StripesResources.properties. Behold the glory (hopefully). :-)

All the drawbacks previously noted still apply. Form repopulation will not work. No parameters (except clean URL params) will be available. But at least you'll be able to tell them what went wrong in a nice way.

If you want, you can extend DefaultExceptionHandler and override getFileUploadLimitExceededExceptionPath(HttpServletRequest) to return a path to a global JSP to report this error instead of having it forward back to the page that it was submitted from.

Please let me know if this works for you or not.

-Ben

Ben Gunter wrote:
Yes, it should. I think I know what's going on, and I'm working on something to address this. I'll get back to you later tonight or tomorrow morning (EDT) about it.

-Ben

Samuel Santos wrote:
But shouldn't it at least show the error message?


On Tue, May 20, 2008 at 7:06 PM, Ben Gunter <[hidden email]> wrote:
Unfortunately, this is as good as it gets. Take a look at this thread for more information.

http://article.gmane.org/gmane.comp.java.stripes.user/1079

-Ben

Samuel Santos wrote:
Thanks Ben for your help, but unfortunately it doesn't work as expected.

It redirects correctly to the form page but loses all the form values and error messages.

My handle code:
    public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        LOGGER.warn(exception.getMessage());

        /*
         * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
         * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
         * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
         * construction of the FlashScope in which we need to store the error message.
         */
        final StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
            /**
             * Ignore multipart content and set the locale at the same time.
             *
             * @param request the HTTP request to wrap.
             */
            @Override
            protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
                Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
                setLocale(locale);
            }
        };

        // get referer URL
        URL referer = null;
        try {
            referer = new URL(request.getHeader("referer"));
        } catch (Exception e) {
            throw exception;
        }

        // convert referer path to context-relative path
        String path = referer.getFile();
        String contextPath = request.getContextPath();
        if (contextPath.length() > 0) {
            if (!path.startsWith(contextPath + "/"))
                throw exception;
            path = path.replace(contextPath, "");
        }

        // create action bean and context
        Configuration config = StripesFilter.getConfiguration();
        final PVoucherActionBeanContext context = (PVoucherActionBeanContext) config.getActionBeanContextFactory()
                .getContextInstance(request, response);
        final ActionBean actionBean = config.getActionResolver().getActionBean(context);

        // try to guess the field name
        String fieldName = ValidationErrors.GLOBAL_ERROR;
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
            for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
                if (pd.getPropertyType().equals(FileBean.class)) {
                    fieldName = pd.getName();
                    break;
                }
            }
        } catch (Throwable t) {
        }

        // add validation error
        DecimalFormat format = new DecimalFormat("0.00");
        double max = (double) exception.getMaximum() / 1024;
        double posted = (double) exception.getPosted() / 1024;
        context.getValidationErrors().add(fieldName,
                new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException,
                    IOException {
                ExecutionContext executionContext = new ExecutionContext();
                executionContext.setActionBean(actionBean);
                executionContext.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(executionContext);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
    }

--
Samuel


On Tue, May 20, 2008 at 5:15 PM, Ben Gunter <[hidden email]> wrote:
You are creating the hacked up StripesRequestWrapper, but you're never using it. Also, we changed how localizable messages are looked up and that would cause an NPE with the code you have. I've done a little more hacking on it, and the following code will work if you make the wrapper final.
        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
                ExecutionContext exec = new ExecutionContext();
                exec.setActionBean(actionBean);
                exec.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(exec);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
  

-Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
Unfortunately it does not work:

2008-05-22 02:13:40,259 ERROR [MyDefaultExceptionHandler] File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
net.sourceforge.stripes.controller.FileUploadLimitExceededException: File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
    at net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.build(CommonsMultipartWrapper.java:107)
    at net.sourceforge.stripes.controller.multipart.DefaultMultipartWrapperFactory.wrap(DefaultMultipartWrapperFactory.java:143)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.constructMultipartWrapper(StripesRequestWrapper.java:119)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.<init>(StripesRequestWrapper.java:105)
    at net.sourceforge.stripes.controller.StripesFilter.wrapRequest(StripesFilter.java:281)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
2008-05-22 02:13:40,322 ERROR [MyDefaultExceptionHandler] A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:240)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 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)
    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)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
[...]

After some more testing I manage to get my handler working as expected:

public class DefaultExceptionHandler implements AutoExceptionHandler {

    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultExceptionHandler.class);
    [...]
    /**
     * If there's an ActionBean present, send the user back where they came from with a stern warning, otherwise send
     * them to the global error page.
     *
     * @param exception A FileUploadLimitExceededException exception
     * @param request The HttpServletRequest
     * @param response The HttpServletResponse
     * @return A ForwardResolution
     * @throws ServletException when fails to get the action bean context
     */
    public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
            HttpServletResponse response) throws ServletException {
        LOGGER.warn(exception.getMessage());

        /*
         * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
         * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
         * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
         * construction of the FlashScope in which we need to store the error message.
         */
        final StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
            /**
             * Ignore multipart content and set the locale at the same time.
             *
             * @param request the HTTP request to wrap.
             */
            @Override
            protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
                Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
                setLocale(locale);
            }
        };

        // get referer URL
        URL referer = null;
        try {
            referer = new URL(request.getHeader("referer"));
        } catch (Exception e) {
            throw exception;
        }

        // convert referer path to context-relative path
        String path = referer.getFile();
        String contextPath = request.getContextPath();
        if (contextPath.length() > 0) {
            if (!path.startsWith(contextPath + "/"))
                throw exception;
            path = path.replace(contextPath, "");
        }

        // create action bean and context
        Configuration config = StripesFilter.getConfiguration();
        final PVoucherActionBeanContext context = (PVoucherActionBeanContext) config.getActionBeanContextFactory()
                .getContextInstance(request, response);
        final ActionBean actionBean = config.getActionResolver().getActionBean(context);

        // redirect back to referer
        Map<String, Double> parameters = new HashMap<String, Double>();
        parameters.put("fileUploadMax", new Double((double) exception.getMaximum() / 1024 / 1024));
        parameters.put("fileUploadPosted", new Double((double) exception.getPosted() / 1024 / 1024));
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException,
                    IOException {
                ExecutionContext executionContext = new ExecutionContext();
                executionContext.setActionBean(actionBean);
                executionContext.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(executionContext);
                super.execute(wrapper, response);
            }
        }.flash(actionBean).addParameters(parameters);
    }
    [...]
}

I think this should be fixed in the Stripes core and I'm really grateful for your effort.
Thanks Ben!

--
Samuel


On Wed, May 21, 2008 at 3:02 PM, Ben Gunter <[hidden email]> wrote:
Good morning, Samuel. We decided that since FULEE is so difficult to deal with that we should provide some code in Stripes itself to deal with it the best we can. I have added some code to DefaultExceptionHandler that specifically handles FULEE in a way very similar to what you have done. (Which was derived from a class called FULEECatcher that I posted to the list a long time ago.)

Here's what I need you to do now. Remove your FULEE handler and throw it away. Make sure your StripesResources.properties gets the new entry for "validation.file.postBodyTooBig" that has been added to the default StripesResources.properties. Behold the glory (hopefully). :-)

All the drawbacks previously noted still apply. Form repopulation will not work. No parameters (except clean URL params) will be available. But at least you'll be able to tell them what went wrong in a nice way.

If you want, you can extend DefaultExceptionHandler and override getFileUploadLimitExceededExceptionPath(HttpServletRequest) to return a path to a global JSP to report this error instead of having it forward back to the page that it was submitted from.

Please let me know if this works for you or not.

-Ben

Ben Gunter wrote:
Yes, it should. I think I know what's going on, and I'm working on something to address this. I'll get back to you later tonight or tomorrow morning (EDT) about it.

-Ben

Samuel Santos wrote:
But shouldn't it at least show the error message?


On Tue, May 20, 2008 at 7:06 PM, Ben Gunter <[hidden email]> wrote:
Unfortunately, this is as good as it gets. Take a look at this thread for more information.

http://article.gmane.org/gmane.comp.java.stripes.user/1079

-Ben

Samuel Santos wrote:
Thanks Ben for your help, but unfortunately it doesn't work as expected.

It redirects correctly to the form page but loses all the form values and error messages.

My handle code:
    public Resolution handle(FileUploadLimitExceededException exception, HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        LOGGER.warn(exception.getMessage());

        /*
         * This is a hack from Ben Gunter received in the Stripes forum. It is related to Jira issue:
         * http://stripes.mc4j.org/jira/browse/STS-402. The problem is that when the exception handler is called, it
         * always receives the original request passed to the StripesFilter and not the wrapped request. That prevents
         * construction of the FlashScope in which we need to store the error message.
         */
        final StripesRequestWrapper wrapper = new StripesRequestWrapper(request) {
            /**
             * Ignore multipart content and set the locale at the same time.
             *
             * @param request the HTTP request to wrap.
             */
            @Override
            protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
                Locale locale = StripesFilter.getConfiguration().getLocalePicker().pickLocale(request);
                setLocale(locale);
            }
        };

        // get referer URL
        URL referer = null;
        try {
            referer = new URL(request.getHeader("referer"));
        } catch (Exception e) {
            throw exception;
        }

        // convert referer path to context-relative path
        String path = referer.getFile();
        String contextPath = request.getContextPath();
        if (contextPath.length() > 0) {
            if (!path.startsWith(contextPath + "/"))
                throw exception;
            path = path.replace(contextPath, "");
        }

        // create action bean and context
        Configuration config = StripesFilter.getConfiguration();
        final PVoucherActionBeanContext context = (PVoucherActionBeanContext) config.getActionBeanContextFactory()
                .getContextInstance(request, response);
        final ActionBean actionBean = config.getActionResolver().getActionBean(context);

        // try to guess the field name
        String fieldName = ValidationErrors.GLOBAL_ERROR;
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(actionBean.getClass());
            for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
                if (pd.getPropertyType().equals(FileBean.class)) {
                    fieldName = pd.getName();
                    break;
                }
            }
        } catch (Throwable t) {
        }

        // add validation error
        DecimalFormat format = new DecimalFormat("0.00");
        double max = (double) exception.getMaximum() / 1024;
        double posted = (double) exception.getPosted() / 1024;
        context.getValidationErrors().add(fieldName,
                new LocalizableError("error.file.too.large", format.format(max), format.format(posted)));

        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException,
                    IOException {
                ExecutionContext executionContext = new ExecutionContext();
                executionContext.setActionBean(actionBean);
                executionContext.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(executionContext);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
    }

--
Samuel


On Tue, May 20, 2008 at 5:15 PM, Ben Gunter <[hidden email]> wrote:
You are creating the hacked up StripesRequestWrapper, but you're never using it. Also, we changed how localizable messages are looked up and that would cause an NPE with the code you have. I've done a little more hacking on it, and the following code will work if you make the wrapper final.
        // redirect back to referer
        return new RedirectResolution(path) {
            @Override
            public void execute(HttpServletRequest request, HttpServletResponse response)
                    throws ServletException, IOException {
                ExecutionContext exec = new ExecutionContext();
                exec.setActionBean(actionBean);
                exec.setActionBeanContext(context);
                DispatcherHelper.fillInValidationErrors(exec);
                super.execute(wrapper, response);
            }
        }.flash(actionBean);
  

-Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________ Stripes-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/stripes-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

Ben Gunter
I'm a little baffled as to how this error is happening. Please make sure you have no other handlers registered for FULEE that might interfere with it. If it still doesn't work, please send me some code and an explanation of the flow so that I can try to reproduce it. Thanks!

-Ben

Samuel Santos wrote:
Unfortunately it does not work:

2008-05-22 02:13:40,259 ERROR [MyDefaultExceptionHandler] File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
net.sourceforge.stripes.controller.FileUploadLimitExceededException: File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
    at net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.build(CommonsMultipartWrapper.java:107)
    at net.sourceforge.stripes.controller.multipart.DefaultMultipartWrapperFactory.wrap(DefaultMultipartWrapperFactory.java:143)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.constructMultipartWrapper(StripesRequestWrapper.java:119)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.<init>(StripesRequestWrapper.java:105)
    at net.sourceforge.stripes.controller.StripesFilter.wrapRequest(StripesFilter.java:281)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
2008-05-22 02:13:40,322 ERROR [MyDefaultExceptionHandler] A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:240)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 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)
    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)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
[...]


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
Hi Ben, I haven't any other handler for FULEE.

I use an alternative exception handler (which implements AutoExceptionHandler), so using my own exception handler does the Stripes DefaultExceptionHandler still handle FULEE? Don't I need to handle it in any way?

The flow is as simple as it can be. The form that contains the file upload field is submitted to an action that validates the request and either insert it in the database and redirects to a listing page, or shows back the form with the validation error messages on it.

--
Samuel

On Thu, May 22, 2008 at 2:46 PM, Ben Gunter <[hidden email]> wrote:
I'm a little baffled as to how this error is happening. Please make sure you have no other handlers registered for FULEE that might interfere with it. If it still doesn't work, please send me some code and an explanation of the flow so that I can try to reproduce it. Thanks!

-Ben


Samuel Santos wrote:
Unfortunately it does not work:

2008-05-22 02:13:40,259 ERROR [MyDefaultExceptionHandler] File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
net.sourceforge.stripes.controller.FileUploadLimitExceededException: File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
    at net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.build(CommonsMultipartWrapper.java:107)
    at net.sourceforge.stripes.controller.multipart.DefaultMultipartWrapperFactory.wrap(DefaultMultipartWrapperFactory.java:143)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.constructMultipartWrapper(StripesRequestWrapper.java:119)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.<init>(StripesRequestWrapper.java:105)
    at net.sourceforge.stripes.controller.StripesFilter.wrapRequest(StripesFilter.java:281)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
2008-05-22 02:13:40,322 ERROR [MyDefaultExceptionHandler] A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:240)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 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)
    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)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
[...]


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

David G Friedman
Samuel,

Does this error occur if you temporarily remove your SiteMesh filter? (
I see it in your stack/trace )

Regards,
David

Samuel Santos wrote:

> Hi Ben, I haven't any other handler for FULEE.
>
> I use an alternative exception handler (which implements
> AutoExceptionHandler), so using my own exception handler does the
> Stripes DefaultExceptionHandler still handle FULEE? Don't I need to
> handle it in any way?
>
> The flow is as simple as it can be. The form that contains the file
> upload field is submitted to an action that validates the request and
> either insert it in the database and redirects to a listing page, or
> shows back the form with the validation error messages on it.
>
> --
> Samuel


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
Hey David,

No, Sitemesh has nothing to do with it :)

On Fri, May 23, 2008 at 12:58 AM, David G Friedman <[hidden email]> wrote:
Samuel,

Does this error occur if you temporarily remove your SiteMesh filter? (
I see it in your stack/trace )

Regards,
David

Samuel Santos wrote:
> Hi Ben, I haven't any other handler for FULEE.
>
> I use an alternative exception handler (which implements
> AutoExceptionHandler), so using my own exception handler does the
> Stripes DefaultExceptionHandler still handle FULEE? Don't I need to
> handle it in any way?
>
> The flow is as simple as it can be. The form that contains the file
> upload field is submitted to an action that validates the request and
> either insert it in the database and redirects to a listing page, or
> shows back the form with the validation error messages on it.
>
> --
> Samuel


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
In reply to this post by samaxes
Hi Ben,

Do you need more info on this? It still doesn't work for me with the latest revision.

--
Samuel


On Thu, May 22, 2008 at 8:49 PM, Samuel Santos <[hidden email]> wrote:
Hi Ben, I haven't any other handler for FULEE.

I use an alternative exception handler (which implements AutoExceptionHandler), so using my own exception handler does the Stripes DefaultExceptionHandler still handle FULEE? Don't I need to handle it in any way?

The flow is as simple as it can be. The form that contains the file upload field is submitted to an action that validates the request and either insert it in the database and redirects to a listing page, or shows back the form with the validation error messages on it.

--
Samuel

On Thu, May 22, 2008 at 2:46 PM, Ben Gunter <[hidden email]> wrote:
I'm a little baffled as to how this error is happening. Please make sure you have no other handlers registered for FULEE that might interfere with it. If it still doesn't work, please send me some code and an explanation of the flow so that I can try to reproduce it. Thanks!

-Ben


Samuel Santos wrote:
Unfortunately it does not work:

2008-05-22 02:13:40,259 ERROR [MyDefaultExceptionHandler] File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
net.sourceforge.stripes.controller.FileUploadLimitExceededException: File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
    at net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.build(CommonsMultipartWrapper.java:107)
    at net.sourceforge.stripes.controller.multipart.DefaultMultipartWrapperFactory.wrap(DefaultMultipartWrapperFactory.java:143)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.constructMultipartWrapper(StripesRequestWrapper.java:119)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.<init>(StripesRequestWrapper.java:105)
    at net.sourceforge.stripes.controller.StripesFilter.wrapRequest(StripesFilter.java:281)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
2008-05-22 02:13:40,322 ERROR [MyDefaultExceptionHandler] A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:240)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 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)
    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)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
[...]


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




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



--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

Ben Gunter
Samuel, I don't think we're on the same page. I added a FULEE handler to DefaultExceptionHandler, which is the superclass of DelegatingExceptionHandler. If you do not override the FULEE handler method in a subclass of DefaultExceptionHandler and you do not provide an AutoExceptionHandler that handles FULEE, then it will be handled by my code. If you do either of those things, then your exception handler will be responsible for FULEE.

-Ben

On Fri, May 23, 2008 at 11:29 PM, Samuel Santos <[hidden email]> wrote:
Hi Ben,

Do you need more info on this? It still doesn't work for me with the latest revision.

--
Samuel


On Thu, May 22, 2008 at 8:49 PM, Samuel Santos <[hidden email]> wrote:
Hi Ben, I haven't any other handler for FULEE.

I use an alternative exception handler (which implements AutoExceptionHandler), so using my own exception handler does the Stripes DefaultExceptionHandler still handle FULEE? Don't I need to handle it in any way?

The flow is as simple as it can be. The form that contains the file upload field is submitted to an action that validates the request and either insert it in the database and redirects to a listing page, or shows back the form with the validation error messages on it.

--
Samuel

On Thu, May 22, 2008 at 2:46 PM, Ben Gunter <[hidden email]> wrote:
I'm a little baffled as to how this error is happening. Please make sure you have no other handlers registered for FULEE that might interfere with it. If it still doesn't work, please send me some code and an explanation of the flow so that I can try to reproduce it. Thanks!

-Ben


Samuel Santos wrote:
Unfortunately it does not work:

2008-05-22 02:13:40,259 ERROR [MyDefaultExceptionHandler] File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
net.sourceforge.stripes.controller.FileUploadLimitExceededException: File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
    at net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.build(CommonsMultipartWrapper.java:107)
    at net.sourceforge.stripes.controller.multipart.DefaultMultipartWrapperFactory.wrap(DefaultMultipartWrapperFactory.java:143)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.constructMultipartWrapper(StripesRequestWrapper.java:119)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.<init>(StripesRequestWrapper.java:105)
    at net.sourceforge.stripes.controller.StripesFilter.wrapRequest(StripesFilter.java:281)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
2008-05-22 02:13:40,322 ERROR [MyDefaultExceptionHandler] A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:240)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 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)
    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)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
[...]


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: FileUploadLimitExceededException and Flashscope

samaxes
Ben,

I know this is stupid but it wasn't working because it was being handled by this AutoExceptionHandler:

    public Resolution handle(Exception exception, HttpServletRequest request, HttpServletResponse response) {
        LOGGER.error(exception.getMessage(), exception);

        return new ForwardResolution("/WEB-INF/error.jsp");
    }

I use this method to catch any exception that doesn't need any special treatment.

Commenting this handler and my FULEE AutoExceptionHandler it is indeed handled by your FULEE handler.
The problem is that my pages aren't decorated (I'm using Sitemesh) when forwarded by your FULEE handler.

For now I will stick with my AutoExceptionHandlers since my strategy needs a default handler like the one above, but I think it's important to check this issue with Sitemesh.

Regards,
Samuel


On Wed, May 28, 2008 at 2:41 PM, Ben Gunter <[hidden email]> wrote:
Samuel, I don't think we're on the same page. I added a FULEE handler to DefaultExceptionHandler, which is the superclass of DelegatingExceptionHandler. If you do not override the FULEE handler method in a subclass of DefaultExceptionHandler and you do not provide an AutoExceptionHandler that handles FULEE, then it will be handled by my code. If you do either of those things, then your exception handler will be responsible for FULEE.

-Ben


On Fri, May 23, 2008 at 11:29 PM, Samuel Santos <[hidden email]> wrote:
Hi Ben,

Do you need more info on this? It still doesn't work for me with the latest revision.

--
Samuel


On Thu, May 22, 2008 at 8:49 PM, Samuel Santos <[hidden email]> wrote:
Hi Ben, I haven't any other handler for FULEE.

I use an alternative exception handler (which implements AutoExceptionHandler), so using my own exception handler does the Stripes DefaultExceptionHandler still handle FULEE? Don't I need to handle it in any way?

The flow is as simple as it can be. The form that contains the file upload field is submitted to an action that validates the request and either insert it in the database and redirects to a listing page, or shows back the form with the validation error messages on it.

--
Samuel

On Thu, May 22, 2008 at 2:46 PM, Ben Gunter <[hidden email]> wrote:
I'm a little baffled as to how this error is happening. Please make sure you have no other handlers registered for FULEE that might interfere with it. If it still doesn't work, please send me some code and an explanation of the flow so that I can try to reproduce it. Thanks!

-Ben


Samuel Santos wrote:
Unfortunately it does not work:

2008-05-22 02:13:40,259 ERROR [MyDefaultExceptionHandler] File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
net.sourceforge.stripes.controller.FileUploadLimitExceededException: File post limit exceeded. Limit: 10485760 bytes. Posted: 16014419 bytes.
    at net.sourceforge.stripes.controller.multipart.CommonsMultipartWrapper.build(CommonsMultipartWrapper.java:107)
    at net.sourceforge.stripes.controller.multipart.DefaultMultipartWrapperFactory.wrap(DefaultMultipartWrapperFactory.java:143)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.constructMultipartWrapper(StripesRequestWrapper.java:119)
    at net.sourceforge.stripes.controller.StripesRequestWrapper.<init>(StripesRequestWrapper.java:105)
    at net.sourceforge.stripes.controller.StripesFilter.wrapRequest(StripesFilter.java:281)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
2008-05-22 02:13:40,322 ERROR [MyDefaultExceptionHandler] A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
java.lang.IllegalStateException: A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. The StripesFilter is responsible for wrapping the request, so it is likely that either the StripesFilter is not deployed, or that its mappings do not include the DispatcherServlet _and_ *.jsp. Stripes does not require that the Stripes wrapper is the only request wrapper, or the outermost; only that it is present.
    at net.sourceforge.stripes.controller.StripesRequestWrapper.findStripesWrapper(StripesRequestWrapper.java:80)
    at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:240)
    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.doInclude(ApplicationDispatcher.java:557)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fimport_005f3(error_jsp.java:406)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fotherwise_005f0(error_jsp.java:355)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspx_meth_c_005fchoose_005f0(error_jsp.java:117)
    at org.apache.jsp.WEB_002dINF.error_jsp._jspService(error_jsp.java:84)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    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 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)
    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)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
    at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    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.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
[...]


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users




--
Samuel Santos
http://www.samaxes.com/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users