Created
February 26, 2014 15:16
-
-
Save syst3mw0rm/9231312 to your computer and use it in GitHub Desktop.
example to share code among servlets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Servlet1 extends HttpServlet { | |
public void init() { | |
doHeavyProcessing(); | |
} | |
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { | |
parseRequest(); | |
calculateResponse(); | |
Servlet1CustomCode(); | |
sendResponse(); | |
} | |
private void doHeavyProcessing() { | |
} | |
private void Servlet1CustomCode() { | |
} | |
private void sendResponse() { | |
} | |
private void calculateResponse() { | |
} | |
private void parseRequest() { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Servlet2 extends HttpServlet { | |
public void init() { | |
doHeavyProcessing(); | |
} | |
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { | |
parseRequest(); | |
calculateResponse(); | |
Servlet2CustomCode(); | |
sendResponse(); | |
} | |
private void doHeavyProcessing() { | |
} | |
private void Servlet2CustomCode() { | |
} | |
private void sendResponse() { | |
} | |
private void calculateResponse() { | |
} | |
private void parseRequest() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment