Package org.eclipse.rdf4j.http.server
Class ProtocolUtil
java.lang.Object
org.eclipse.rdf4j.http.server.ProtocolUtil
Utilities to help with the transition between HTTP requests/responses and values expected by the protocol.
- Author:
- Herko ter Horst, Arjohn Kampman
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <FF extends FileFormat,S>
SgetAcceptableService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, FileFormatServiceRegistry<FF, S> serviceRegistry) static voidlogAcceptableFormats(javax.servlet.http.HttpServletRequest request) static voidlogRequestParameters(javax.servlet.http.HttpServletRequest request) Logs all request parameters of the supplied request.static booleanparseBooleanParam(javax.servlet.http.HttpServletRequest request, String paramName, boolean defaultValue) static Resource[]parseContextParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf) static IRIparseGraphParam(javax.servlet.http.HttpServletRequest request, ValueFactory vf) static longparseLongParam(javax.servlet.http.HttpServletRequest request, String paramName, long defaultValue) static ResourceparseResourceParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf) static intparseTimeoutParam(javax.servlet.http.HttpServletRequest request) Reads theProtocol.TIMEOUT_PARAM_NAMEparameter from the request and (if present) parses it into an integer value.static IRIparseURIParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf) static ValueparseValueParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf)
-
Constructor Details
-
ProtocolUtil
public ProtocolUtil()
-
-
Method Details
-
parseValueParam
public static Value parseValueParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf) throws ClientHTTPException - Throws:
ClientHTTPException
-
parseResourceParam
public static Resource parseResourceParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf) throws ClientHTTPException - Throws:
ClientHTTPException
-
parseURIParam
public static IRI parseURIParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf) throws ClientHTTPException - Throws:
ClientHTTPException
-
parseGraphParam
public static IRI parseGraphParam(javax.servlet.http.HttpServletRequest request, ValueFactory vf) throws ClientHTTPException - Throws:
ClientHTTPException
-
parseContextParam
public static Resource[] parseContextParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf) throws ClientHTTPException - Throws:
ClientHTTPException
-
parseBooleanParam
public static boolean parseBooleanParam(javax.servlet.http.HttpServletRequest request, String paramName, boolean defaultValue) -
parseLongParam
public static long parseLongParam(javax.servlet.http.HttpServletRequest request, String paramName, long defaultValue) throws ClientHTTPException - Throws:
ClientHTTPException
-
logRequestParameters
public static void logRequestParameters(javax.servlet.http.HttpServletRequest request) Logs all request parameters of the supplied request. -
getAcceptableService
public static <FF extends FileFormat,S> S getAcceptableService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, FileFormatServiceRegistry<FF, S> serviceRegistry) throws ClientHTTPException- Throws:
ClientHTTPException
-
parseTimeoutParam
public static int parseTimeoutParam(javax.servlet.http.HttpServletRequest request) throws ClientHTTPException Reads theProtocol.TIMEOUT_PARAM_NAMEparameter from the request and (if present) parses it into an integer value.- Parameters:
request- theHttpServletRequestto read the parameter from- Returns:
- the value of the timeout parameter as an integer (representing the timeout time in seconds), or 0 if no timeout parameter is specified in the request.
- Throws:
ClientHTTPException- if the value of the timeout parameter is not a valid integer.
-
logAcceptableFormats
public static void logAcceptableFormats(javax.servlet.http.HttpServletRequest request)
-