コード例 #1
0
  public static File requestFileFromExternalService(String fileURL, String modelName)
      throws MalformedURLException, IOException {

    OurBricksGateway gate = new OurBricksURLGateway();

    return gate.getBrickFile(new URL(fileURL), modelName);
  }
コード例 #2
0
  protected OurBricksList requestDataFromExternalService(String query, Integer next)
      throws MalformedURLException, IOException {

    OurBricksList bricksList;
    URL searchURL;
    if (query == null && next == null) {
      searchURL = new URL("http://ourbricks.com/api/search?limit=" + SEARCH_LIMIT);
    } else if (query == null && next != null) {
      searchURL =
          new URL("http://ourbricks.com/api/search?&start=" + next + "&limit=" + SEARCH_LIMIT);
    } else if (query != null && next == null) {
      searchURL = new URL("http://ourbricks.com/api/search?q=" + query + "&limit=" + SEARCH_LIMIT);
    } else {
      searchURL =
          new URL(
              "http://ourbricks.com/api/search?q="
                  + query
                  + "&start="
                  + next
                  + "&limit="
                  + SEARCH_LIMIT);
    }

    System.out.println("Search URL is: " + searchURL);
    bricksList = gate.getBricksList(searchURL);

    return bricksList;
  }