class ResourceDetailsJaxrsService {

    public Response defaultPostHandler(InputStream stream, String uri, String sourceUri, String disposition,
            String description, String rawMimeType, String accept, Boolean createFolders, Boolean overwrite,
            String renameTo, boolean dryRun, Map<String, String[]> additionalProperties) throws ErrorDescriptorException, IOException {
        Response response;
        if (sourceUri != null) {
            String newUri = singleRepositoryService.copyResource(sourceUri, uri, createFolders, overwrite, renameTo);
            // if user copies file, we have to return descriptor, not its content
            // See ResourceDetailsJaxrsService#getResourceDetails
            if (MediaType.APPLICATION_JSON.equals(accept)) {
                accept = ResourceMediaType.FILE_JSON;
            } else {
                accept = ResourceMediaType.FILE_XML;
            }
            response = getResourceDetails(newUri, accept, false, null, null, additionalProperties);
        } else {
            if (disposition == null || !disposition.contains("filename=") || disposition.endsWith("filename=")) {
                throw new IllegalParameterValueException("Content-Disposition", disposition);
            }

            String name = disposition.split("filename=")[1];
            String type = extractType(rawMimeType, name);

            Resource createdFile = singleRepositoryService.createFileResource(stream, uri, name, name, description, type, createFolders, dryRun);
            final String clientType = ClientTypeHelper.extractClientType(accept);
            ToClientConverter<? super Resource, ? extends ClientResource, ToClientConversionOptions>
                    toClientConverter = clientType != null ? resourceConverterProvider
                    .getToClientConverter(createdFile.getResourceType(), clientType) : null;
            if(toClientConverter == null){
                toClientConverter = resourceConverterProvider.getToClientConverter(createdFile);
            }

            ClientResource clientCreatedFile = toClientConverter.toClient(createdFile, null);
            response = Response.status(Response.Status.CREATED).entity(clientCreatedFile).build();
        }

        return response;
    }

}