Code example for HttpRequest

Methods: getRequestLine

0
     
    @Override 
    public void handle(HttpRequest request, HttpResponse response, HttpContext context)
            throws HttpException, IOException { 
         
        String method = request.getRequestLine().getMethod();
        if (RestUtils.GET.equals(method)) {
            // Get uri target. 
            String uriTarget = RestUtils.getUriTarget(request, RestPrefix.LIBRARY.pattern());
             
            // Get query parameters. 
            Map<String, String> queryParams = RestUtils.getQueryParams(request);
             
            // Set response. 
            process(uriTarget, queryParams, response);
             
        } else { 
            response.setStatusCode(HttpStatus.SC_NOT_IMPLEMENTED);
        } 
    }