Class RequestUtils
java.lang.Object
org.heigit.ohsome.ohsomeapi.utils.RequestUtils
Utils class containing request-specific static utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
cacheNotAllowed
(String url, String[] timeParameter) Checks, if caching will be allowed for the given query, or not.static void
Extracts some metadata from the OSHDB keytables or db and adds it to the corresponding objects.static String
extractRequestUrl
(javax.servlet.http.HttpServletRequest request) Extracts the request URL from the givenHttpServletRequest
object.static boolean
Checks if the given request is requesting a contributions extraction that can potentially return a bigger amount of GeoJSON data.static boolean
isDataExtraction
(String url) Checks if the given request is requesting a data extraction that can potentially return a bigger amount of GeoJSON data.static boolean
usesCsvFormat
(javax.servlet.http.HttpServletRequest request) Checks if the given request uses the csv format.
-
Method Details
-
extractRequestUrl
Extracts the request URL from the givenHttpServletRequest
object.- Parameters:
request
- sentHttpServletRequest
object- Returns:
String
that contains the received request URL
-
cacheNotAllowed
Checks, if caching will be allowed for the given query, or not.- Parameters:
url
- the URL of the request to checktimeParameter
- the "time" parameter of the request to check- Returns:
- whether caching is allowed, or not
-
isDataExtraction
Checks if the given request is requesting a data extraction that can potentially return a bigger amount of GeoJSON data. This can either be through using the /elements/geometry|bbox|centroid, or the /elementsFullHistory endpoint.- Parameters:
url
- the url of the request to check- Returns:
- whether it is a data-extraction request, or not
-
isContributionsExtraction
Checks if the given request is requesting a contributions extraction that can potentially return a bigger amount of GeoJSON data. This can be through using the /contributions/(latest)/geometry|bbox|centroid endpoint.- Parameters:
url
- the url of the request to check- Returns:
- whether it is a contributions-extraction request, or not
-
usesCsvFormat
public static boolean usesCsvFormat(javax.servlet.http.HttpServletRequest request) Checks if the given request uses the csv format.- Parameters:
request
-HttpServletRequest
object used to check- Returns:
- whether it uses the csv format, or not
-
extractOSHDBMetadata
Extracts some metadata from the OSHDB keytables or db and adds it to the corresponding objects.- Throws:
DatabaseAccessException
- if the keytables are missingRuntimeException
- if the timerange metadata cannot be retrieved from the dbIOException
- thrown by#readTree(String) readTree
-