Package com.mockey.model

Examples of com.mockey.model.FulfilledClientRequest


        else if (action != null && "tag".equals(action)) {
            String fulfilledRequestId = req.getParameter("fulfilledRequestId");
           
            try {
              FulfilledClientRequest ffcr = store.getFulfilledClientRequestsById(new Long(fulfilledRequestId));
              if(ffcr.getComment()!=null){
                ffcr.setComment(null);
              }else {
                  ffcr.setComment("tagged");
              }
              store.saveOrUpdateFulfilledClientRequest(ffcr);
            } catch (Exception e) {
                logger.error("Unable to tag history of a fulfilled request with id:" + fulfilledRequestId, e);
            }
View Full Code Here


        Long fulfilledRequestId = null;
        try {

            fulfilledRequestId = new Long(req.getParameter("fulfilledRequestId"));
            FulfilledClientRequest fCRequest = store.getFulfilledClientRequestsById(fulfilledRequestId);
            String contextRootScenarioURL = Url.getContextAwarePath("/scenario", req.getContextPath());
           
            returnHTML.append("<script type=\"text/javascript\">");
            returnHTML.append("$(document).ready(function() {");
            returnHTML.append("    $('textarea.resizable:not(.processed)').TextAreaResizer();");
            returnHTML.append("    $('iframe.resizable:not(.processed)').TextAreaResizer();");
            returnHTML.append("});");
            returnHTML.append("</script>");
            returnHTML.append("<table class=\"history\" width=\"100%\">");
            returnHTML.append("     <tbody>");
            returnHTML.append("<tr>");
            returnHTML.append("<td>");
            returnHTML.append("<div class=\"conflict_message\">");
            String contextRoot = req.getContextPath();
            String doitagainUrl = Url.getContextAwarePath("/doitagain", contextRoot);
            returnHTML.append("<form id=\"child\" action=\""+doitagainUrl+"\" method=\"post\" style=\"background-color:#FFD7D7\" >");
            returnHTML.append("<input type=\"hidden\" name=\"fulfilledClientRequestId\" value=\""+fCRequest.getId()+"\" />");
            returnHTML.append("<h2>Request:</h2>");
            returnHTML.append("<p><h4>" + fCRequest.getRawRequest() + "</h4></p>");
            returnHTML.append("<p>Header (pipe delimited)</p>");
            returnHTML.append("<p><textarea class=\"resizable\" name=\"requestHeader\" rows=\"5\" cols=\"100%\">"
                    + fCRequest.getClientRequestHeaders() + "</textarea></p>");
            returnHTML.append("<p>Parameters (pipe delimited)</p>");
            returnHTML.append("<p><textarea class=\"resizable\" name=\"requestParameters\" rows=\"5\" cols=\"100%\">"
                    + fCRequest.getClientRequestParameters() + "</textarea></p>");
            returnHTML.append("<p>Body</p>");
            returnHTML.append("<p><textarea class=\"resizable\" name=\"requestBody\" rows=\"10\" >"
                    + fCRequest.getClientRequestBody() + "</textarea></p>");
            returnHTML.append("<input type=\"submit\" name=\"NewParameters\" value=\"Send This Again\" class=\"button\" />");
            returnHTML.append(" This will build a request with the body, parameters, and header information above. ");
            returnHTML.append("</form>");
            returnHTML.append("</div>");
            returnHTML.append("</td>");
            returnHTML.append("</tr>");
            returnHTML.append(" <tr>");
            returnHTML.append("<td >");
            returnHTML.append("<form id=\"child\" action=\"" + contextRootScenarioURL + "\" method=\"post\">");
            returnHTML.append("<input type=\"hidden\" name=\"actionTypeGetFlag\" value=\"true\" />");
            returnHTML
                    .append("<input type=\"hidden\" name=\"serviceId\" value=\"" + fCRequest.getServiceId() + "\" />");
            returnHTML.append("<div id=\"scenario" + fCRequest.getId()
                    + "\" class=\"addition_message mockeyResponse\">");
            returnHTML.append("<h2>Response: </h2>");
            returnHTML.append("<p>Status</p>");
            returnHTML.append("<p>");
            returnHTML.append("    <textarea class=\"resizable\" name=\"responseStatus\" rows=\"1\" >"
                    + fCRequest.getResponseMessage().getHttpResponseStatusCode() + "</textarea>");
            returnHTML.append("</p>");
            returnHTML.append("<p>Header</p>");
            returnHTML.append("<p>");
            returnHTML.append("<textarea class=\"resizable\" name=\"responseHeader\" rows=\"10\" >"
                    + fCRequest.getResponseMessage().getHeaderInfo() + "</textarea>");
            returnHTML.append("</p>");
            returnHTML.append("<p>Body</p>");
            returnHTML.append("<p>");
            returnHTML
                    .append("<textarea style=\"margin-top: 0px;\" name=\"responseMessage\" class=\"resizable responseContent\" rows=\"10\" >"
                            + StringEscapeUtils.escapeXml(fCRequest.getResponseMessage().getBody()) + "</textarea>");
            returnHTML.append("</p>");
            returnHTML.append("<p>");
            returnHTML.append("<input type=\"submit\" name=\"Save\" value=\"Save Response as a Scenario\" />");
            String inspectFulfilledRequestURL = Url.getContextAwarePath("/inspect", req.getContextPath());
            returnHTML.append(" View response body as: ");
View Full Code Here

   
    public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       
      String contentType = req.getParameter("content_type");
      Long fulfilledRequestId = new Long(req.getParameter("fulfilledRequestId"));
      FulfilledClientRequest fulfilledClientRequest = store.getFulfilledClientRequestsById(fulfilledRequestId);
      resp.setContentType(contentType);
      new PrintStream(resp.getOutputStream()).println(fulfilledClientRequest.getResponseMessage().getBody());

    }   
View Full Code Here

     */
  public void service(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Long fulfilledClientRequestId = new Long(req
        .getParameter("fulfilledClientRequestId"));
    FulfilledClientRequest pastFulfilledClientRequest = store
        .getFulfilledClientRequestsById(fulfilledClientRequestId);
    String pipeDelimitedHeaderInfo = req.getParameter("requestHeader");
    String parameters = req.getParameter("requestParameters");
    String body = req.getParameter("requestBody");

    Url serviceUrl = new Url(pastFulfilledClientRequest.getRawRequest());
    StringBuffer redoUrl = new StringBuffer();

    // 1. Cut out the parameters
    String fullUrl = serviceUrl.getFullUrl();
    int indexOfParam = fullUrl.indexOf("?");
View Full Code Here

    }
  }

  private void logRequestAsFulfilled(Service service, RequestFromClient request, ResponseFromService response,
      String ip, RequestInspectionResult inspectionResult) throws UnsupportedEncodingException {
    FulfilledClientRequest fcr = new FulfilledClientRequest();
    fcr.setRawRequest((response.getRequestUrl() != null) ? response.getRequestUrl().toString() : "");
    fcr.setRequestorIP(ip);
    fcr.setServiceId(service.getId());
    fcr.setServiceName(service.getServiceName());
    fcr.setClientRequestBody(request.getBodyInfo());
    fcr.setClientRequestHeaders(request.getHeaderInfo());
    fcr.setClientRequestParameters(request.getParameterInfo());
    fcr.setResponseMessage(response);
    fcr.setScenarioName(response.getScenarioName());
    fcr.setClientRequestCookies(request.getCookieInfoAsString());// response.getRequestCookies());
    fcr.setClientResponseCookies(response.getResponseCookiesAsString());

    fcr.setServiceResponseType(service.getServiceResponseType());
    if (response.getOriginalRequestUrlBeforeTwisting() != null) {
      fcr.setOriginalUrlBeforeTwisting(response.getOriginalRequestUrlBeforeTwisting().toString());
    }
    fcr.setRequestInspectionResult(inspectionResult);
    fcr.setServiceTagsAsString(service.getTag());
    fcr.setScenarioTagsAsString(response.getScenarioTagsAsString());
    store.saveOrUpdateFulfilledClientRequest(fcr);
  }
View Full Code Here

        Long fulfilledRequestId = null;
        JSONObject jsonObject = new JSONObject();
        try {

            fulfilledRequestId = new Long(req.getParameter("conversationRecordId"));
            FulfilledClientRequest fCRequest = store.getFulfilledClientRequestsById(fulfilledRequestId);
           
            jsonObject.put("conversationRecordId", ""+fulfilledRequestId);
            jsonObject.put("serviceId", ""+fCRequest.getServiceId());
            jsonObject.put("serviceName", fCRequest.getServiceName());
            jsonObject.put("requestUrl", ""+fCRequest.getRawRequest());
            jsonObject.put("requestHeaders", ""+fCRequest.getClientRequestHeaders());
            jsonObject.put("requestParameters", ""+fCRequest.getClientRequestParameters());
            jsonObject.put("requestBody", ""+fCRequest.getClientRequestBody());
            jsonObject.put("requestCookies", ""+fCRequest.getClientRequestCookies());
            jsonObject.put("responseCookies", ""+fCRequest.getClientResponseCookies());
            jsonObject.put("responseStatus", ""+fCRequest.getResponseMessage().getHttpResponseStatusCode());
            jsonObject.put("responseHeader", ""+fCRequest.getResponseMessage().getHeaderInfo());
            jsonObject.put("responseBody", ""+fCRequest.getResponseMessage().getBody());
            jsonObject.put("responseScenarioName", ""+fCRequest.getScenarioName());
            jsonObject.put("responseScenarioTags", ""+fCRequest.getScenarioTagsAsString());


        } catch (Exception e) {
           try {
        jsonObject.put("error", ""+"Sorry, history for this conversation (fulfilledRequestId="+fulfilledRequestId
View Full Code Here

TOP

Related Classes of com.mockey.model.FulfilledClientRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.