src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java

changeset 73
672b5003cafe
parent 71
dca186d3911f
child 74
91d1fc2a3a14
equal deleted inserted replaced
72:0646c14e36fb 73:672b5003cafe
38 import javax.servlet.http.HttpServletRequest; 38 import javax.servlet.http.HttpServletRequest;
39 import javax.servlet.http.HttpServletResponse; 39 import javax.servlet.http.HttpServletResponse;
40 import javax.servlet.http.HttpSession; 40 import javax.servlet.http.HttpSession;
41 import java.io.IOException; 41 import java.io.IOException;
42 import java.lang.reflect.Constructor; 42 import java.lang.reflect.Constructor;
43 import java.lang.reflect.InvocationTargetException;
43 import java.lang.reflect.Method; 44 import java.lang.reflect.Method;
44 import java.lang.reflect.Modifier; 45 import java.lang.reflect.Modifier;
45 import java.sql.Connection; 46 import java.sql.Connection;
46 import java.sql.SQLException; 47 import java.sql.SQLException;
47 import java.util.*; 48 import java.util.*;
130 if (paramTypes[i].isAssignableFrom(DataAccessObjects.class)) { 131 if (paramTypes[i].isAssignableFrom(DataAccessObjects.class)) {
131 paramValues[i] = dao; 132 paramValues[i] = dao;
132 } 133 }
133 } 134 }
134 return (ResponseType) method.invoke(this, paramValues); 135 return (ResponseType) method.invoke(this, paramValues);
136 } catch (InvocationTargetException ex) {
137 LOG.error("invocation of method {}::{} failed: {}",
138 method.getDeclaringClass().getName(), method.getName(), ex.getTargetException().getMessage());
139 LOG.debug("Details: ", ex.getTargetException());
140 resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getTargetException().getMessage());
141 return ResponseType.NONE;
135 } catch (ReflectiveOperationException | ClassCastException ex) { 142 } catch (ReflectiveOperationException | ClassCastException ex) {
136 LOG.error("invocation of method {} failed: {}", method.getName(), ex.getMessage()); 143 LOG.error("invocation of method {}::{} failed: {}",
144 method.getDeclaringClass().getName(), method.getName(), ex.getMessage());
137 LOG.debug("Details: ", ex); 145 LOG.debug("Details: ", ex);
138 resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 146 resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getMessage());
139 return ResponseType.NONE; 147 return ResponseType.NONE;
140 } 148 }
141 } 149 }
142 150
143 @Override 151 @Override

mercurial