Code example for HttpContext

Methods: getAttribute, setAttribute

0
    protected abstract HttpRequest generateRequest(Job testjob);
 
    public HttpRequest submitRequest(final HttpContext context) {
 
        @SuppressWarnings("unchecked") 
        Queue<Job> queue = (Queue<Job>) context.getAttribute("queue");
        if (queue == null) {
            throw new IllegalStateException("Queue is null");
        } 
 
        Job testjob = queue.poll();
        context.setAttribute("job", testjob);
 
        if (testjob != null) {
            return generateRequest(testjob);
        } else { 
            return null; 
        } 
    } 
 
    public ConsumingNHttpEntity responseEntity(