org.openrdf.http.server.helpers
Class ProtocolUtil

java.lang.Object
  extended by org.openrdf.http.server.helpers.ProtocolUtil

public class ProtocolUtil
extends Object

Utilities to help with the transition between HTTP requests/responses and values expected by the protocol.

Author:
Herko ter Horst, Arjohn Kampman

Constructor Summary
ProtocolUtil()
           
 
Method Summary
static
<FF extends info.aduna.io.file.FileFormat,S>
S
getAcceptableService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, info.aduna.io.file.FileFormatServiceRegistry<FF,S> serviceRegistry)
           
static void logAcceptableFormats(javax.servlet.http.HttpServletRequest request)
           
static void logRequestParameters(javax.servlet.http.HttpServletRequest request)
          Logs all request parameters of the supplied request.
static boolean parseBooleanParam(javax.servlet.http.HttpServletRequest request, String paramName, boolean defaultValue)
           
static Resource[] parseContextParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf)
           
static Map<String,List<String>> parseFormData(BufferedReader reader, String encoding)
           
static Integer parseIntegerParam(javax.servlet.http.HttpServletRequest request, String paramName, Integer defaultValue)
           
static Resource parseResourceParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf)
           
static URI parseURIParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf)
           
static Value parseValueParam(javax.servlet.http.HttpServletRequest request, String paramName, ValueFactory vf)
           
static javax.servlet.http.HttpServletRequest readFormData(javax.servlet.http.HttpServletRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtocolUtil

public ProtocolUtil()
Method Detail

parseValueParam

public static Value parseValueParam(javax.servlet.http.HttpServletRequest request,
                                    String paramName,
                                    ValueFactory vf)
                             throws BadRequest
Throws:
BadRequest

parseResourceParam

public static Resource parseResourceParam(javax.servlet.http.HttpServletRequest request,
                                          String paramName,
                                          ValueFactory vf)
                                   throws BadRequest
Throws:
BadRequest

parseURIParam

public static URI parseURIParam(javax.servlet.http.HttpServletRequest request,
                                String paramName,
                                ValueFactory vf)
                         throws BadRequest
Throws:
BadRequest

parseContextParam

public static Resource[] parseContextParam(javax.servlet.http.HttpServletRequest request,
                                           String paramName,
                                           ValueFactory vf)
                                    throws BadRequest
Throws:
BadRequest

parseBooleanParam

public static boolean parseBooleanParam(javax.servlet.http.HttpServletRequest request,
                                        String paramName,
                                        boolean defaultValue)

parseIntegerParam

public static Integer parseIntegerParam(javax.servlet.http.HttpServletRequest request,
                                        String paramName,
                                        Integer defaultValue)

parseFormData

public static Map<String,List<String>> parseFormData(BufferedReader reader,
                                                     String encoding)
                                              throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

readFormData

public static javax.servlet.http.HttpServletRequest readFormData(javax.servlet.http.HttpServletRequest request)
                                                          throws IOException
Throws:
IOException

logRequestParameters

public static void logRequestParameters(javax.servlet.http.HttpServletRequest request)
Logs all request parameters of the supplied request.


getAcceptableService

public static <FF extends info.aduna.io.file.FileFormat,S> S getAcceptableService(javax.servlet.http.HttpServletRequest request,
                                                                                  javax.servlet.http.HttpServletResponse response,
                                                                                  info.aduna.io.file.FileFormatServiceRegistry<FF,S> serviceRegistry)
                              throws ClientHTTPException
Throws:
ClientHTTPException

logAcceptableFormats

public static void logAcceptableFormats(javax.servlet.http.HttpServletRequest request)


Copyright © 2001-2009 Aduna. All Rights Reserved.