0

I have o upload a file from UI with primefaces file uploader and it seems that it is not able to reach the ModelBean server side when i try to get a parameter from the request object. Otherwise, everything works FINE!! (i have to be specific so someone does not set this question as duplicate).

my web.xml configurartion for ythe file upload is this.

<filter>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
    <init-param>
        <param-name>uploadThresholdSize</param-name>
        <param-value>2097152</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

before reaching the MB, I let all the call to pass to this filter:

<filter>
    <filter-name>PrimeFaces authorization check</filter-name>
    <filter-class>utils.WebAuthFilter</filter-class>
</filter>

in WebAuthFilter servlet I have this code

boolean avoidValidation = Boolean.parseBoolean(request.getParameter("avoidLoginValidation"));

there is no problem with the parsing because the method return always false or true even if the parameter is equal to null.

the real problem is the

  request.getParameter("avoidLoginValidation")

that seems to prevent any server-side action when i push the upload button. otherwise, averything is fine if I put "true" or "false" directly everithing works fine, without any error or problem.

can anyone explain why this is happening and how to avoid this type of behaviour.

thank you very much.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
BohBah
  • 109
  • 1
  • 3
  • 11
  • Sorry @balusC but that is not the answer. it si completely different infact, if you read, i say that the upload file works fine if i do not use a "request.getParameter" in a previous called servlet so the problem may seem the same but the source of the problem is really different – BohBah Jul 09 '19 at 07:14
  • @BalusC Meybe you have to read the content before mark an answer. – BohBah Jul 09 '19 at 07:17
  • 1: it is **always** good to be specific. 2: it is **always** good (required even, https://stackoverflow.com/tags/jsf/info) to post a [mcve], 3: it is **always** good ('required' even, https://stackoverflow.com/tags/jsf/info) to post impl and version info (including PrimeFaces) 4: both 2 and 3 are very prominently mentioned in the duplicate, so since all is absent in your question. it is hard (impossible) to help. – Kukeltje Jul 09 '19 at 07:35
  • 5: it it is **always** good (required even, https://stackoverflow.com/tags/jsf/info) to post errors you get or investigate, since 'does not do anything' is weird... Is your filter called? Does it forward the request? Did you set a breakpoint in the PF uploadfilter? Debug... – Kukeltje Jul 09 '19 at 07:38
  • Your answer is in the "Troubleshooting" section of the duplicate. – BalusC Jul 09 '19 at 10:30
  • Oops. I missed that too.. it indeed is a 100% duplicate. @BohBah: Apologies seem in place... – Kukeltje Jul 09 '19 at 11:09

0 Answers0