@Override public boolean equals(Object other) { if ( this == other ) return true ; if ( other == null ) return false ; if ( ! ( other instanceof Lang ) ) return false ; Lang otherLang = (Lang)other ; // Just label should be enough. return this.label == otherLang.label && this.contentType.equals(otherLang.contentType) && this.altContentTypes.equals(otherLang.altContentTypes) && this.fileExtensions.equals(otherLang.fileExtensions) ; // File extensions and alt }
@Override public boolean equals(Object other) { if ( this == other ) return true ; if ( other == null ) return false ; if ( ! ( other instanceof Lang ) ) return false ; Lang otherLang = (Lang)other ; // Just label should be enough. return this.label == otherLang.label && this.contentType.equals(otherLang.contentType) && this.altContentTypes.equals(otherLang.altContentTypes) && this.fileExtensions.equals(otherLang.fileExtensions) ; // File extensions and alt }
protected void validate(HttpAction action) { String method = action.getRequest().getMethod(); switch(method) { case HttpNames.METHOD_POST: break; default: ServletOps.errorMethodNotAllowed(method+" : Patch must use POST"); } String ctStr = action.request.getContentType(); // Must be UTF-8 or unset. But this is wrong so often, // it is less trouble to just force UTF-8. String charset = action.request.getCharacterEncoding(); if ( charset != null && ! WebContent.charsetUTF8.equals(charset) ) ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Charset must be omitted or must be UTF-8, not "+charset); // If no header Content-type - assume patch-text. ContentType contentType = ( ctStr != null ) ? ContentType.create(ctStr) : ctPatchText; if ( ! ctPatchText.equals(contentType) && ! ctPatchBinary.equals(contentType) ) ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Allowed Content-types are "+ctPatchText+" or "+ctPatchBinary+", not "+ctStr); if ( ctPatchBinary.equals(contentType) ) ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, contentTypePatchBinary+" not supported yet"); }
@Override protected void validate(HttpAction action) { String method = action.getRequest().getMethod(); switch(method) { case HttpNames.METHOD_POST: case HttpNames.METHOD_PATCH: break; default: ServletOps.errorMethodNotAllowed(method+" : Patch must use POST or PATCH"); } String ctStr = action.request.getContentType(); // Must be UTF-8 or unset. But this is wrong so often, // it is less trouble to just force UTF-8. String charset = action.request.getCharacterEncoding(); if ( charset != null && ! WebContent.charsetUTF8.equals(charset) ) ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Charset must be omitted or UTF-8, not "+charset); // If no header Content-type - assume patch-text. ContentType contentType = ( ctStr != null ) ? ContentType.create(ctStr) : ctPatchText; if ( ! ctPatchText.equals(contentType) && ! ctPatchBinary.equals(contentType) ) ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, "Allowed Content-types are "+ctPatchText+" or "+ctPatchBinary+", not "+ctStr); if ( ctPatchBinary.equals(contentType) ) ServletOps.error(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, contentTypePatchBinary+" not supported yet"); }