-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
this is my service implementation:
public String createAttachment(String docId) throws FileNotFoundException{
try {
CouchDbInstance dbInstance = getconnection();
// creating database
CouchDbConnector connector = new StdCouchDbConnector("demouser", dbInstance);
CouchDbImpl impl = new CouchDbImpl(connector);
connector.createDatabaseIfNotExists();
String database = connector.getDatabaseName();
System.out.println(database);
InputStream inputstream = new FileInputStream("C:\\Users\\SwedhaS\\Desktop\\couchdb reference.txt");
String contentType = "application/text";
AttachmentInputStream a = new AttachmentInputStream("123456",
inputstream,
contentType);
connector.createAttachment(docId, a);
} catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}
this is my controller:
@PostMapping("/save/{id}")
public String createDocumentAndfiles(@RequestBody User user,@PathVariable String id) throws FileNotFoundException {
String users=userRepo.createAttachment(id);
return users;
}
jocafi
Metadata
Metadata
Assignees
Labels
No labels