Introduced HttpCookieStore.Empty to disable cookies in HttpClient and in the websocket client.

This commit is contained in:
Simone Bordet 2012-12-13 18:04:27 +01:00
parent a386a46045
commit 127f4978a9
1 changed files with 18 additions and 41 deletions

View File

@ -25,7 +25,6 @@ import java.util.Map;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.AsyncContext; import javax.servlet.AsyncContext;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -87,7 +86,7 @@ public class AsyncRestServlet extends AbstractRestServlet
if (results==null) if (results==null)
{ {
// define results data structures // define results data structures
final Queue<Map<String, String>> resultsQueue = new ConcurrentLinkedQueue<Map<String,String>>(); final Queue<Map<String, String>> resultsQueue = new ConcurrentLinkedQueue<>();
request.setAttribute(RESULTS_ATTR, results=resultsQueue); request.setAttribute(RESULTS_ATTR, results=resultsQueue);
// suspend the request // suspend the request
@ -122,7 +121,7 @@ public class AsyncRestServlet extends AbstractRestServlet
// save timing info and return // save timing info and return
request.setAttribute(START_ATTR, start); request.setAttribute(START_ATTR, start);
request.setAttribute(DURATION_ATTR, new Long(System.nanoTime() - start)); request.setAttribute(DURATION_ATTR, System.nanoTime() - start);
return; return;
} }
@ -163,7 +162,7 @@ public class AsyncRestServlet extends AbstractRestServlet
out.close(); out.close();
} }
private abstract class AsyncRestRequest implements Response.Listener private abstract class AsyncRestRequest extends Response.Listener.Empty
{ {
final Utf8StringBuilder _content = new Utf8StringBuilder(); final Utf8StringBuilder _content = new Utf8StringBuilder();
@ -171,16 +170,6 @@ public class AsyncRestServlet extends AbstractRestServlet
{ {
} }
@Override
public void onBegin(Response response)
{
}
@Override
public void onHeaders(Response response)
{
}
@Override @Override
public void onContent(Response response, ByteBuffer content) public void onContent(Response response, ByteBuffer content)
{ {
@ -188,16 +177,6 @@ public class AsyncRestServlet extends AbstractRestServlet
_content.append(bytes,0,bytes.length); _content.append(bytes,0,bytes.length);
} }
@Override
public void onSuccess(Response response)
{
}
@Override
public void onFailure(Response response, Throwable failure)
{
}
@Override @Override
public void onComplete(Result result) public void onComplete(Result result)
{ {
@ -216,13 +195,11 @@ public class AsyncRestServlet extends AbstractRestServlet
abstract void onAuctionFound(Map<String,String> details); abstract void onAuctionFound(Map<String,String> details);
abstract void onComplete(); abstract void onComplete();
}; }
@Override @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{ {
doGet(request, response); doGet(request, response);
} }
} }