- Services encapsulate reusable processes that can be injected into providers such as Servlets. For example, different implementations of Query Suggestions are implement the
twigkit.service.AppkitService
interface and can be injected into the servlet responsible for returning the list of suggestions. - Besides using standard JSP to generate output; Servlets are common way of doing custom HTTP responses with Java. You can deploy standard Java Servlets in Appkit application but in addition to that Appkit provides a convenient framework for developing and deploying servlets for search based applications.
Services
Services can be instantiated programmatically or using the Appkit configuration framework, making them available to other processes or programmatically via theConfiguredServiceProvider
class. To declare a service via the configuration framework, you must add a configuration file named src/main/resources/META-INF/services/TwigKitService
that contains the fully-qualified Java class name of your services, one per line. See the screenshot for an example.

For legacy reasons, the service file must be named
TwigKitService
, with a capital “K”.Servlets and custom output formats
An instance of an AppkitServlet is automatically discovered and deployed by the Appkit application on startup, as long as your class is annotated with the path you would like it published at, implements or extends aAppkitServlet
, and is declared via the Appkit configuration framework. To declare a servlet via the configuration framework, you must add a configuration file named src/main/resources/META-INF/services/TwigKitServlet
that contains the fully-qualified Java class name of your servlets, one per line. See the screenshot for an example.

For legacy reasons, the service file must be named
TwigKitServlet
, with a capital “K”.TwigKitServlet
.
/twigkit/services/custom/excel/
. Using the ServletPath annotation will guarantee that the HTTP Request/Response is correctly filtered by Appkit for example, for security and URL mapping.