Code example for HttpContext

Methods: setAttribute

0
 
abstract class RequestExecutionHandler 
    implements NHttpRequestExecutionHandler, HttpRequestExecutionHandler { 
 
    public void initalizeContext(final HttpContext context, final Object attachment) {
        context.setAttribute("queue", attachment);
    } 
 
    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);
Contextual code suggestions in your IDE  Get Codota for Java