@POST
    @Path("/{repoName}/{fileName}")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces(MediaType.APPLICATION_JSON)
    public String submitFile(
            @PathParam("repoName") String repoName, 
            @PathParam("fileName") String fileName,
            @FormDataParam("commitMessage") String commitMessage,
            @FormDataParam("file") InputStream file,
            @FormDataParam("file") FormDataContentDisposition contentDisposition,
            @Context HttpServletRequest request) {
        
        ResponseVm response = null;
        Gson gson = new Gson();
        
//        response = new ResponseVm();
//        response.setSuccessMessage("Successfully submitted file update for " + fileName + ".");
//        response.setResponseUrl("http://github.com");
//        return gson.toJson(response);
        
        if (StringUtils.isEmpty(repoName)) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }
        if (StringUtils.isEmpty(fileName)) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }
        if (StringUtils.isEmpty(commitMessage)) {
            response = new ResponseVm();
            response.setErrorMessage("You must enter a change description.");
        }
        if (file == null) {
            response = new ResponseVm();
            response.setErrorMessage("You must select a file.");
        }
        
        if (response != null) {
            return gson.toJson(response);
        }
        
        try {
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream(1024 * 80);
            IOUtils.copy(file, outputStream);
            response = dao.submitFile(repoName, fileName, contentDisposition.getFileName(), outputStream.toByteArray(), commitMessage);
        }
        catch (NotFoundException e) {
            logger.log(Level.WARNING, e.getMessage(), e);
            response = new ResponseVm();
            response.setErrorMessage("Could not find repository " + repoName + ".");
        }
        catch (IOException e) {
            logger.log(Level.SEVERE, "Failed to submit file: {0}", e.getMessage());
            response = new ResponseVm();
            response.setErrorMessage("There was an error submitting your file. Please try again later.");
        }
        
        return gson.toJson(response);
    }