Source:
public Response publish(@Auth Key key, @QueryParam("username") String username, @FormDataParam("file") InputStream inputStream, @FormDataParam("file") FormDataContentDisposition contentDispositionHeader, @QueryParam("type") String type, @FormDataParam("message") @DefaultValue("") String message, @FormDataParam("title") @DefaultValue("") String videoTitle) { if (username == null) { return Response.status(Response.Status.BAD_REQUEST) .entity("'username' query parameter is required for publish").build(); } if (type == null) { return Response.status(Response.Status.BAD_REQUEST) .entity("'type' query parameter is required for publish").build(); } if (!type.equals("photo") && !type.equals("video")) { return Response.status(Response.Status.BAD_REQUEST) .entity("'type' query parameter must be 'photo' or 'video'").build(); } if (inputStream == null) { LOG.error("Bad InputStream"); return Response.status(Response.Status.BAD_REQUEST) .entity("Error trying to read InputStream").build(); } PilotUser pilotUser = thunderClient.getUser(username); FacebookService facebookService = facebookServiceFactory.newFacebookService(pilotUser.getFacebookAccessToken()); byte[] uploadBytes = urlService.inputStreamToByteArray(inputStream); if (uploadBytes == null) { LOG.error("Error reading bytes"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Error trying to read bytes").build(); } String uploaded = facebookService.publishToFacebook(uploadBytes, type, contentDispositionHeader.getFileName(), message, videoTitle); if (uploaded == null) { LOG.error("Error uploading to facebook"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Error uploading to facebook").build(); } return Response.ok(uploaded).build(); }

Target:
public Response publish(@Auth Key key, @QueryParam("username") String username, @FormDataParam("file") InputStream inputStream, @FormDataParam("file") FormDataContentDisposition contentDispositionHeader, @QueryParam("type") String type, @FormDataParam("message") @DefaultValue("") String message, @FormDataParam("title") @DefaultValue("") String videoTitle) { if (username == null) { return Response.status(Response.Status.BAD_REQUEST) .entity("'username' query parameter is required for publish").build(); } if (type == null) { return Response.status(Response.Status.BAD_REQUEST) .entity("'type' query parameter is required for publish").build(); } if (!type.equals("photo") && !type.equals("video")) { return Response.status(Response.Status.BAD_REQUEST) .entity("'type' query parameter must be 'photo' or 'video'").build(); } if (inputStream == null) { LOG.error("Bad InputStream"); return Response.status(Response.Status.BAD_REQUEST) .entity("Error trying to read InputStream").build(); } PilotUser pilotUser = thunderClient.getUser(username); FacebookService facebookService = facebookServiceFactory.newFacebookService(pilotUser.getFacebookAccessToken()); byte[] uploadBytes = urlService.inputStreamToByteArray(inputStream); if (uploadBytes == null) { LOG.error("Error reading bytes"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Error trying to read bytes").build(); } String uploadedFile = facebookService.publishToFacebook(uploadBytes, type, contentDispositionHeader.getFileName(), message, videoTitle); if (uploadedFile == null) { LOG.error("Error uploading to facebook"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Error uploading to facebook").build(); } return Response.ok(uploadedFile).build(); }