-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MH-13074, Clean up asset manager REST endpoints #410
MH-13074, Clean up asset manager REST endpoints #410
Conversation
The asset manager REST endpoints contains a few pieces of weird or duplicated code: - Remove Entwine's functional library for exception handling - Do not duplicate identical methods - Remove broken “If-None-Match” header parameter
return noContent(); | ||
} | ||
}); | ||
return snapshot(mediaPackage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is identical to snapshot
anyway
@HeaderParam("If-None-Match") final String ifNoneMatch) { | ||
return handleException(new P1Lazy<Response>() { | ||
@Override public Response get1() { | ||
if (StringUtils.isNotBlank(ifNoneMatch)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is undocumented and makes no sense at all
} | ||
|
||
throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR); | ||
public static Response handleException(Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This non-functional programming approach is actually shorter, arguably easier to read and does not require Entwine's functional library
} else | ||
return notFound(); | ||
if (StringUtils.isEmpty(mediaPackageId)) { | ||
return notFound(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, shouldn't this be badRequest()? Nevermind, it's the same (incorrect) behaviour.
The asset manager REST endpoints contains a few pieces of weird or
duplicated code: