Package com.google.greaze.definition

Examples of com.google.greaze.definition.WebServiceSystemException


      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


        Streams.copy(requestBodyContents, conn.getOutputStream(), false);
      }
      // Initiate the sending of the request.
      conn.connect();
    } catch (SocketException e) {
      throw new WebServiceSystemException(e);
    } catch (IOException e) {
      throw new WebServiceSystemException(e);
    }
  }
View Full Code Here

      requestSender.send(conn, request);
      RestResponseBaseReceiver<I, R> responseReceiver =
        new RestResponseBaseReceiver<I, R>(gson, callSpec.getResponseSpec());
      return responseReceiver.receive(conn);
    } catch (IllegalArgumentException e) {
      throw new WebServiceSystemException(e);
    }
  }
View Full Code Here

  private void addStringParam(String paramName, String value) {
    String paramValue = stripQuotesIfString(value);
    try {
      map.put(paramName, URLEncoder.encode(paramValue, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
      throw new WebServiceSystemException(ErrorReason.UNEXPECTED_PERMANENT_ERROR, e);
    }
  }
View Full Code Here

      String urlParamString = new UrlParamStringBuilder(gson)
        .add(request.getUrlParameters())
        .build();
      return new URL(baseUrl + urlParamString);
    } catch (MalformedURLException e) {
      throw new WebServiceSystemException(e);
    }
  }
View Full Code Here

      RequestSender requestSender = new RequestSender(gson);
      requestSender.send(conn, request);
      ResponseReceiver responseReceiver = new ResponseReceiver(gson, callSpec.getResponseSpec());
      return responseReceiver.receive(conn);
    } catch (NullPointerException e) {
      throw new WebServiceSystemException(e);
    } catch (IllegalArgumentException e) {
      throw new WebServiceSystemException(e);
    } finally {
      closeIgnoringErrors(conn);
    }
  }
View Full Code Here

  protected HttpURLConnection openConnection(URL url) {
    try {
      return (HttpURLConnection) url.openConnection();
    } catch (IOException e) {
      throw new WebServiceSystemException(e);
    }
  }
View Full Code Here

  public boolean service(HttpServletRequest req, HttpServletResponse res)
      throws WebServiceSystemException {
    try {
      CallPath callPath = injector.getInstance(CallPath.class);
      if (callPath.equals(CallPath.NULL_PATH)) {
        throw new WebServiceSystemException(
            ErrorReason.INVALID_CALLPATH, req.getServletPath());
      }
      String queryName = RequestType.getQueryName(req.getParameterMap());
      RequestType requestType = RequestType.getRequestType(callPath, queryName, resourcePrefix);
      if (LogConfig.INFO) log.info(String.format("%s: %s", requestType, callPath));
      switch (requestType) {
        case RESOURCE_ACCESS:
          injector.getInstance(ResourceDepotDispatcher.class).service(res);
          break;
        case RESOURCE_QUERY:
          injector.getInstance(ResourceQueryDispatcher.class).service(req, res, queryName, callPath);
          break;
        case WEBSERVICE:
          injector.getInstance(WebServiceDispatcher.class).service(req, res);
          break;
        default:
          throw new UnsupportedOperationException();
      }
      return false;
    } catch (IllegalArgumentException e) {
      throw new WebServiceSystemException(e);
    } catch (NullPointerException e) {
      throw new WebServiceSystemException(e);
    }
  }
View Full Code Here

        }
      } catch (Exception e) {
        if (e instanceof WebServiceSystemException) {
          throw (WebServiceSystemException) e;
        } else {
          throw new WebServiceSystemException(ErrorReason.SERVER_UNAVAILABLE, e);
        }
      }
    } catch (WebServiceSystemException e) {
      ErrorReason reason = e.getReason();
      String reasonStr = reason.toString();
View Full Code Here

      // read response
      HeaderMap responseParams = readResponseHeaders(conn, paramSpec);
      ResponseBody responseBody = readResponseBody(conn, bodySpec);
      return new WebServiceResponse(responseParams, responseBody);
    } catch (IOException e) {
      throw new WebServiceSystemException(e);
    }
  }
View Full Code Here

TOP

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

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.