Class JsonToFileServlet

java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
edu.sc.seis.sod.web.JsonToFileServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
MeasurementTextServlet, MeasurementToolServlet, PerusalServlet, QuakeStationMeasurementsServlet

public abstract class JsonToFileServlet
extends javax.servlet.http.HttpServlet
See Also:
Serialized Form
  • Constructor Summary

    Constructors 
    Constructor Description
    JsonToFileServlet​(java.lang.String baseUrl, java.io.File baseDir, java.lang.String jsonType)  
  • Method Summary

    Modifier and Type Method Description
    protected org.json.JSONObject createEmpty​(java.lang.String id)  
    protected void doDelete​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
    protected void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
    protected void doPatch​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
    protected void doPost​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
    protected void doPut​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
    protected java.util.List<java.lang.String> getAllJsonIds()  
    protected org.json.JSONObject load​(java.lang.String id)  
    protected void save​(java.lang.String id, org.json.JSONObject inJson)  
    protected void service​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
    protected void updateAfterLoad​(org.json.JSONObject p)  
    protected void updateBeforeSave​(org.json.JSONObject p)  

    Methods inherited from class javax.servlet.http.HttpServlet

    doHead, doOptions, doTrace, getLastModified, service

    Methods inherited from class javax.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JsonToFileServlet

      public JsonToFileServlet​(java.lang.String baseUrl, java.io.File baseDir, java.lang.String jsonType)
  • Method Details

    • doGet

      protected void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
      Overrides:
      doGet in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      java.io.IOException
    • doPost

      protected void doPost​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
      Overrides:
      doPost in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      java.io.IOException
    • doPut

      protected void doPut​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
      Overrides:
      doPut in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      java.io.IOException
    • doPatch

      protected void doPatch​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
      Throws:
      javax.servlet.ServletException
      java.io.IOException
    • doDelete

      protected void doDelete​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
      Overrides:
      doDelete in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      java.io.IOException
    • service

      protected void service​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
      Overrides:
      service in class javax.servlet.http.HttpServlet
      Throws:
      javax.servlet.ServletException
      java.io.IOException
    • getAllJsonIds

      protected java.util.List<java.lang.String> getAllJsonIds()
    • save

      protected void save​(java.lang.String id, org.json.JSONObject inJson) throws java.io.IOException
      Throws:
      java.io.IOException
    • load

      protected org.json.JSONObject load​(java.lang.String id) throws java.io.IOException
      Throws:
      java.io.IOException
    • createEmpty

      protected org.json.JSONObject createEmpty​(java.lang.String id) throws java.io.FileNotFoundException
      Throws:
      java.io.FileNotFoundException
    • updateBeforeSave

      protected void updateBeforeSave​(org.json.JSONObject p) throws java.io.IOException
      Throws:
      java.io.IOException
    • updateAfterLoad

      protected void updateAfterLoad​(org.json.JSONObject p) throws java.io.IOException
      Throws:
      java.io.IOException