diff --git a/modules/samples/sample-clients/http-server/src/main/java/org/wso2/sp/http/server/HttpServerListener.java b/modules/samples/sample-clients/http-server/src/main/java/org/wso2/sp/http/server/HttpServerListener.java index 903a1bfa3..795c643c0 100644 --- a/modules/samples/sample-clients/http-server/src/main/java/org/wso2/sp/http/server/HttpServerListener.java +++ b/modules/samples/sample-clients/http-server/src/main/java/org/wso2/sp/http/server/HttpServerListener.java @@ -35,7 +35,7 @@ public class HttpServerListener implements HttpHandler { private static final Logger logger = Logger.getLogger(HttpServerListener.class); private AtomicBoolean isEventArraved = new AtomicBoolean(false); - private StringBuilder strBld; + private StringBuilder strBld = new StringBuilder(); private Headers headers; HttpServerListener() { @@ -48,17 +48,17 @@ public void handle(HttpExchange t) throws IOException { headers = t.getRequestHeaders(); InputStream is = t.getRequestBody(); BufferedReader in = new BufferedReader(new InputStreamReader(is)); // initiating - strBld = new StringBuilder(); + String name = null; while ((line = in.readLine()) != null) { - strBld = strBld.append(line).append("\n"); + strBld = strBld.append(line).append(" , "); + name = line; } - logger.info("Event Arrived: " + strBld.toString()); + logger.info("Event Name Arrived: " + name); isEventArraved.set(true); } String getData() { - isEventArraved = new AtomicBoolean(false); return strBld.toString(); } @@ -66,7 +66,7 @@ Headers getHeaders() { return headers; } - boolean iaMessageArrive() { + boolean isMessageArrive() { return isEventArraved.get(); } diff --git a/modules/samples/sample-clients/http-server/src/main/java/org/wso2/sp/http/server/HttpServerMain.java b/modules/samples/sample-clients/http-server/src/main/java/org/wso2/sp/http/server/HttpServerMain.java index 240ce9a3d..1dadb3ecb 100644 --- a/modules/samples/sample-clients/http-server/src/main/java/org/wso2/sp/http/server/HttpServerMain.java +++ b/modules/samples/sample-clients/http-server/src/main/java/org/wso2/sp/http/server/HttpServerMain.java @@ -9,10 +9,10 @@ public class HttpServerMain { public static void main(String[] args) throws InterruptedException { while (true) { HttpServerListenerHandler lst = new HttpServerListenerHandler(8080); - while (!lst.getServerListner().iaMessageArrive()) { + while (!lst.getServerListner().isMessageArrive()) { Thread.sleep(100); } - logger.info("Received Event :" + lst.getServerListner().getData()); + logger.info("Received Event Names:" + lst.getServerListner().getData()); logger.info("Received Event Headers key set:" + lst.getServerListner().getHeaders().keySet().toString()); logger.info("Received Event Headers value set:" + lst.getServerListner().getHeaders().values().toString()); lst.shutdown();