source: other-projects/the-macronizer/trunk/src/java/web/servlets/OutputType.java@ 35720

Last change on this file since 35720 was 35719, checked in by cstephen, 2 years ago

Add support for JSON response to direct input queries. Cleanup other components.

File size: 689 bytes
Line 
1package web.servlets;
2
3/**
4 * Defines the valid output types for a servlet response.
5 */
6public enum OutputType
7{
8 /**
9 * The response is redirected to a JSP page, with data set as attributes on the forwarded request.
10 */
11 JspRedirect,
12
13 /**
14 * The response is returned as a JSON string containing the serialized data.
15 */
16 Json;
17
18 public static OutputType parse(String input)
19 {
20 if (input == null)
21 {
22 return OutputType.JspRedirect;
23 }
24
25 switch (input)
26 {
27 case "json":
28 return OutputType.Json;
29 default:
30 return OutputType.JspRedirect;
31 }
32 }
33}
Note: See TracBrowser for help on using the repository browser.