javax.servlet.http.HttpServletResponse#SC_OK源码实例Demo

下面列出了javax.servlet.http.HttpServletResponse#SC_OK 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ja-micro   文件: JsonHandler.java
@SuppressWarnings("unchecked")
private JsonRpcResponse dispatchJsonRpcRequest(JsonRpcRequest rpcRequest, OrangeContext cxt) {
    JsonRpcResponse jsonResponse = new JsonRpcResponse(rpcRequest.getId(), JsonNull.INSTANCE,
            JsonNull.INSTANCE, HttpServletResponse.SC_OK);
    try {
        ServiceMethodHandler handler = handlers.getMethodHandler(rpcRequest.getMethod());
        Message innerRequest = convertJsonToProtobuf(handler, rpcRequest);
        JsonElement idElement = rpcRequest.getId();
        if (idElement == null) {
            jsonResponse.setId(new JsonPrimitive(-1));
        }
        Message innerResponse = invokeHandlerChain(rpcRequest.getMethod(), handler, innerRequest, cxt);
        jsonResponse.setResult(ProtobufUtil.protobufToJson(innerResponse));
    } catch (RpcCallException rpcEx) {
        logger.debug("Error processing request", rpcEx);
        jsonResponse.setError(rpcEx.toJson());
        jsonResponse.setStatusCode(rpcEx.getCategory().getHttpStatus());
    } catch (Exception ex) {
        logger.warn("Error processing request", ex);
        if (ex.getMessage() != null) {
            jsonResponse.setError(new JsonPrimitive(ex.getMessage()));
        }
        jsonResponse.setStatusCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
    return jsonResponse;
}
 
源代码2 项目: gocd   文件: ChecksumValidationPublisher.java
public void publish(int httpCode, File artifact, GoPublisher goPublisher) {
    if (!this.md5MismatchPaths.isEmpty()) {
        String mismatchedFilePath = md5MismatchPaths.iterator().next();
        goPublisher.taggedConsumeLineWithPrefix(GoPublisher.ERR,
                String.format("[ERROR] Verification of the integrity of the artifact [%s] failed. The artifact file on the server may have changed since its original upload.", mismatchedFilePath));
        throw new RuntimeException(String.format("Artifact download failed for [%s]", mismatchedFilePath));
    }
    for (String md5NotFoundPath : md5NotFoundPaths) {
        goPublisher.taggedConsumeLineWithPrefix(GoPublisher.ERR, String.format("[WARN] The md5checksum value of the artifact [%s] was not found on the server. Hence, Go could not verify the integrity of its contents.", md5NotFoundPath));
    }

    if (httpCode == HttpServletResponse.SC_NOT_MODIFIED) {
        goPublisher.taggedConsumeLineWithPrefix(GoPublisher.OUT, "Artifact is not modified, skipped fetching it");
    }

    if (httpCode == HttpServletResponse.SC_OK) {
        if (md5NotFoundPaths.size() > 0 || md5ChecksumFileWasNotFound) {
            goPublisher.taggedConsumeLineWithPrefix(GoPublisher.ERR, String.format("Saved artifact to [%s] without verifying the integrity of its contents.", artifact));
        } else {
            goPublisher.taggedConsumeLineWithPrefix(GoPublisher.OUT, String.format("Saved artifact to [%s] after verifying the integrity of its contents.", artifact));
        }
    }
}
 
源代码3 项目: scipio-erp   文件: ICalWorker.java
public static void handleGetRequest(HttpServletRequest request, HttpServletResponse response, ServletContext context) throws IOException {
    if (!isValidRequest(request, response)) {
        return;
    }
    String workEffortId = (String) request.getAttribute("workEffortId");
    Debug.logInfo("[handleGetRequest] workEffortId = " + workEffortId, module);
    ResponseProperties responseProps = null;
    try {
        responseProps = ICalConverter.getICalendar(workEffortId, createConversionContext(request));
    } catch (Exception e) {
        Debug.logError(e, "[handleGetRequest] Error while sending calendar: ", module);
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        return;
    }
    if (responseProps.statusCode == HttpServletResponse.SC_OK) {
        response.setContentType("text/calendar");
    }
    writeResponse(responseProps, request, response, context);
}
 
源代码4 项目: Ratel   文件: MonitoringApplication.java
private String getServiceStatus(String serviceHealthcheckAddress) {
    HttpClient client = new DefaultHttpClient();
    HttpUriRequest request = new HttpHead(serviceHealthcheckAddress);

    try {
        HttpResponse response = client.execute(request);
        if (response.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) {
            return "UP";
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    return "DOWN";
}
 
源代码5 项目: athenz   文件: HealthCheckFilter.java
private int getHealthCheckStatus(final File file) {
    if (file.exists()) {
        return HttpServletResponse.SC_OK;
    } else {
        return HttpServletResponse.SC_NOT_FOUND;
    }
}
 
源代码6 项目: orion.server   文件: AppsHandlerV1.java
private IStatus getApps(Target target) throws Exception {
	String appsUrl = target.getSpace().getCFJSON().getJSONObject("entity").getString("apps_url"); //$NON-NLS-1$//$NON-NLS-2$
	URI appsURI = URIUtil.toURI(target.getUrl()).resolve(appsUrl);

	GetMethod getAppsMethod = new GetMethod(appsURI.toString());
	ServerStatus confStatus = HttpUtil.configureHttpMethod(getAppsMethod, target.getCloud());
	if (!confStatus.isOK())
		return confStatus;
	
	getAppsMethod.setQueryString("inline-relations-depth=2"); //$NON-NLS-1$

	ServerStatus getAppsStatus = HttpUtil.executeMethod(getAppsMethod);
	if (!getAppsStatus.isOK())
		return getAppsStatus;

	/* extract available apps */
	JSONObject appsJSON = getAppsStatus.getJsonData();

	JSONObject result = new JSONObject();
	result.put("Apps", new JSONArray()); //$NON-NLS-1$

	if (appsJSON.getInt(CFProtocolConstants.V2_KEY_TOTAL_RESULTS) < 1) {
		return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, result);
	}

	JSONArray resources = appsJSON.getJSONArray(CFProtocolConstants.V2_KEY_RESOURCES);
	for (int k = 0; k < resources.length(); ++k) {
		JSONObject appJSON = resources.getJSONObject(k);
		App2 app = new App2();
		app.setCFJSON(appJSON);
		result.append("Apps", app.toJSON()); //$NON-NLS-1$
	}

	return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, result);
}
 
源代码7 项目: Tomcat7.0.67   文件: TestContextConfig.java
private void assertPageContains(String pageUrl, String expectedBody,
        int expectedStatus) throws IOException {
    ByteChunk res = new ByteChunk();
    int sc = getUrl("http://localhost:" + getPort() + pageUrl, res, null);

    Assert.assertEquals(expectedStatus, sc);

    if (expectedStatus == HttpServletResponse.SC_OK) {
        String result = res.toString();
        Assert.assertTrue(result, result.indexOf(expectedBody) > -1);
    }
}
 
源代码8 项目: swellrt   文件: RobotConnectionUtil.java
/**
 * Validates and read the response.
 *
 * @param url the URL where the response was received from.
 * @param statusCode the HTTP status code.
 * @param response the raw response of fetching the given URL.
 * @return the response, as {@link String}.
 *
 * @throws RobotConnectionException if the response code is not HTTP OK (200).
 */
public static String validateAndReadResponse(String url, int statusCode, byte[] response)
    throws RobotConnectionException {
  if (statusCode != HttpServletResponse.SC_OK) {
    String msg = "Robot fetch http failure: " + url + ": " + statusCode;
    throw new RobotConnectionException(msg, statusCode);
  }

  // Read the response.
  return new String(response, Charsets.UTF_8);
}
 
@Override
public void reset() {
	resetBuffer();
	this.characterEncoding = null;
	this.contentLength = 0;
	this.contentType = null;
	this.locale = Locale.getDefault();
	this.cookies.clear();
	this.headers.clear();
	this.status = HttpServletResponse.SC_OK;
	this.errorMessage = null;
}
 
源代码10 项目: para   文件: TwitterAuthFilter.java
private UserAuthentication stepTwo(HttpServletRequest request, String verifier, String[] keys, App app)
		throws ParseException, UnsupportedEncodingException, IOException {
	String token = request.getParameter("oauth_token");
	Map<String, String[]> params = new HashMap<>();
	params.put("oauth_verifier", new String[]{verifier});
	HttpPost tokenPost = new HttpPost(FLOW_URL3);
	tokenPost.setEntity(new StringEntity("oauth_verifier=" + verifier));
	tokenPost.setHeader(HttpHeaders.AUTHORIZATION, OAuth1HmacSigner.sign("POST", FLOW_URL3,
			params, keys[0], keys[1], token, null));
	tokenPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");

	try (CloseableHttpResponse resp2 = httpclient.execute(tokenPost)) {
		if (resp2.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) {
			String decoded = EntityUtils.toString(resp2.getEntity());
			EntityUtils.consumeQuietly(resp2.getEntity());
			String oauthToken = null;
			String oauthSecret = null;
			for (String pair : decoded.split("&")) {
				if (pair.startsWith("oauth_token_secret")) {
					oauthSecret = pair.substring(19);
				} else if (pair.startsWith("oauth_token")) {
					oauthToken = pair.substring(12);
				}
			}
			return getOrCreateUser(app, oauthToken + Config.SEPARATOR + oauthSecret);
		}
	}
	return null;
}
 
@Operation("restore")
@WebApiDescription(title = "Restore deleted Node", description = "Restores an archived node", successStatus = HttpServletResponse.SC_OK)
@WebApiParam(name = "nodeAssocTarget", title = "Target parent id and association type", description = "Target parent id and association type", kind = ResourceParameter.KIND.HTTP_BODY_OBJECT, required = false)
public Node restoreDeletedNode(String nodeId, NodeTargetAssoc nodeTargetAssoc, Parameters parameters, WithResponse withResponse)
{
    return deletedNodes.restoreArchivedNode(nodeId, nodeTargetAssoc);
}
 
源代码12 项目: ranger   文件: TagREST.java
@GET
  @Path(TagRESTConstants.TAGS_SECURE_DOWNLOAD + "{serviceName}")
  @Produces({ "application/json", "application/xml" })
  public ServiceTags getSecureServiceTagsIfUpdated(@PathParam("serviceName") String serviceName,
                                                 @QueryParam(TagRESTConstants.LAST_KNOWN_TAG_VERSION_PARAM) Long lastKnownVersion,
                                                   @DefaultValue("0") @QueryParam(TagRESTConstants.LAST_ACTIVATION_TIME) Long lastActivationTime, @QueryParam("pluginId") String pluginId,
                                                   @DefaultValue("false") @QueryParam(RangerRESTUtils.REST_PARAM_SUPPORTS_TAG_DELTAS) Boolean supportsTagDeltas,
                                                   @DefaultValue("") @QueryParam(RangerRESTUtils.REST_PARAM_CAPABILITIES) String pluginCapabilities,
                                                   @Context HttpServletRequest request) {

      if(LOG.isDebugEnabled()) {
          LOG.debug("==> TagREST.getSecureServiceTagsIfUpdated(" + serviceName + ", " + lastKnownVersion + ", " + lastActivationTime + ", " + pluginId + ", " + supportsTagDeltas + ")");
      }

ServiceTags ret      = null;
int         httpCode = HttpServletResponse.SC_OK;
String      logMsg   = null;
boolean isAllowed = false;
boolean isAdmin = bizUtil.isAdmin();
boolean isKeyAdmin = bizUtil.isKeyAdmin();
      Long downloadedVersion = null;
      String clusterName = null;
if (request != null) {
	clusterName = !StringUtils.isEmpty(request.getParameter(SearchFilter.CLUSTER_NAME)) ? request.getParameter(SearchFilter.CLUSTER_NAME) : "";
}

      try {
      	XXService xService = daoManager.getXXService().findByName(serviceName);
      	if (xService == null) {
              LOG.error("Requested Service not found. serviceName=" + serviceName);
              throw restErrorUtil.createRESTException(HttpServletResponse.SC_NOT_FOUND, "Service:" + serviceName + " not found",
                      false);
          }
      	XXServiceDef xServiceDef = daoManager.getXXServiceDef().getById(xService.getType());
      	RangerService rangerService = svcStore.getServiceByName(serviceName);
      	
      	if (StringUtils.equals(xServiceDef.getImplclassname(), EmbeddedServiceDefsUtil.KMS_IMPL_CLASS_NAME)) {
      		if (isKeyAdmin) {
      			isAllowed = true;
      		}else {
      			isAllowed = bizUtil.isUserAllowed(rangerService, Allowed_User_List_For_Tag_Download);
      		}
      	}else{
      		if (isAdmin) {
      			isAllowed = true;
      		}else{
      			isAllowed = bizUtil.isUserAllowed(rangerService, Allowed_User_List_For_Tag_Download);
      		}
      	}
      	if (isAllowed) {
           ret = tagStore.getServiceTagsIfUpdated(serviceName, lastKnownVersion, !supportsTagDeltas);

		if(ret == null) {
                  downloadedVersion = lastKnownVersion;
			httpCode = HttpServletResponse.SC_NOT_MODIFIED;
			logMsg   = "No change since last update";
		} else {
                  downloadedVersion = ret.getTagVersion();
			httpCode = HttpServletResponse.SC_OK;
			logMsg   = "Returning " + (ret.getTags() != null ? ret.getTags().size() : 0) + " tags. Tag version=" + ret.getTagVersion();
		}
	}else{
		LOG.error("getSecureServiceTagsIfUpdated(" + serviceName + ", " + lastKnownVersion + ", " + lastActivationTime + ") failed as User doesn't have permission to download tags");
		httpCode = HttpServletResponse.SC_UNAUTHORIZED;
		logMsg = "User doesn't have permission to download tags";
	}
      } catch (WebApplicationException webException) {
          httpCode = webException.getResponse().getStatus();
          logMsg = webException.getResponse().getEntity().toString();
      } catch (Exception excp) {
	httpCode = HttpServletResponse.SC_BAD_REQUEST;
	logMsg   = excp.getMessage();
      }  finally {
          assetMgr.createPluginInfo(serviceName, pluginId, request, RangerPluginInfo.ENTITY_TYPE_TAGS, downloadedVersion, lastKnownVersion, lastActivationTime, httpCode, clusterName, pluginCapabilities);
      }

      if(httpCode != HttpServletResponse.SC_OK) {
          boolean logError = httpCode != HttpServletResponse.SC_NOT_MODIFIED;
          throw restErrorUtil.createRESTException(httpCode, logMsg, logError);
      }

      if(LOG.isDebugEnabled()) {
          LOG.debug("<== TagREST.getSecureServiceTagsIfUpdated(" + serviceName + ", " + lastKnownVersion + ", " + lastActivationTime + ", " + pluginId + ", " + supportsTagDeltas + ")");
      }

      return ret;
  }
 
private void doTestBasic(String uri, BasicCredentials credentials,
        boolean useCookie, int expectedRC) throws Exception {

    Map<String,List<String>> reqHeaders = new HashMap<>();
    Map<String,List<String>> respHeaders = new HashMap<>();

    if (useCookie) {
        addCookies(reqHeaders);
    }
    else {
        if (credentials != null) {
            List<String> auth = new ArrayList<>();
            auth.add(credentials.getCredentials());
            reqHeaders.put(CLIENT_AUTH_HEADER, auth);
        }
    }

    ByteChunk bc = new ByteChunk();
    int rc = getUrl(HTTP_PREFIX + getPort() + uri, bc, reqHeaders,
            respHeaders);

    if (expectedRC != HttpServletResponse.SC_OK) {
        Assert.assertEquals(expectedRC, rc);
        Assert.assertTrue(bc.getLength() > 0);
        if (expectedRC == HttpServletResponse.SC_UNAUTHORIZED) {
            // The server should identify the acceptable method(s)
            boolean methodFound = false;
            List<String> authHeaders = respHeaders.get(SERVER_AUTH_HEADER);
            for (String authHeader : authHeaders) {
                if (authHeader.indexOf(NICE_METHOD) > -1) {
                    methodFound = true;
                    break;
                }
            }
            Assert.assertTrue(methodFound);
        }
    }
    else {
        Assert.assertEquals("OK", bc.toString());
        List<String> newCookies = respHeaders.get(SERVER_COOKIE_HEADER);
        if (newCookies != null) {
            // harvest cookies whenever the server sends some new ones
            saveCookies(respHeaders);
        }
    }
}
 
源代码14 项目: ranger   文件: RangerAdminRESTClient.java
@Override
public RangerRole createRole(final RangerRole request) throws Exception {
	if(LOG.isDebugEnabled()) {
		LOG.debug("==> RangerAdminRESTClient.createRole(" + request + ")");
	}

	RangerRole ret = null;

	ClientResponse response = null;
	UserGroupInformation user = MiscUtil.getUGILoginUser();
	boolean isSecureMode = user != null && UserGroupInformation.isSecurityEnabled();
	String relativeURL = RangerRESTUtils.REST_URL_SERVICE_CREATE_ROLE;

	Map <String, String> queryParams = new HashMap<String, String> ();
	queryParams.put(RangerRESTUtils.SERVICE_NAME_PARAM, serviceNameUrlParam);

	if (isSecureMode) {
		PrivilegedAction<ClientResponse> action = new PrivilegedAction<ClientResponse>() {
			public ClientResponse run() {
				ClientResponse clientRes = null;
				try {
					clientRes = restClient.post(relativeURL, queryParams, request);
				} catch (Exception e) {
					LOG.error("Failed to get response, Error is : "+e.getMessage());
				}
				return clientRes;
			}
		};
		if (LOG.isDebugEnabled()) {
			LOG.debug("create role as user " + user);
		}
		response = user.doAs(action);
	} else {
		response = restClient.post(relativeURL, queryParams, request);
	}

	if(response != null && response.getStatus() != HttpServletResponse.SC_OK) {
		RESTResponse resp = RESTResponse.fromClientResponse(response);
		LOG.error("createRole() failed: HTTP status=" + response.getStatus() + ", message=" + resp.getMessage() + ", isSecure=" + isSecureMode + (isSecureMode ? (", user=" + user) : ""));

		if(response.getStatus()==HttpServletResponse.SC_UNAUTHORIZED) {
			throw new AccessControlException();
		}

		throw new Exception("HTTP " + response.getStatus() + " Error: " + resp.getMessage());
	} else if(response == null) {
		throw new Exception("unknown error during createRole. roleName="  + request.getName());
	} else {
		ret = response.getEntity(RangerRole.class);
	}

	if(LOG.isDebugEnabled()) {
		LOG.debug("<== RangerAdminRESTClient.createRole(" + request + ")");
	}
	return ret;
}
 
源代码15 项目: xipki   文件: HealthCheckServlet.java
@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
    throws ServletException, IOException {
  resp.setHeader("Access-Control-Allow-Origin", "*");

  try {
    String caName = null;
    CmpResponder responder = null;

    String path = (String) req.getAttribute(HttpConstants.ATTR_XIPKI_PATH);
    if (path.length() > 1) {
      // skip the first char which is always '/'
      String caAlias = path.substring(1);
      caName = responderManager.getCaNameForAlias(caAlias);
      if (caName == null) {
        caName = caAlias.toLowerCase();
      }
      responder = responderManager.getX509CaResponder(caName);
    }

    if (caName == null || responder == null || !responder.isOnService()) {
      String auditMessage;
      if (caName == null) {
        auditMessage = "no CA is specified";
      } else if (responder == null) {
        auditMessage = "unknown CA '" + caName + "'";
      } else {
        auditMessage = "CA '" + caName + "' is out of service";
      }
      LOG.warn(auditMessage);

      sendError(resp, HttpServletResponse.SC_NOT_FOUND);
      return;
    }

    HealthCheckResult healthResult = responder.healthCheck();
    int status = healthResult.isHealthy()
        ? HttpServletResponse.SC_OK
        : HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    byte[] respBytes = JSON.toJSONBytes(healthResult);
    resp.setStatus(status);
    resp.setContentLength(respBytes.length);
    resp.setContentType(CT_RESPONSE);
    resp.getOutputStream().write(respBytes);
  } catch (Throwable th) {
    if (th instanceof EOFException) {
      LogUtil.warn(LOG, th, "connection reset by peer");
    } else {
      LOG.error("Throwable thrown, this should not happen!", th);
    }
    sendError(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  } finally {
    resp.flushBuffer();
  }
}
 
源代码16 项目: ranger   文件: LdapPolicyMgrUserGroupBuilder.java
private String tryUploadEntityWithCookie(Object obj, String apiURL) {
	if (LOG.isDebugEnabled()) {
		LOG.debug("==> LdapPolicyMgrUserGroupBuilder.tryUploadEntityWithCookie()");
	}
	String response = null;
	ClientResponse clientResp = null;
	try {
		clientResp = ldapUgSyncClient.post(apiURL, null, obj, sessionId);
	}
	catch(Throwable t){
		LOG.error("Failed to get response, Error is : ", t);
	}
	if (clientResp != null) {
		if (!(clientResp.toString().contains(apiURL))) {
			clientResp.setStatus(HttpServletResponse.SC_NOT_FOUND);
			sessionId = null;
			isValidRangerCookie = false;
		} else if (clientResp.getStatus() == HttpServletResponse.SC_UNAUTHORIZED) {
			sessionId = null;
			isValidRangerCookie = false;
		} else if (clientResp.getStatus() == HttpServletResponse.SC_NO_CONTENT || clientResp.getStatus() == HttpServletResponse.SC_OK) {
			List<NewCookie> respCookieList = clientResp.getCookies();
			for (NewCookie cookie : respCookieList) {
				if (cookie.getName().equalsIgnoreCase(rangerCookieName)) {
					if (!(sessionId.getValue().equalsIgnoreCase(cookie.toCookie().getValue()))) {
						sessionId = cookie.toCookie();
					}
					isValidRangerCookie = true;
					break;
				}
			}
		}

		if (clientResp.getStatus() != HttpServletResponse.SC_OK	&& clientResp.getStatus() != HttpServletResponse.SC_NO_CONTENT
				&& clientResp.getStatus() != HttpServletResponse.SC_BAD_REQUEST) {
			sessionId = null;
			isValidRangerCookie = false;
		}
		clientResp.bufferEntity();
		response = clientResp.getEntity(String.class);
	}
	if (LOG.isDebugEnabled()) {
		LOG.debug("<== LdapPolicyMgrUserGroupBuilder.tryUploadEntityWithCookie()");
	}
	return response;
}
 
private void doTest(String method, String uri, BasicCredentials credentials, byte[] body,
        boolean useCookie, int expectedRC, String expectedResponse, String nonce,
        boolean expectCsrfRH, String expectedCsrfRHV) throws Exception {
    Map<String, List<String>> reqHeaders = new HashMap<String, List<String>>();
    Map<String, List<String>> respHeaders = new HashMap<String, List<String>>();

    addNonce(reqHeaders, nonce);

    if (useCookie) {
        addCookies(reqHeaders);
    }

    addCredentials(reqHeaders, credentials);

    ByteChunk bc = new ByteChunk();
    int rc;
    if (METHOD_GET.equals(method)) {
        rc = getUrl(HTTP_PREFIX + getPort() + uri, bc, reqHeaders, respHeaders);
    } else {
        rc = postUrl(body, HTTP_PREFIX + getPort() + uri, bc, reqHeaders, respHeaders);
    }

    assertEquals(expectedRC, rc);

    if (expectedRC == HttpServletResponse.SC_OK) {
        assertEquals(expectedResponse, bc.toString());
        List<String> newCookies = respHeaders.get(SERVER_COOKIE_HEADER);
        saveCookies(newCookies);
    }

    if (!expectCsrfRH) {
        assertNull(respHeaders.get(Constants.CSRF_REST_NONCE_HEADER_NAME));
    } else {
        List<String> respHeaderValue = respHeaders.get(Constants.CSRF_REST_NONCE_HEADER_NAME);
        assertNotNull(respHeaderValue);
        if (expectedCsrfRHV != null) {
            assertTrue(respHeaderValue.contains(expectedCsrfRHV));
        } else {
            validNonce = respHeaderValue.get(0);
        }
    }
}
 
源代码18 项目: vespa   文件: V3MockParsingRequestHandler.java
public V3MockParsingRequestHandler() {
    this("", HttpServletResponse.SC_OK, Scenario.ALL_OK);
}
 
@PostMapping(value = "/public/trackCalorie", 
		produces= {MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.APPLICATION_JSON_VALUE})
@ApiOperation(value="Return all Activities of the user. It also can return Activities of the user on a specific date.", notes="This is a public API", response=List.class)
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Success")
ResponseEntity viewCalorie(@RequestBody CalorieViewTrackingRequest trackCalorieRequest);
 
public ControllerManagementResponse(final ResponseType type, final Object body)
{
    this(type, body, HttpServletResponse.SC_OK, Collections.emptyMap());
}