diff options
Diffstat (limited to 'src/main/java/com/juick/server/api/Messages.java')
-rw-r--r-- | src/main/java/com/juick/server/api/Messages.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/juick/server/api/Messages.java b/src/main/java/com/juick/server/api/Messages.java index 5c791df4..5a4d8c31 100644 --- a/src/main/java/com/juick/server/api/Messages.java +++ b/src/main/java/com/juick/server/api/Messages.java @@ -31,7 +31,9 @@ import com.juick.service.MessagesService; import com.juick.service.TagService; import com.juick.service.UserService; import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEventPublisher; +import org.springframework.core.io.Resource; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -67,6 +69,8 @@ public class Messages { private ApplicationEventPublisher applicationEventPublisher; @Inject private WebApp webApp; + @Value("classpath:Transparent.gif") + private Resource invisiblePixel; // TODO: serialize image urls @@ -204,8 +208,7 @@ public class Messages { userService.updateLastSeen(visitor); applicationEventPublisher.publishEvent( new MessageReadEvent(this, visitor, msg)); - return IOUtils.toByteArray( - Objects.requireNonNull(getClass().getClassLoader().getResource("Transparent.gif"))); + return IOUtils.toByteArray(invisiblePixel.getInputStream()); } throw new HttpBadRequestException(); } |