1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package com.jmpeax.osgi.undertow.http.impl;
19
20 import org.osgi.service.http.HttpContext;
21 import org.osgi.service.http.HttpService;
22 import org.osgi.service.http.NamespaceException;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25
26 import javax.servlet.Servlet;
27 import javax.servlet.ServletException;
28 import java.util.Dictionary;
29
30
31
32
33
34
35
36 public class UndertowHttpService implements HttpService {
37
38 private UndertowHttpServer httpServer;
39
40 private Logger log = LoggerFactory.getLogger(UndertowHttpService.class);
41
42 public UndertowHttpService(UndertowHttpServer httpServer) {
43 this.httpServer = httpServer;
44 }
45
46 @Override
47 public void registerServlet(final String alias, final Servlet servlet, final Dictionary initparams, final HttpContext context) throws ServletException, NamespaceException {
48 log.debug("Registering {} with servlet {} properties {} and context {}", alias, servlet, initparams, context);
49 httpServer.addServletHandler(alias, servlet, initparams);
50 }
51
52 @Override
53 public void registerResources(final String alias, final String name, final HttpContext context) throws NamespaceException {
54
55 }
56
57 @Override
58 public void unregister(final String alias) {
59 httpServer.removeHandler(alias);
60 }
61
62 @Override
63 public HttpContext createDefaultHttpContext() {
64 return null;
65 }
66 }