Step 5: Add receipt.png
You can use the Java Client Libraries to save non-RDF resources (e.g., .png , .pdf ) to your Pod.
For this part of the tutorial, the getting started app uses Inrupt’s Java client library to:
Store a copy of the expense receipts to your Pod.
Update the associated expense to link to the URLs of the receipts.
Update application.properties
application.propertiesAdd the following properties to the src/main/resources/application.properties file:
spring.servlet.multipart.max-file-size=128KB
spring.servlet.multipart.max-request-size=128KBModify Expense Class
Expense ClassOpen
Expenseclass file:
Open src/main/java/com/example/gettingstarted/Expense.java
Open src/main/kotlin/com/example/gettingstarted/Expense.kt
Add the
java.util.*import statement:
import java.util.*;import java.util.*Add the predicate definition for the receipts in the
Expenseclass:
static IRI SCHEMA_ORG_IMAGE = rdf.createIRI("https://schema.org/image");var SCHEMA_ORG_IMAGE: IRI = rdf.createIRI("https://schema.org/image")Update the
Expenseclass constructor to include the receipts:
Add the getter and setters for the receipts in the
Expenseclass:
Add getter for the receipts in the inner
Nodeclass:
Modify ExpenseController Class
ExpenseController ClassOpen
ExpenseControllerclass file.
Open src/main/java/com/example/gettingstarted/ExpenseController.java
Open src/main/kotlin/com/example/gettingstarted/ExpenseController.kt
Add the following import statements:
Add the following method to handle the upload of non-RDF files:
Add the following method that uploads a receipt file and links it to the associated
Expense.
Last updated