use get method to submit ticket

This commit is contained in:
Sola
2015-12-10 15:57:18 +08:00
parent 82ae5b047d
commit 2c121cf353
3 changed files with 5 additions and 19 deletions

View File

@@ -1,10 +0,0 @@
package love.sola.netsupport.api;
/**
* ***********************************************
* Created by Sola on 2015/12/6.
* Don't modify this source without my agreement
* ***********************************************
*/
public class TicketCancel {
}

View File

@@ -5,7 +5,6 @@ import love.sola.netsupport.pojo.Ticket;
import love.sola.netsupport.pojo.User;
import love.sola.netsupport.sql.SQLCore;
import love.sola.netsupport.util.JsonP;
import love.sola.netsupport.util.Redirect;
import love.sola.netsupport.wechat.Command;
import org.hibernate.HibernateException;
import org.hibernate.Session;
@@ -32,6 +31,10 @@ public class TicketSubmit extends HttpServlet {
private Gson gson = SQLCore.gson;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.addHeader("Content-type", "text/json;charset=utf-8");
@@ -41,13 +44,6 @@ public class TicketSubmit extends HttpServlet {
out.close();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.addHeader("Content-type", "text/plain;charset=utf-8");
Redirect.message(response, -1, "Illegal_Request");
}
private Response submit(HttpServletRequest request) {
try (Session s = SQLCore.sf.openSession()) {
if (request.getSession() == null || request.getSession().getAttribute("authorized") != Command.SUBMIT) {

View File

@@ -27,7 +27,7 @@ public enum Command {
static {
for (Command type : values()) {
if (type.id > 0) {
if (type.id >= 0) {
ID_MAP.put(type.id, type);
}
}