MCPcopy Index your code
hub / github.com/HTTP-RPC/Kilo / init

Method init

kilo-server/src/main/java/org/httprpc/kilo/PageServlet.java:44–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42 private static final ThreadLocal<HttpServletResponse> response = new ThreadLocal<>();
43
44 @Override
45 public void init() throws ServletException {
46 var fields = getClass().getDeclaredFields();
47
48 for (var i = 0; i < fields.length; i++) {
49 var field = fields[i];
50
51 var fieldType = field.getType();
52
53 if (WebService.class.isAssignableFrom(fieldType) && field.getAnnotation(WebService.Instance.class) != null) {
54 field.setAccessible(true);
55
56 try {
57 field.set(this, WebService.instances.get(fieldType));
58 } catch (IllegalAccessException exception) {
59 throw new UnsupportedOperationException(exception);
60 }
61 }
62 }
63 }
64
65 @Override
66 protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

Callers

nothing calls this directly

Calls 3

setMethod · 0.80
getTypeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected