Beispiel #1
0
  @GET
  @Path("/getLastUpdate")
  @Produces({"text/html"})
  public Response getLatestUpdate(@QueryParam("key") String param1) {
    String LastUpdate = "";
    try {

      LastUpdate =
          (String)
              MyBatis.SessionFactory.Get(
                  "com.dal.ClientMonitorMapper.getLatestRunTime", "lastupdated");
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return Response.status(200).entity(LastUpdate).build();
  }
 @GET
 @Path("/clearMybatisCache")
 @Produces({"application/json"})
 public Response clearCache(@QueryParam("key") String param1) {
   String appkey = Config.Current().Database.AppKey.Value;
   if (param1 == null) {
     return Response.status(200).entity("Please provide the pass key.").build();
   }
   if (param1.equals(appkey)) {
     try {
       MyBatis.SessionFactory.ClearCache();
     } catch (Exception e) {
       log.error("Unable to Clear Cache");
       return Response.status(200).entity("Unable to remove Cache").build();
     }
     Config.ClearConfig();
     return Response.status(200).entity("Removed Cache").build();
   } else {
     return Response.status(200).entity("Invalid Key").build();
   }
 }