diff options
Diffstat (limited to 'src/org/traccar/api/BaseResource.java')
-rw-r--r-- | src/org/traccar/api/BaseResource.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/api/BaseResource.java b/src/org/traccar/api/BaseResource.java index 97f5c074d..8259f8868 100644 --- a/src/org/traccar/api/BaseResource.java +++ b/src/org/traccar/api/BaseResource.java @@ -15,6 +15,7 @@ */ package org.traccar.api; +import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.SecurityContext; public class BaseResource { @@ -22,6 +23,9 @@ public class BaseResource { @javax.ws.rs.core.Context private SecurityContext securityContext; + @javax.ws.rs.core.Context + private HttpHeaders headers; + protected long getUserId() { UserPrincipal principal = (UserPrincipal) securityContext.getUserPrincipal(); if (principal != null) { @@ -30,4 +34,8 @@ public class BaseResource { return 0; } + protected String getAcceptHeader() { + return headers.getRequestHeaders().getFirst("Accept"); + } + } |