protected CFJob handleGet(Target target, HttpServletRequest request, HttpServletResponse response, final String path) {
return new CFJob(request, false) {
@Override
protected IStatus performJob() {
try {
Target target = CFActivator.getDefault().getTargetRegistry().getTarget(this.userId);
if (target == null) {
String msg = "Target not set"; //$NON-NLS-1$
return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, msg, null);
}
return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, target.toJSON());
} catch (JSONException e) {
String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
ServerStatus status = new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
logger.error(msg, e);
return status;