Upon investigating the interceptor flow, it should be working based on my
understanding:



RequestInterceptor:

*import* org.apache.struts2.ServletActionContext;

*import* org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper;



*import* com.opensymphony.xwork2.ActionInvocation;

*import* com.opensymphony.xwork2.interceptor.Interceptor;



*public* *class* *RequestInterceptor* *implements* Interceptor{



        HttpServletRequest request = (HttpServletRequest) invocation
.getInvocationContext().get(ServletActionContext.*HTTP_REQUEST*);

       *if*(request *instanceof* MultiPartRequestWrapper){

MultiPartRequestWrapper fileRequestWrapper=(MultiPartRequestWrapper)request;

               *if*(fileRequestWrapper!=*null* &&fileRequestWrapper
.getErrors()!=*null*){

                       *return* "fileSizeError";

               }

            }



return SUCCESS is not included here.




Struts.xml:


In struts.xml the fileSizeError that was used was only the jsp page.



       <action name=*"reviewUpload"* class=*"com.AddAccess"* method=
*"reviewUpload"*>

              <result name=*"success"*>popupreview.jsp</result>

             <result name=*"fileSizeError"*>fileSizeError.jsp</result>

       </action>



Interceptors:


<interceptors>

                    <interceptor name=*"sessionCheck"* class=
*"com.RequestInterceptor"* />

                    <interceptor-stack name=*"sStack"*>

                           <interceptor-ref name=*"sessionCheck"* />

                           <interceptor-ref name=*"defaultStack"* />

                    </interceptor-stack>

             </interceptors>




The success result for reviewUpload can be found in AddAccess.java, also an
interceptor import file is also being used.


*import* org.apache.struts2.interceptor.ServletRequestAware;

*import* org.apache.struts2.interceptor.ServletResponseAware;





  *public* String reviewUpload()

    *throws* Exception

  {

    StringBuilder *line* = *new* StringBuilder();

    PrintWriter *out* = *this*.httpResponse.getWriter();



    uploadFile();



    setFileProcessingStatus("SUCCESS");

    *return* "success";

  }



Is it possible that I am missing an additional import here?






On Thu, Oct 12, 2017 at 4:59 PM, Ej Magdaluyo <ejmagdal...@gmail.com> wrote:

> Hi Yasser, Lukasz,
>
> Thank you for the information. I will look into the code and will let you
> know.
>
> Here is the list of the JAR files:
> antlr-2.7.2.jar
> asm-3.3.jar
> asm-commons-3.3.jar
> asm-tree-3.3.jar
> commons-beanutils-1.8.0.jar
> commons-collections-3.2.2.jar
> commons-digester-2.0.jar
> commons-fileupload-1.3.2.jar
> commons-io-2.2.jar
> commons-lang-2.4.jar
> commons-lang3-3.2.jar
> commons-logging-1.1.3.jar
> displaytag-1.2.jar
> displaytag-export-poi-1.2.jar
> freemarker-2.3.22.jar
> itext-1.3.jar
> javaee.jar
> javassist-3.11.0.GA.jar
> jcs-1.3.jar
> json-lib-2.1-jdk15.jar
> jstl.jar
> jxl.jar
> log4j-1.2.16.jar
> obpm_ws_proxy.jar
> ognl-3.0.21.jar
> slf4j-api-1.7.12.jar
> slf4j-simple-1.7.12.jar
> struts2-core-2.3.34.jar
> struts2-dojo-plugin-2.3.34.jar
> struts2-json-plugin-2.3.34.jar
> struts2-tiles-plugin-2.3.34.jar
> tiles-api-2.2.2.jar
> tiles-compat-3.0.1.jar
> tiles-core-2.2.2.jar
> tiles-el-2.2.2.jar
> tiles-extras-3.0.1.jar
> tiles-freemarker-2.2.2.jar
> tiles-jsp-2.2.2.jar
> tiles-ognl-2.2.2.jar
> tiles-request-servlet-1.0.1.jar
> tiles-servlet-2.2.2.jar
> tiles-template-2.2.2.jar
> xercesImpl.jar
> xwork-core-2.3.34.jar
>
>
> On Thu, Oct 12, 2017 at 4:36 PM, Lukasz Lenart <lukaszlen...@apache.org>
> wrote:
>
>> 2017-10-12 10:14 GMT+02:00 Ej Magdaluyo <ejmagdal...@gmail.com>:
>> > I would just like to confirm if it is expected that we would need to add
>> a fileSizeError result. This is because the code was working in Struts
>> 2.2.3, and the error only appeared post-migration. I reviewed the
>> migration
>> notes, and I am not certain which version changed this.
>>
>> I don't know if this is needed but this what the error message says. And
>> you are migrating from a very old version of Struts (please be aware that
>> 2.x.x means Struts 2, where 2.2.x and 2.3.x is like Struts 2 ver 2
>> compared
>> to Struts 2 ver 3)
>>
>> > We have a fileSizeError jsp being called in another part of struts.xml:
>> >
>> > <action name="reviewUpload" class="com.AddAccess" method="reviewUpload">
>> > <result name="success">popupreview.jsp</result>
>> > <result name="fileSizeError">fileSizeError.jsp</result>
>> > </action>
>>
>> So I would review your flow of the interceptors because it looks like like
>> of them returns this result.
>>
>> > Jar files used:
>>
>> You cannot inline images, please list your JARs
>>
>>
>> Regards
>> --
>> Ɓukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>
>

Reply via email to