Class MetaServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.eclipse.jgit.http.server.glue.MetaServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
- Direct Known Subclasses:
GitServlet
public class MetaServlet
extends jakarta.servlet.http.HttpServlet
Generic container servlet to manage routing to different pipelines.
Callers can create and configure a new processing pipeline by using one of
the serve(String)
or serveRegex(String)
methods to allocate
a binder for a particular URL pattern.
Registered filters and servlets are initialized lazily, usually during the first request. Once initialized the bindings in this servlet cannot be modified without destroying the servlet and thereby destroying all registered filters and servlets.
- See Also:
-
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD
-
Constructor Summary
ConstructorsModifierConstructorDescriptionEmpty servlet with no bindings.protected
MetaServlet
(MetaFilter delegateFilter) Initialize a servlet wrapping a filter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
protected MetaFilter
Get delegate filtervoid
init
(jakarta.servlet.ServletConfig config) protected ServletBinder
Configure a newly created binder.Construct a binding for a specific path.serveRegex
(String expression) Construct a binding for a regular expression.protected void
service
(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, service
Methods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
MetaServlet
public MetaServlet()Empty servlet with no bindings. -
MetaServlet
Initialize a servlet wrapping a filter.- Parameters:
delegateFilter
- the filter being wrapped by the servlet.
-
-
Method Details
-
getDelegateFilter
Get delegate filter- Returns:
- filter this servlet delegates all routing logic to.
-
serve
Construct a binding for a specific path.- Parameters:
path
- pattern to match.- Returns:
- binder for the passed path.
-
serveRegex
Construct a binding for a regular expression.- Parameters:
expression
- the regular expression to pattern match the URL against.- Returns:
- binder for the passed expression.
-
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
init
in interfacejakarta.servlet.Servlet
- Overrides:
init
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Servlet
- Overrides:
destroy
in classjakarta.servlet.GenericServlet
-
service
protected void service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws jakarta.servlet.ServletException, IOException - Overrides:
service
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
IOException
-
register
Configure a newly created binder.- Parameters:
b
- the newly created binder.- Returns:
- binder for the caller, potentially after adding one or more filters into the pipeline.
-