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

pack-priv Class RegexPipeline

extends UrlPipeline
Class Inheritance
Static Imports
jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND, org.eclipse.jgit.http.server.glue.MetaFilter.REGEX_GROUPS

Selects requests by matching the URI against a regular expression.

The pattern is bound and matched against the path info of the servlet request, as this class assumes it is invoked by MetaServlet.

If there are capture groups in the regular expression, the matched ranges of the capture groups are stored as an array of modified HttpServetRequests, into the request attribute MetaFilter#REGEX_GROUPS. Using a capture group that may not capture, e.g. "(/foo)?", will cause an error at request handling time.

Each servlet request has been altered to have its getServletPath() method return the original path info up to the beginning of the corresponding capture group, and its getPathInfo() method return the matched text. A RegexGroupFilter can be applied in the pipeline to switch the current HttpServletRequest to reference a different capture group before running additional filters, or the final servlet.

Note that for getPathInfo() to start with a leading "/" as described in the servlet documentation, capture groups must actually capture the leading "/".

This class dispatches the remainder of the pipeline using the first capture group as the current request, making RegexGroupFilter required only to access capture groups beyond the first.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Pattern

Constructor Summary

AccessConstructor and Description
pack-priv
RegexPipeline(final Pattern pattern, final Filter[] filters, final HttpServlet servlet)

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
match(HttpServletRequest
current HTTP request being considered by MetaServlet.
req
)

Implements abstract org.eclipse.jgit.http.server.glue.UrlPipeline.match.

Determine if this pipeline handles the request's URL.

pack-priv void
service(HttpServletRequest
current HTTP request.
req
,
HttpServletResponse
current HTTP response.
rsp
)

Overrides org.eclipse.jgit.http.server.glue.UrlPipeline.service.

Execute the filters and the servlet on the request.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.eclipse.jgit.http.server.glue.UrlPipeline:
destroyinit

Field Detail

patternback to summary
private final Pattern pattern

Constructor Detail

RegexPipelineback to summary
pack-priv RegexPipeline(final Pattern pattern, final Filter[] filters, final HttpServlet servlet)

Method Detail

matchback to summary
pack-priv boolean match(HttpServletRequest req)

Implements abstract org.eclipse.jgit.http.server.glue.UrlPipeline.match.

Doc from org.eclipse.jgit.http.server.glue.UrlPipeline.match.

Determine if this pipeline handles the request's URL.

This method should match on the request's getPathInfo() method, as MetaServlet passes the request along as-is to each pipeline's match method.

Parameters
req:HttpServletRequest

current HTTP request being considered by MetaServlet.

Returns:boolean

true if this pipeline is configured to handle the request; false otherwise.

Annotations
@Override
serviceback to summary
pack-priv void service(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException

Overrides org.eclipse.jgit.http.server.glue.UrlPipeline.service.

Doc from org.eclipse.jgit.http.server.glue.UrlPipeline.service.

Execute the filters and the servlet on the request.

Invoked by MetaServlet once match(HttpServletRequest) has determined this pipeline is the correct pipeline to handle the current request.

Parameters
req:HttpServletRequest

current HTTP request.

rsp:HttpServletResponse

current HTTP response.

Annotations
@Override
Exceptions
ServletException:
request cannot be completed.
IOException:
IO error prevents the request from being completed.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jgit.http.server.glue back to summary

pack-priv Class RegexPipeline.Binder

extends ServletBinderImpl
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Pattern

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv UrlPipeline
create()

Implements abstract org.eclipse.jgit.http.server.glue.ServletBinderImpl.create.

Create UrlPipeline

Inherited from org.eclipse.jgit.http.server.glue.ServletBinderImpl:
getFiltersgetServletthroughwith

Field Detail

patternback to summary
private final Pattern pattern

Constructor Detail

Binderback to summary
pack-priv Binder(String p)
Binderback to summary
pack-priv Binder(Pattern p)

Method Detail

createback to summary
pack-priv UrlPipeline create()

Implements abstract org.eclipse.jgit.http.server.glue.ServletBinderImpl.create.

Doc from org.eclipse.jgit.http.server.glue.ServletBinderImpl.create.

Create UrlPipeline

Returns:UrlPipeline

the pipeline that matches and executes this chain.

Annotations
@Override