aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-24 03:28:02 +0300
committerGravatar Vitaly Takmazov2022-12-24 04:12:58 +0300
commit36ebeb217326c6bc23dedfde1e028ae2286afe02 (patch)
treedcd0156bcabd3b1e92dd7da48a386975a34b676f /src/main/java/com/juick/www
parent354988a7078a54bccf8afc8b49d3a178ae42789f (diff)
Cacheable ActivityPub profiles
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r--src/main/java/com/juick/www/api/activity/Profile.java3
-rw-r--r--src/main/java/com/juick/www/api/activity/model/Context.java3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java
index 506f5ace..404e0734 100644
--- a/src/main/java/com/juick/www/api/activity/Profile.java
+++ b/src/main/java/com/juick/www/api/activity/Profile.java
@@ -55,9 +55,11 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.annotation.CacheEvict;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.core.convert.ConversionService;
import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -268,6 +270,7 @@ public class Profile {
throw new HttpNotFoundException();
}
+ @CacheEvict(cacheNames = "profiles", key = "{ #visitor.uri }")
@PostMapping(value = "/api/inbox", consumes = { Context.LD_JSON_MEDIA_TYPE,
Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE })
public ResponseEntity<CommandResult> processInbox(@Visitor User visitor, InputStream inboxData) throws Exception {
diff --git a/src/main/java/com/juick/www/api/activity/model/Context.java b/src/main/java/com/juick/www/api/activity/model/Context.java
index 63f991cc..1eb057a6 100644
--- a/src/main/java/com/juick/www/api/activity/model/Context.java
+++ b/src/main/java/com/juick/www/api/activity/model/Context.java
@@ -24,6 +24,7 @@ import com.juick.www.api.activity.helpers.LinkValueDeserializer;
import com.juick.www.api.activity.model.activities.*;
import com.juick.www.api.activity.model.objects.*;
+import java.io.Serializable;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
@@ -59,7 +60,7 @@ import java.util.Map;
@JsonSubTypes.Type(value = Group.class, name = "Group"),
@JsonSubTypes.Type(value = Organization.class, name = "Organization")
})
-public class Context {
+public class Context implements Serializable {
private List<Object> context;
private String id;