commit | author | age
|
05b5c0
|
1 |
/* |
U |
2 |
WebBox - Dein Server. |
|
3 |
Copyright (C) 2017 Ulrich Hilger, http://uhilger.de |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 of the |
|
8 |
License, or (at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
package de.uhilger.wbx.web; |
|
19 |
|
5bfcdd
|
20 |
import java.io.IOException; |
U |
21 |
import javax.servlet.ServletException; |
94a2d9
|
22 |
import javax.servlet.ServletOutputStream; |
5bfcdd
|
23 |
import javax.servlet.http.HttpServletRequest; |
U |
24 |
import javax.servlet.http.HttpServletResponse; |
94a2d9
|
25 |
import org.markdownj.MarkdownProcessor; |
05b5c0
|
26 |
|
U |
27 |
/** |
|
28 |
* |
|
29 |
* @author ulrich |
|
30 |
*/ |
5bfcdd
|
31 |
public class MarkdownServlet extends WbxServlet { |
U |
32 |
|
|
33 |
|
|
34 |
@Override |
94a2d9
|
35 |
protected void seiteAusgeben(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { |
5bfcdd
|
36 |
|
94a2d9
|
37 |
CustomResponseWrapper wrapper = new CustomResponseWrapper(response); |
U |
38 |
super.doGet(request, wrapper); |
|
39 |
String responseContent = wrapper.getResponseContent(); |
|
40 |
ServletOutputStream out = response.getOutputStream(); |
|
41 |
MarkdownProcessor p = new MarkdownProcessor(); |
|
42 |
out.print(p.markdown(responseContent)); |
5bfcdd
|
43 |
} |
05b5c0
|
44 |
|
U |
45 |
} |