示例#1
0
  public static Result record() {
    try {
      /*String user = session("connected");
      if(user == null) {
      	  return unauthorized("Oops, you are not connected");
        }else{System.out.println("authorized "+user );}
      */
      BasicDBObject res = new BasicDBObject();
      JsonNode json = request().body().asJson();
      response().setContentType("application/json");
      if (json == null) {
        return badRequest("Expecting Json data");
      } else {
        String recid = json.findPath("recid").getTextValue();
        if (recid == null) {
          return notFound();
        } else if (recid != null) {
          SearchServiceAccess acc = new SearchServiceAccess();
          res = acc.searchEuropeanaRecord(recid);
        }

        return ok(com.mongodb.util.JSON.serialize(res));
      }
    } catch (Exception ex) {
      System.out.println(ex.getMessage());
      response().setContentType("application/json");
      return internalServerError(Messages.get("apperror"));
    }
  }