Uploaded image for project: 'AeroGear Push'
  1. AeroGear Push
  2. AGPUSH-255

Add server side validation and appropriate response body for bad requests

    Details

      Description

      Add server side validation to avoid persistence exceptions.

      eg: Trying to register an installation with long name results to javax.persistence.PersistenceException: org.hibernate.exception.DataException: Value too long for column "DEVICETOKEN VARCHAR(255) SELECTIVITY 100"

      This happens for almost all the basic operations like Push App registration, Variant registration and installation registrations.

      In addition the WS responses do not contain information about the bad request causes. So in order to order to understand what went wrong, someone has to check the server side logs.

      e.g:
      if (androidVariant.getGoogleKey() == null)

      { return Response.status(Status.BAD_REQUEST).build(); }

      It would be a better approach to remove snippets like the above one, to add Bean Validation checks and fill the response entity with a Map of ConstraintViolation property paths (bean root class) and messages.

      If you believe that this issue is better described as a feature request, feel free to modify it.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mwessendorf Matthias Wessendorf
                Reporter:
                aemmanou Tolis Emmanouilidis
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: