Class UrlPipeline
- java.lang.Object
-
- org.eclipse.jgit.http.server.glue.UrlPipeline
-
- Direct Known Subclasses:
RegexPipeline
,SuffixPipeline
abstract class UrlPipeline extends java.lang.Object
Encapsulates the entire serving stack for a single URL.Subclasses provide the implementation of
match(HttpServletRequest)
, which is called byMetaServlet
in registration order to determine the pipeline that will be used to handle a request.The very bottom of each pipeline is a single
HttpServlet
that will handle producing the response for this pipeline's URL.Filter
s may also be registered and applied around the servlet's processing, to manage request attributes, set standard response headers, or completely override the response generation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
UrlPipeline.Chain
-
Constructor Summary
Constructors Constructor Description UrlPipeline(javax.servlet.Filter[] filters, javax.servlet.http.HttpServlet servlet)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) void
destroy(java.util.Set<java.lang.Object> destroyed)
Destroy all contained filters and servlets.private static void
destroyFilter(javax.servlet.Filter ref, java.util.Set<java.lang.Object> destroyed)
private static void
destroyServlet(javax.servlet.http.HttpServlet ref, java.util.Set<java.lang.Object> destroyed)
(package private) void
init(javax.servlet.ServletContext context, java.util.Set<java.lang.Object> inited)
Initialize all contained filters and servlets.private static void
initFilter(javax.servlet.Filter ref, javax.servlet.ServletContext context, java.util.Set<java.lang.Object> inited)
private static void
initServlet(javax.servlet.http.HttpServlet ref, javax.servlet.ServletContext context, java.util.Set<java.lang.Object> inited)
(package private) abstract boolean
match(javax.servlet.http.HttpServletRequest req)
Determine if this pipeline handles the request's URL.(package private) void
service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp)
Execute the filters and the servlet on the request.
-
-
-
Field Detail
-
filters
private final javax.servlet.Filter[] filters
Filters to apply aroundservlet
; may be empty but never null.
-
servlet
private final javax.servlet.http.HttpServlet servlet
Instance that must generate the response; never null.
-
-
Method Detail
-
init
void init(javax.servlet.ServletContext context, java.util.Set<java.lang.Object> inited) throws javax.servlet.ServletException
Initialize all contained filters and servlets.- Parameters:
context
- the servlet container context ourMetaServlet
is running within.inited
- (input/output) the set of filters and servlets which have already been initialized within the container context. If those same instances appear in this pipeline they are not initialized a second time. Filters and servlets that are first initialized by this pipeline will be added to this set.- Throws:
javax.servlet.ServletException
- a filter or servlet is unable to initialize.
-
initFilter
private static void initFilter(javax.servlet.Filter ref, javax.servlet.ServletContext context, java.util.Set<java.lang.Object> inited) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
-
initServlet
private static void initServlet(javax.servlet.http.HttpServlet ref, javax.servlet.ServletContext context, java.util.Set<java.lang.Object> inited) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
-
destroy
void destroy(java.util.Set<java.lang.Object> destroyed)
Destroy all contained filters and servlets.- Parameters:
destroyed
- (input/output) the set of filters and servlets which have already been destroyed within the container context. If those same instances appear in this pipeline they are not destroyed a second time. Filters and servlets that are first destroyed by this pipeline will be added to this set.
-
destroyFilter
private static void destroyFilter(javax.servlet.Filter ref, java.util.Set<java.lang.Object> destroyed)
-
destroyServlet
private static void destroyServlet(javax.servlet.http.HttpServlet ref, java.util.Set<java.lang.Object> destroyed)
-
match
abstract boolean match(javax.servlet.http.HttpServletRequest req)
Determine if this pipeline handles the request's URL.This method should match on the request's
getPathInfo()
method, asMetaServlet
passes the request along as-is to each pipeline's match method.- Parameters:
req
- current HTTP request being considered byMetaServlet
.- Returns:
true
if this pipeline is configured to handle the request;false
otherwise.
-
service
void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp) throws javax.servlet.ServletException, java.io.IOException
Execute the filters and the servlet on the request.Invoked by
MetaServlet
oncematch(HttpServletRequest)
has determined this pipeline is the correct pipeline to handle the current request.- Parameters:
req
- current HTTP request.rsp
- current HTTP response.- Throws:
javax.servlet.ServletException
- request cannot be completed.java.io.IOException
- IO error prevents the request from being completed.
-
-