Package org.springframework.http

Examples of org.springframework.http.HttpStatus


  // check if error is caused by wrong credentials
  public static boolean isWrongCredentialsException(CoreException e) {
    Throwable cause = e.getCause();
    if (cause instanceof HttpClientErrorException) {
      HttpClientErrorException httpException = (HttpClientErrorException) cause;
      HttpStatus statusCode = httpException.getStatusCode();
      if (statusCode.equals(HttpStatus.FORBIDDEN) && httpException instanceof CloudFoundryException) {
        return ((CloudFoundryException) httpException).getDescription().equals("Operation not permitted"); //$NON-NLS-1$
      }
    }
    return false;
  }
View Full Code Here


   * returns null.
   */
  public static HttpClientErrorException getBadRequestException(Exception t) {
    HttpClientErrorException httpException = getHttpClientError(t);
    if (httpException != null) {
      HttpStatus statusCode = httpException.getStatusCode();
      if (HttpStatus.BAD_REQUEST.equals(statusCode)) {
        return httpException;
      }
    }
    return null;
View Full Code Here

  public static boolean isHttpException(Throwable t, HttpStatus status) {

    HttpClientErrorException httpException = getHttpClientError(t);

    if (httpException != null) {
      HttpStatus statusCode = httpException.getStatusCode();
      return statusCode.equals(status);
    }

    return false;
  }
View Full Code Here

    Map<String, Object> multipartMap = new HashMap<String, Object>();
    multipartMap.put("company", new String[]{"SpringSource", "VMWare"});
    multipartMap.put("company-logo", s2logo);
    logger.info("Created multipart request: " + multipartMap);
    MultipartRequestGateway requestGateway = context.getBean("requestGateway", MultipartRequestGateway.class);
    HttpStatus reply = requestGateway.postMultipartRequest(multipartMap);
    System.out.println("Replied with HttpStatus code: " + reply);
  }
View Full Code Here

  protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {

    response.setContentType("application/jrd+json");


    HttpStatus code = (HttpStatus) model.get("code");
    if (code == null) {
      code = HttpStatus.OK; // default to 200
    }

    response.setStatus(code.value());

    try {

      String resource = (String)model.get("resource");
      String issuer = (String)model.get("issuer");
View Full Code Here

  protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {

    response.setContentType("application/json");


    HttpStatus code = (HttpStatus) model.get("code");
    if (code == null) {
      code = HttpStatus.OK; // default to 200
    }

    response.setStatus(code.value());

    try {

      Writer out = response.getWriter();
      Object obj = model.get("entity");
View Full Code Here

  public static final String VIEWNAME = "httpCodeView";
 
  @Override
  protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
    HttpStatus code = (HttpStatus) model.get("code");
    if (code == null) {
      code = HttpStatus.OK; // default to 200
    }

    response.setStatus(code.value());

  }
View Full Code Here

  protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {

    response.setContentType("application/json");


    HttpStatus code = (HttpStatus) model.get("code");
    if (code == null) {
      code = HttpStatus.OK; // default to 200
    }

    response.setStatus(code.value());

    try {

      Writer out = response.getWriter();
      Object obj = model.get("entity");
View Full Code Here

  protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {

    response.setContentType("application/json");


    HttpStatus code = (HttpStatus) model.get("code");
    if (code == null) {
      code = HttpStatus.OK; // default to 200
    }

    response.setStatus(code.value());

    try {

      Writer out = response.getWriter();
      Object obj = model.get("entity");
View Full Code Here

    RegisteredClient c = (RegisteredClient) model.get("client");
    //OAuth2AccessTokenEntity token = (OAuth2AccessTokenEntity) model.get("token");
    //String uri = (String)model.get("uri"); //request.getRequestURL() + "/" + c.getClientId();

    HttpStatus code = (HttpStatus) model.get("code");
    if (code == null) {
      code = HttpStatus.OK;
    }

    JsonObject o = ClientDetailsEntityJsonProcessor.serialize(c);
View Full Code Here

TOP

Related Classes of org.springframework.http.HttpStatus

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.