Java Code Examples for javax.servlet.http.HttpServletRequest.getLocalPort()

The following are Jave code examples for showing how to use getLocalPort() of the javax.servlet.http.HttpServletRequest class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ramus   File: JNLPSeasonInternetServlet.java   View Source Code Vote up 7 votes
private void accept(HttpServletRequest req, HttpServletResponse resp) {
    try {
        String localAddr = req.getLocalAddr();
        Properties properties = EngineFactory.getPropeties();
        if (properties.getProperty("hostname") != null) {
            localAddr = properties.getProperty("hostname");
        }
        String path = "http://" + localAddr + ":" + req.getLocalPort()
                + req.getContextPath();
        InputStream is = getClass().getResourceAsStream(
                "/com/ramussoft/jnlp/season-internet-client.jnlp");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int r;
        while ((r = is.read()) >= 0)
            out.write(r);
        String string = MessageFormat.format(new String(out.toByteArray(),
                "UTF8"), path);
        resp.setContentType("application/x-java-jnlp-file");
        OutputStream o = resp.getOutputStream();
        o.write(string.getBytes("UTF8"));
        o.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
Example 2
Project: DKJavaWebApiDemo   File: APIRequest.java   View Source Code Vote up 6 votes
public APIRequest(HttpServletRequest request) {

        this.request = request;

        header = new HashMap<String, Object>();
        Enumeration e = request.getHeaderNames();
        while (e.hasMoreElements()) {
            String name = (String) e.nextElement();
            Object value = request.getHeader(name);
            header.put(name, value);
        }

        params = getParamesMap(request.getParameterMap());
        url = request.getRequestURL().toString();
        uri = request.getRequestURI();
        remoteAddr = request.getRemoteAddr();
        remoteHost = request.getRemoteHost();
        remotePort = request.getRemotePort();
        contextPath = request.getContextPath();
        localAddr = request.getLocalAddr();
        characterEncoding = request.getCharacterEncoding();
        localName = request.getLocalName();
        localPort = request.getLocalPort();
        method = request.getMethod();
        queryString = request.getQueryString();
    }
 
Example 3
Project: ramus   File: JNLPServlet.java   View Source Code Vote up 6 votes
private void accept(HttpServletRequest req, HttpServletResponse resp) {
    try {
        String localAddr = req.getLocalAddr();
        Properties properties = EngineFactory.getPropeties();
        if (properties.getProperty("hostname") != null) {
            localAddr = properties.getProperty("hostname");
        }
        String path = "http://" + localAddr + ":" + req.getLocalPort() + req.getContextPath();
        InputStream is = getClass().getResourceAsStream(
                "/com/ramussoft/jnlp/ramus-client.jnlp");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int r;
        while ((r = is.read()) >= 0)
            out.write(r);
        String string = MessageFormat.format(new String(out.toByteArray(),
                "UTF8"), path);
        resp.setContentType("application/x-java-jnlp-file");
        OutputStream o = resp.getOutputStream();
        o.write(string.getBytes("UTF8"));
        o.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
Example 4
Project: ramus   File: JNLPLocalServlet.java   View Source Code Vote up 6 votes
private void accept(HttpServletRequest req, HttpServletResponse resp) {
    try {
        String path = "http://" + req.getLocalAddr() + ":" + req.getLocalPort() + req.getContextPath();
        InputStream is = getClass().getResourceAsStream(
                "/com/ramussoft/jnlp/ramus-local.jnlp");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int r;
        while ((r = is.read()) >= 0)
            out.write(r);
        String string = MessageFormat.format(new String(out.toByteArray(),
                "UTF8"), path);
        resp.setContentType("application/x-java-jnlp-file");
        OutputStream o = resp.getOutputStream();
        o.write(string.getBytes("UTF8"));
        o.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
Example 5
Project: ats-framework   File: MonitoringServiceImpl.java   View Source Code Vote up 6 votes
@POST
@Path( "stopMonitoring")
@Produces( MediaType.APPLICATION_JSON)
public Response stopMonitoring(
                                @Context HttpServletRequest request,
                                BasePojo basePojo ) {

    final String caller = getCaller(request, basePojo, false);
    ThreadsPerCaller.registerThread(caller);
    try {
        SessionData sd = getSessionData(request, basePojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        String agent = request.getLocalAddr() + ":" + request.getLocalPort();

        restSystemMonitor.stopMonitoring(agent);
    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }

    return Response.ok("{\"status\":\"monitoring stopped.\"}").build();
}
 
Example 6
Project: ramus   File: JNLPHTTPServlet.java   View Source Code Vote up 6 votes
private void accept(HttpServletRequest req, HttpServletResponse resp) {
    try {
        String localAddr = req.getLocalAddr();
        Properties properties = EngineFactory.getPropeties();
        if (properties.getProperty("hostname") != null) {
            localAddr = properties.getProperty("hostname");
        }
        String path = "http://" + localAddr + ":" + req.getLocalPort() + req.getContextPath();
        InputStream is = getClass().getResourceAsStream(
                "/com/ramussoft/jnlp/ramus-http-client.jnlp");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int r;
        while ((r = is.read()) >= 0)
            out.write(r);
        String string = MessageFormat.format(new String(out.toByteArray(),
                "UTF8"), path);
        resp.setContentType("application/x-java-jnlp-file");
        OutputStream o = resp.getOutputStream();
        o.write(string.getBytes("UTF8"));
        o.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
Example 7
Project: ramus   File: JNLPInternetServlet.java   View Source Code Vote up 6 votes
private void accept(HttpServletRequest req, HttpServletResponse resp) {
    try {
        String localAddr = req.getLocalAddr();
        Properties properties = EngineFactory.getPropeties();
        if (properties.getProperty("hostname") != null) {
            localAddr = properties.getProperty("hostname");
        }
        String path = "http://" + localAddr + ":" + req.getLocalPort() + req.getContextPath();
        InputStream is = getClass().getResourceAsStream(
                "/com/ramussoft/jnlp/ramus-internet-client.jnlp");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int r;
        while ((r = is.read()) >= 0)
            out.write(r);
        String string = MessageFormat.format(new String(out.toByteArray(),
                "UTF8"), path);
        resp.setContentType("application/x-java-jnlp-file");
        OutputStream o = resp.getOutputStream();
        o.write(string.getBytes("UTF8"));
        o.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
Example 8
Project: ramus   File: JNLPSeasonTcpServlet.java   View Source Code Vote up 6 votes
private void accept(HttpServletRequest req, HttpServletResponse resp) {
    try {
        String localAddr = req.getLocalAddr();
        Properties properties = EngineFactory.getPropeties();
        if (properties.getProperty("hostname") != null) {
            localAddr = properties.getProperty("hostname");
        }
        String path = "http://" + localAddr + ":" + req.getLocalPort()
                + req.getContextPath();
        InputStream is = getClass().getResourceAsStream(
                "/com/ramussoft/jnlp/season-tcp-client.jnlp");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int r;
        while ((r = is.read()) >= 0)
            out.write(r);
        String string = MessageFormat.format(new String(out.toByteArray(),
                "UTF8"), path);
        resp.setContentType("application/x-java-jnlp-file");
        OutputStream o = resp.getOutputStream();
        o.write(string.getBytes("UTF8"));
        o.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
Example 9
Project: tomcat7   File: RemoteIpFilter.java   View Source Code Vote up 5 votes
public XForwardedRequest(HttpServletRequest request) {
    super(request);
    this.localPort = request.getLocalPort();
    this.remoteAddr = request.getRemoteAddr();
    this.remoteHost = request.getRemoteHost();
    this.scheme = request.getScheme();
    this.secure = request.isSecure();
    this.serverPort = request.getServerPort();
    
    headers = new HashMap<String, List<String>>();
    for (Enumeration<String> headerNames = request.getHeaderNames(); headerNames.hasMoreElements();) {
        String header = headerNames.nextElement();
        headers.put(header, Collections.list(request.getHeaders(header)));
    }
}
 
Example 10
Project: ats-framework   File: MonitoringServiceImpl.java   View Source Code Vote up 5 votes
/**
 * Initialize Monitoring context Must be called before calling any
 * scheduleXYZMonitoring REST method
 */
@POST
@Path( "initializeMonitoring")
@Consumes( MediaType.APPLICATION_JSON)
@Produces( MediaType.APPLICATION_JSON)
public Response initializeMonitoring(
                                      @Context HttpServletRequest request,
                                      BasePojo basePojo ) {

    final String caller = getCaller(request, basePojo, false);
    ThreadsPerCaller.registerThread(caller);

    try {

        SessionData sd = getSessionData(request, basePojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        String agent = request.getLocalAddr() + ":" + request.getLocalPort();

        restSystemMonitor.initializeMonitoringContext(agent);

        return Response.ok("{\"status\":\"monitoring context initialized.\"}").build();

    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }

}
 
Example 11
Project: ats-framework   File: MonitoringServiceImpl.java   View Source Code Vote up 5 votes
@POST
@Path( "scheduleSystemMonitoring")
@Consumes( MediaType.APPLICATION_JSON)
@Produces( MediaType.APPLICATION_JSON)
public Response scheduleSystemMonitoring(
                                          @Context HttpServletRequest request,
                                          ScheduleSystemMonitoringPojo monitoringPojo ) {

    final String caller = getCaller(request, monitoringPojo, false);
    ThreadsPerCaller.registerThread(caller);

    try {

        SessionData sd = getSessionData(request, monitoringPojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        String agent = request.getLocalAddr() + ":" + request.getLocalPort();

        Set<ReadingBean> readings = restSystemMonitor.scheduleSystemMonitoring(agent,
                                                                               monitoringPojo.getReadings());

        restSystemMonitor.setScheduledReadingTypes(readings);

        return Response.ok("{\"status\":\"scheduled system monitoring for readings '"
                           + Arrays.toString(monitoringPojo.getReadings()) + "'\"}")
                       .build();
    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }
}
 
Example 12
Project: ats-framework   File: MonitoringServiceImpl.java   View Source Code Vote up 5 votes
@POST
@Path( "scheduleMonitoring")
@Consumes( MediaType.APPLICATION_JSON)
@Produces( MediaType.APPLICATION_JSON)
public Response scheduleMonitoring(
                                    @Context HttpServletRequest request,
                                    ScheduleMonitoringPojo monitoringPojo ) {

    final String caller = getCaller(request, monitoringPojo, false);
    ThreadsPerCaller.registerThread(caller);

    try {

        SessionData sd = getSessionData(request, monitoringPojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        String agent = request.getLocalAddr() + ":" + request.getLocalPort();

        Set<ReadingBean> readings = restSystemMonitor.scheduleMonitoring(agent,
                                                                         monitoringPojo.getReading(),
                                                                         monitoringPojo.getReadingParametersAsMap());

        restSystemMonitor.setScheduledReadingTypes(readings);

        String readingParametersAsString = entrySetAsString(monitoringPojo.getReadingParametersAsMap());

        return Response.ok("{\"status\":\"scheduled monitoring for reading '"
                           + monitoringPojo.getReading() + "' and readingParameters '"
                           + readingParametersAsString + "'\"}")
                       .build();

    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }

}
 
Example 13
Project: lazycat   File: RemoteIpFilter.java   View Source Code Vote up 5 votes
public XForwardedRequest(HttpServletRequest request) {
	super(request);
	this.localPort = request.getLocalPort();
	this.remoteAddr = request.getRemoteAddr();
	this.remoteHost = request.getRemoteHost();
	this.scheme = request.getScheme();
	this.secure = request.isSecure();
	this.serverPort = request.getServerPort();

	headers = new HashMap<String, List<String>>();
	for (Enumeration<String> headerNames = request.getHeaderNames(); headerNames.hasMoreElements();) {
		String header = headerNames.nextElement();
		headers.put(header, Collections.list(request.getHeaders(header)));
	}
}
 
Example 14
Project: ats-framework   File: MonitoringServiceImpl.java   View Source Code Vote up 5 votes
@POST
@Path( "scheduleChildProcessMonitoring")
@Consumes( MediaType.APPLICATION_JSON)
@Produces( MediaType.APPLICATION_JSON)
public Response scheduleChildProcessMonitoring(
                                                @Context HttpServletRequest request,
                                                ScheduleProcessMonitoringPojo monitoringPojo ) {

    final String caller = getCaller(request, monitoringPojo, false);
    ThreadsPerCaller.registerThread(caller);

    try {
        SessionData sd = getSessionData(request, monitoringPojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        String agent = request.getLocalAddr() + ":" + request.getLocalPort();

        Set<ReadingBean> readings = restSystemMonitor.scheduleChildProcessMonitoring(agent,
                                                                                     monitoringPojo.getParentProcess(),
                                                                                     monitoringPojo.getProcessPattern(),
                                                                                     monitoringPojo.getProcessAlias(),
                                                                                     monitoringPojo.getProcessUsername(),
                                                                                     monitoringPojo.getProcessReadingTypes());

        restSystemMonitor.setScheduledReadingTypes(readings);

    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }

    String statusMessage = "{\"status \": \"scheduled child process monitoring with parameters '"
                           + monitoringPojo.toString() + "'\"}";

    return Response.ok(statusMessage).build();
}
 
Example 15
Project: ats-framework   File: MonitoringServiceImpl.java   View Source Code Vote up 5 votes
@POST
@Path( "scheduleJvmMonitoring")
@Consumes( MediaType.APPLICATION_JSON)
@Produces( MediaType.APPLICATION_JSON)
public Response scheduleJvmMonitoring(
                                       @Context HttpServletRequest request,
                                       ScheduleJvmMonitoringPojo monitoringPojo ) {

    final String caller = getCaller(request, monitoringPojo, false);
    ThreadsPerCaller.registerThread(caller);

    try {

        SessionData sd = getSessionData(request, monitoringPojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        String agent = request.getLocalAddr() + ":" + request.getLocalPort();

        Set<ReadingBean> readings = restSystemMonitor.scheduleJvmMonitoring(agent,
                                                                            monitoringPojo.getJvmPort(),
                                                                            (monitoringPojo.getAlias() == null)
                                                                                                                ? ""
                                                                                                                : monitoringPojo.getAlias(),
                                                                            monitoringPojo.getJvmReadingTypes());

        restSystemMonitor.setScheduledReadingTypes(readings);

    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }

    String statusMessage = "{\"status \": \"scheduled JVM monitoring with parameters '"
                           + monitoringPojo.toString() + "'\"}";

    return Response.ok(statusMessage).build();
}
 
Example 16
Project: ats-framework   File: MonitoringServiceImpl.java   View Source Code Vote up 5 votes
@POST
@Path( "scheduleCustomJvmMonitoring")
@Consumes( MediaType.APPLICATION_JSON)
@Produces( MediaType.APPLICATION_JSON)
public Response scheduleCustomJvmMonitoring(
                                             @Context HttpServletRequest request,
                                             ScheduleCustomJvmMonitoringPojo monitoringPojo ) {

    final String caller = getCaller(request, monitoringPojo, false);
    ThreadsPerCaller.registerThread(caller);

    try {

        SessionData sd = getSessionData(request, monitoringPojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        String agent = request.getLocalAddr() + ":" + request.getLocalPort();

        Set<ReadingBean> readings = restSystemMonitor.scheduleCustomJvmMonitoring(agent,
                                                                                  monitoringPojo.getJmxPort(),
                                                                                  monitoringPojo.getAlias(),
                                                                                  monitoringPojo.getMbeanName(),
                                                                                  monitoringPojo.getUnit(),
                                                                                  monitoringPojo.getMbeanAttributes());

        restSystemMonitor.setScheduledReadingTypes(readings);

    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }

    String statusMessage = "{\"status \": \"scheduled custom JVM monitoring with parameters '"
                           + monitoringPojo.toString() + "'\"}";

    return Response.ok(statusMessage).build();
}
 
Example 17
Project: ats-framework   File: MonitoringServiceImpl.java   View Source Code Vote up 5 votes
@POST
@Path( "startMonitoring")
@Consumes( MediaType.APPLICATION_JSON)
@Produces( MediaType.APPLICATION_JSON)
public Response startMonitoring(
                                 @Context HttpServletRequest request,
                                 StartMonitoringPojo monitoringPojo ) {

    final String caller = getCaller(request, monitoringPojo, false);
    ThreadsPerCaller.registerThread(caller);

    try {

        SessionData sd = getSessionData(request, monitoringPojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        String agent = request.getLocalAddr() + ":" + request.getLocalPort();

        // calculate the time offset between the agent and the test executor
        long timeOffset = System.currentTimeMillis() - monitoringPojo.getStartTimestamp();

        restSystemMonitor.startMonitoring(agent,
                                          monitoringPojo.getStartTimestamp(),
                                          monitoringPojo.getPollingInterval(),
                                          timeOffset);

        return Response.ok("{\"status\":\"monitoring started on every "
                           + monitoringPojo.getPollingInterval() + " seconds.\"}")
                       .build();
    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }

}
 
Example 18
Project: apache-tomcat-7.0.73-with-comment   File: RemoteIpFilter.java   View Source Code Vote up 5 votes
public XForwardedRequest(HttpServletRequest request) {
    super(request);
    this.localPort = request.getLocalPort();
    this.remoteAddr = request.getRemoteAddr();
    this.remoteHost = request.getRemoteHost();
    this.scheme = request.getScheme();
    this.secure = request.isSecure();
    this.serverPort = request.getServerPort();
    
    headers = new HashMap<String, List<String>>();
    for (Enumeration<String> headerNames = request.getHeaderNames(); headerNames.hasMoreElements();) {
        String header = headerNames.nextElement();
        headers.put(header, Collections.list(request.getHeaders(header)));
    }
}
 
Example 19
Project: gitplex-mit   File: ServletRequestCopy.java   View Source Code Vote up 4 votes
public ServletRequestCopy(HttpServletRequest request) {
	this.servletPath = request.getServletPath();
	this.contextPath = request.getContextPath();
	this.pathInfo = request.getPathInfo();
	this.requestUri = request.getRequestURI();
	this.requestURL = request.getRequestURL();
	this.method = request.getMethod();
	this.serverName = request.getServerName();
	this.serverPort = request.getServerPort();
	this.protocol = request.getProtocol();
	this.scheme = request.getScheme();
	
	
	/*
	 * have to comment out below two lines as otherwise web socket will
	 * report UnSupportedOperationException upon connection
	 */
	//this.characterEncoding = request.getCharacterEncoding();
	//this.contentType = request.getContentType();
	//this.requestedSessionId = request.getRequestedSessionId();
	this.characterEncoding = null;
	this.contentType = null;
	this.requestedSessionId = null;
	
	this.locale = request.getLocale();
	this.locales = request.getLocales();
	this.isSecure = request.isSecure();
	this.remoteUser = request.getRemoteUser();
	this.remoteAddr = request.getRemoteAddr();
	this.remoteHost = request.getRemoteHost();
	this.remotePort = request.getRemotePort();
	this.localAddr = request.getLocalAddr();
	this.localName = request.getLocalName();
	this.localPort = request.getLocalPort();
	this.pathTranslated = request.getPathTranslated();
	this.principal = request.getUserPrincipal();

	HttpSession session = request.getSession(true);
	httpSession = new HttpSessionCopy(session);

	String s;
	Enumeration<String> e = request.getHeaderNames();
	while (e != null && e.hasMoreElements()) {
		s = e.nextElement();
		Enumeration<String> headerValues = request.getHeaders(s);
		this.headers.put(s, headerValues);
	}

	e = request.getAttributeNames();
	while (e != null && e.hasMoreElements()) {
		s = e.nextElement();
		attributes.put(s, request.getAttribute(s));
	}

	e = request.getParameterNames();
	while (e != null && e.hasMoreElements()) {
		s = e.nextElement();
		parameters.put(s, request.getParameterValues(s));
	}
}
 
Example 20
Project: ats-framework   File: AgentConfigurationServiceImpl.java   View Source Code Vote up 4 votes
/**
 * Tell the DbEventRequestProcess which run and test must receive the DB
 * messages/data
 */
@POST
@Path( "joinTestcase")
@Consumes( MediaType.APPLICATION_JSON)
@Produces( MediaType.APPLICATION_JSON)
public Response joinTestcase(
                              @Context HttpServletRequest request,
                              JoinTestcasePojo testCaseStatePojo ) {

    final String caller = getCaller(request, testCaseStatePojo, false);
    ThreadsPerCaller.registerThread(caller);

    try {
        SessionData sd = getSessionData(request, testCaseStatePojo);

        RestSystemMonitor restSystemMonitor = sd.getSystemMonitor();

        // cancel all action tasks, that are started on an agent, located on
        // the current caller host.
        // current caller and the agent must have the same IP, in order for
        // the queue to be cancelled
        dbLog.debug("Cancelling all action task on the agent, that were started form the current caller.");
        MultiThreadedActionHandler.cancellAllQueuesFromAgent(ThreadsPerCaller.getCaller());

        // cancel all running system monitoring tasks on the agent
        dbLog.debug("Cancelling all running system monitoring tasks on the agent, that were started form the current caller.");
        String agent = request.getLocalAddr() + ":" + request.getLocalPort();
        restSystemMonitor.stopMonitoring(agent);

        TestCaseState newTestCaseState = new TestCaseState();
        newTestCaseState.setRunId(testCaseStatePojo.getRunId());
        newTestCaseState.setTestcaseId(testCaseStatePojo.getTestcaseId());

        // get the current state on the agent
        TestCaseState currentState = dbLog.getCurrentTestCaseState();
        boolean joinToNewTescase = true;
        if (currentState != null && currentState.isInitialized()) {
            /* This agent is already configured.
             *
             * Now check if the state is the same as the new one, this would mean we are trying to
             * configure this agent for second time.
             * This is normal as we get here when Test Executor or another agent calls this agent for first time.
             *
             * If the state is different, we hit an error which means this agent did not get On Test End event
             * for the previous test case.
             */
            if (!currentState.equals(newTestCaseState)) {

                dbLog.error("This test appears to be aborted by the user on the test executor side, but it kept running on the agent side."
                            + " Now we cancel any further logging from the agent.");
                dbLog.leaveTestCase();
            } else {
                joinToNewTescase = false;

            }
        }

        if (joinToNewTescase) {

            /* previous RestSystemMonitor instance is still in the sessionData for that caller 
             * so we create new RestSystemMonitor for this caller
             * */
            restSystemMonitor = new RestSystemMonitor();
            sd.setSystemMonitor(restSystemMonitor);
            dbLog.joinTestCase(newTestCaseState);
        }

        logClassPath(newTestCaseState);

        return Response.ok("{\"status\": \"testcase joined.\"}").build();
    } catch (Exception e) {
        return Response.serverError().entity(new ErrorPojo(e)).build();
    } finally {
        ThreadsPerCaller.unregisterThread();
    }

}