gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org / gvsig / vcsgis / server / lib / VCSGisRowCreateServlet.java @ 2733
History | View | Annotate | Download (2.09 KB)
1 |
/*
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2020 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
18 |
*
|
19 |
* For any additional information, do not hesitate to contact us
|
20 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
21 |
*/
|
22 |
package org.gvsig.vcsgis.server.lib; |
23 |
|
24 |
/**
|
25 |
*
|
26 |
* @author gvSIG Team
|
27 |
*/
|
28 |
import java.io.IOException; |
29 |
import java.io.InputStream; |
30 |
import javax.servlet.http.HttpServletRequest; |
31 |
import javax.servlet.http.HttpServletResponse; |
32 |
import org.apache.commons.io.IOUtils; |
33 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
34 |
import org.gvsig.vcsgis.lib.server.VCSGisServerHandler; |
35 |
|
36 |
|
37 |
public class VCSGisRowCreateServlet extends VCSGisServlet { |
38 |
|
39 |
@Override
|
40 |
protected void doPost(HttpServletRequest request, |
41 |
HttpServletResponse response) throws IOException { |
42 |
try {
|
43 |
VCSGisServerController vcsgisserver = this.createVCSGisServerController();
|
44 |
VCSGisServerHandler handler = vcsgisserver.createRowCreateHandler(); |
45 |
|
46 |
InputStream response_stream = handler.handle(request.getInputStream());
|
47 |
|
48 |
IOUtils.copy(response_stream, response.getWriter()); |
49 |
|
50 |
// vcsgisserver.dispose();
|
51 |
|
52 |
response.setStatus(HttpServletResponse.SC_OK); |
53 |
response.setContentType("application/json");
|
54 |
response.setCharacterEncoding("utf-8");
|
55 |
} catch (Exception ex) { |
56 |
throw new IOException(ex); |
57 |
} |
58 |
} |
59 |
} |