Package com.google.greaze.definition

Examples of com.google.greaze.definition.ErrorReason


      // read response
      HeaderMap responseParams = readResponseHeaders(conn, paramSpec);
      R responseBody = readResponseBody(conn, bodyType);
      return new RestResponseBase<I, R>(getSpec(), responseParams, responseBody);
    } catch (IOException e) {
      ErrorReason reason = ErrorReason.fromValue(conn, e);
      throw new WebServiceSystemException(reason, e);
    }
  }
View Full Code Here


        } else {
          throw new WebServiceSystemException(ErrorReason.SERVER_UNAVAILABLE, e);
        }
      }
    } catch (WebServiceSystemException e) {
      ErrorReason reason = e.getReason();
      String reasonStr = reason.toString();
      log.log(Level.WARNING, reasonStr, e);
      res.setHeader(ErrorReason.HTTP_RESPONSE_HEADER_NAME, reasonStr);
      res.sendError(reason.getResponseCode(), e.getLocalizedMessage());
    }
  }
View Full Code Here

  protected void handleResponseCode(HttpURLConnection conn) throws WebServiceSystemException, IOException {
    // First check response code
    int responseCode = conn.getResponseCode();
    String errorReason = conn.getHeaderField(ErrorReason.HTTP_RESPONSE_HEADER_NAME);
    if (responseCode >= 400 || GreazeStrings.isNotEmpty(errorReason)) {
      ErrorReason reason = GreazeStrings.isEmpty(errorReason)
          ? ErrorReason.fromHttpResponseCode(responseCode)
              : ErrorReason.valueOf(errorReason);
      String msg = Streams.readAsString(conn.getInputStream());
      throw new WebServiceSystemException(reason, "Server input: " + msg);
    }
View Full Code Here

TOP

Related Classes of com.google.greaze.definition.ErrorReason

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.