Skip to content

Validation doesn't work on OpenLiberty #293

Description

@mthmulders

Trying to build an application with Krazo on Jakarta EE 9, targeted to run on OpenLiberty. I'm using OpenLiberty 22.0.0.4, Krazo 2.0.1 (with the LibertyHttpCommunicationUnwrapper manually copied in).

The Controller that should process the form is a literal copy of the example in the MVC 2.0 spec.

I submit the form from the browser, but for convenience, this is the raw request:

curl 'http://localhost:9080/openliberty-mvc-validation/form/process' -X POST \
   -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \
   -H 'Accept-Language: en-GB,en;q=0.5' \
   -H 'Accept-Encoding: gzip, deflate, br' \
   -H 'Content-Type: application/x-www-form-urlencoded' \
   --data-raw 'age='

When I submit the form, I expect the Controller to be invoked, causing a) a log message to appear and b) hello.jsp to be rendered.

Instead, I get an XML response (formatted for reading convenience, the original response is unformatted):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<violationReport>
  <propertyViolations>
    <constraintType>PROPERTY</constraintType>
    <path>age</path>
    <message>must be greater than or equal to 18</message>
    <value>0</value>
  </propertyViolations>
</violationReport>

The good part is that the validation rules are applied to the input. The bad part is that the Controller is not invoked, and the user is seeing XML in their browser.

Please let me know if there's something I missed in the spec, something else I could try, or some additional information you might need.

Links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions