Top Description Fields Constructors Methods
org.eclipse.jgit.http.server.glue

public Class MetaServlet

extends HttpServlet
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.http.server.GitServlet
Static Imports
jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND

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.

Field Summary

Modifier and TypeField and Description
private final MetaFilter
private static final long
Inherited from jakarta.servlet.http.HttpServlet:
LEGACY_DO_HEAD

Constructor Summary

AccessConstructor and Description
public
MetaServlet()

Empty servlet with no bindings.

protected
MetaServlet(MetaFilter
the filter being wrapped by the servlet.
delegateFilter
)

Initialize a servlet wrapping a filter.

Method Summary

Modifier and TypeMethod and Description
public void
destroy()

Overrides jakarta.servlet.GenericServlet.destroy.

Implements jakarta.servlet.Servlet.destroy.

Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.

protected MetaFilter

Returns:

filter this servlet delegates all routing logic to.
getDelegateFilter
()

Get delegate filter

public void
init(ServletConfig
the ServletConfig object that contains configuration information for this servlet
config
)

Overrides jakarta.servlet.http.HttpServlet.init.

Implements jakarta.servlet.Servlet.init.

Called by the servlet container to indicate to a servlet that the servlet is being placed into service.

protected ServletBinder

Returns:

binder for the caller, potentially after adding one or more filters into the pipeline.
register
(ServletBinder
the newly created binder.
b
)

Configure a newly created binder.

public ServletBinder

Returns:

binder for the passed path.
serve
(String
pattern to match.
path
)

Construct a binding for a specific path.

public ServletBinder

Returns:

binder for the passed expression.
serveRegex
(String
the regular expression to pattern match the URL against.
expression
)

Construct a binding for a regular expression.

protected void
service(HttpServletRequest
the HttpServletRequest object that contains the request the client made of the servlet
req
,
HttpServletResponse
the HttpServletResponse object that contains the response the servlet returns to the client
res
)

Overrides jakarta.servlet.http.HttpServlet.service.

Receives standard HTTP requests from the public service method and dispatches them to the doXXX methods defined in this class.

Inherited from jakarta.servlet.http.HttpServlet:
doDeletedoGetdoHeaddoOptionsdoPatchdoPostdoPutdoTracegetLastModifiedisSensitiveHeaderservice

Field Detail

filterback to summary
private final MetaFilter filter
serialVersionUIDback to summary
private static final long serialVersionUID

Hides jakarta.servlet.http.HttpServlet.serialVersionUID.

Constructor Detail

MetaServletback to summary
public MetaServlet()

Empty servlet with no bindings.

MetaServletback to summary
protected MetaServlet(MetaFilter delegateFilter)

Initialize a servlet wrapping a filter.

Parameters
delegateFilter:MetaFilter

the filter being wrapped by the servlet.

Method Detail

destroyback to summary
public void destroy()

Overrides jakarta.servlet.GenericServlet.destroy.

Implements jakarta.servlet.Servlet.destroy.

Doc from jakarta.servlet.GenericServlet.destroy.

Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. See Servlet#destroy.

Annotations
@Override
getDelegateFilterback to summary
protected MetaFilter getDelegateFilter()

Get delegate filter

Returns:MetaFilter

filter this servlet delegates all routing logic to.

initback to summary
public void init(ServletConfig config) throws ServletException

Overrides jakarta.servlet.http.HttpServlet.init.

Implements jakarta.servlet.Servlet.init.

Doc from jakarta.servlet.GenericServlet.init.

Called by the servlet container to indicate to a servlet that the servlet is being placed into service. See Servlet#init.

This implementation stores the ServletConfig object it receives from the servlet container for later use. When overriding this form of the method, call super.init(config).

Parameters
config:ServletConfig

the ServletConfig object that contains configuration information for this servlet

Annotations
@Override
Exceptions
ServletException:
if an exception occurs that interrupts the servlet's normal operation
registerback to summary
protected ServletBinder register(ServletBinder b)

Configure a newly created binder.

Parameters
b:ServletBinder

the newly created binder.

Returns:ServletBinder

binder for the caller, potentially after adding one or more filters into the pipeline.

serveback to summary
public ServletBinder serve(String path)

Construct a binding for a specific path.

Parameters
path:String

pattern to match.

Returns:ServletBinder

binder for the passed path.

serveRegexback to summary
public ServletBinder serveRegex(String expression)

Construct a binding for a regular expression.

Parameters
expression:String

the regular expression to pattern match the URL against.

Returns:ServletBinder

binder for the passed expression.

serviceback to summary
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException

Overrides jakarta.servlet.http.HttpServlet.service.

Doc from jakarta.servlet.http.HttpServlet.service.

Receives standard HTTP requests from the public service method and dispatches them to the doXXX methods defined in this class. This method is an HTTP-specific version of the jakarta.servlet.Servlet#service method. There's no need to override this method.

Parameters
req:HttpServletRequest

the HttpServletRequest object that contains the request the client made of the servlet

res:HttpServletResponse

the HttpServletResponse object that contains the response the servlet returns to the client

Annotations
@Override
Exceptions
ServletException:
if the HTTP request cannot be handled
IOException:
if an input or output error occurs while the servlet is handling the HTTP request