1 4 package com.tc.server; 5 6 import com.tc.async.api.AbstractEventHandler; 7 import com.tc.async.api.EventContext; 8 import com.tc.bytes.TCByteBuffer; 9 import com.tc.logging.TCLogger; 10 import com.tc.logging.TCLogging; 11 import com.tc.net.protocol.HttpConnectionContext; 12 13 import java.net.Socket ; 14 15 public class HttpConnectionHandler extends AbstractEventHandler { 16 17 private static final TCLogger logger = TCLogging.getLogger(HttpConnectionContext.class); 18 19 private final TerracottaConnector terracottaConnector; 20 21 public HttpConnectionHandler(TerracottaConnector terracottaConnector) { 22 this.terracottaConnector = terracottaConnector; 23 } 25 26 public void handleEvent(EventContext context) { 27 HttpConnectionContext connContext = (HttpConnectionContext) context; 28 29 Socket s = connContext.getSocket(); 30 TCByteBuffer buffer = connContext.getBuffer(); 31 byte[] data = new byte[buffer.limit()]; 32 buffer.get(data); 33 try { 34 terracottaConnector.handleSocketFromDSO(s, data); 35 } catch (Exception e) { 36 logger.error(e); 37 } 38 } 39 40 } 41 | Popular Tags |