3

I have a simple upload-servlet and need to report if a file is illegal and has not been added.

For some reason i am not allowed to give a html-body back, so i need to use the response-header.

Unfortunately the X--response-headers should not be used anymore. So what response-header match my requirements? I daresay Warning may match best, but when the file is not added, its more likly a error than a warning.

  • BTW: I also am not allowed to give a different HTTP-Status-Code back. – Peter Rader Nov 21 '14 at 15:43
  • How about just returning a custom 4xx error? Or even a 400 Bad Request one, if you want to keep things as simple as possible? – yannis Nov 21 '14 at 15:52
  • @YannisRizos 1. A upload can contain multiple files. 2. A apache is before the tomcat who proxy only 200-responses, otherwise a i8nzed error-file from apache is returned. – Peter Rader Nov 21 '14 at 15:59
  • Hm, if uploading multiple files won't block just because there's one illegal file, then isn't your response more of a warning (thus Warning is semantically accurate) than an error? – yannis Nov 21 '14 at 16:03
  • A illegal file is anyway a error! You can not open a .exe as a image. You can not open a .jpg as an audio-file. You can not rotate a .txt by 12 degrees.... Always you will get an Error. – Peter Rader Nov 21 '14 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.