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

pack-priv Class ReceivePackServlet

extends HttpServlet
Class Inheritance
Static Imports
jakarta.servlet.http.HttpServletResponse.SC_FORBIDDEN, .HttpServletResponse.SC_INTERNAL_SERVER_ERROR, .HttpServletResponse.SC_UNAUTHORIZED, .HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, org.eclipse.jgit.http.server.GitSmartHttpTools.RECEIVE_PACK, .GitSmartHttpTools.RECEIVE_PACK_REQUEST_TYPE, .GitSmartHttpTools.RECEIVE_PACK_RESULT_TYPE, .GitSmartHttpTools.sendError, .ServletUtils.ATTRIBUTE_HANDLER, .ServletUtils.consumeRequestBody, .ServletUtils.getInputStream, .ServletUtils.getRepository, org.eclipse.jgit.util.HttpSupport.HDR_USER_AGENT

Server side implementation of smart push over HTTP.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

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

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
doPost(final HttpServletRequest
an HttpServletRequest object that contains the request the client has made of the servlet
req
,
final HttpServletResponse
an HttpServletResponse object that contains the response the servlet sends to the client
rsp
)

Overrides jakarta.servlet.http.HttpServlet.doPost.

Called by the server (via the service method) to allow a servlet to handle a POST request.

private void
Inherited from jakarta.servlet.http.HttpServlet:
doDeletedoGetdoHeaddoOptionsdoPatchdoPutdoTracegetLastModifiedinitisSensitiveHeaderserviceservice

Field Detail

handlerback to summary
private final ReceivePackErrorHandler handler
Annotations
@Nullable
serialVersionUIDback to summary
private static final long serialVersionUID

Hides jakarta.servlet.http.HttpServlet.serialVersionUID.

Constructor Detail

ReceivePackServletback to summary
pack-priv ReceivePackServlet(ReceivePackErrorHandler handler)

Method Detail

doPostback to summary
public void doPost(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException

Overrides jakarta.servlet.http.HttpServlet.doPost.

Doc from jakarta.servlet.http.HttpServlet.doPost.

Called by the server (via the service method) to allow a servlet to handle a POST request. The HTTP POST method allows the client to send data of unlimited length to the Web server a single time and is useful when posting information such as credit card numbers.

When overriding this method, read the request data, write the response headers, get the response's writer or output stream object, and finally, write the response data. It's best to include content type and encoding. When using a PrintWriter object to return the response, set the content type before accessing the PrintWriter object.

The servlet container must write the headers before committing the response, because in HTTP the headers must be sent before the response body.

Where possible, set the Content-Length header (with the jakarta.servlet.ServletResponse#setContentLength method), to allow the servlet container to use a persistent connection to return its response to the client, improving performance. The content length is automatically set if the entire response fits inside the response buffer.

When using HTTP 1.1 chunked encoding (which means that the response has a Transfer-Encoding header), do not set the Content-Length header.

This method does not need to be either safe or idempotent. Operations requested through POST can have side effects for which the user can be held accountable, for example, updating stored data or buying items online.

If the HTTP POST request is incorrectly formatted, doPost returns an HTTP "Bad Request" message.

Parameters
req:HttpServletRequest

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

rsp:HttpServletResponse

an HttpServletResponse object that contains the response the servlet sends to the client

Annotations
@Override
Exceptions
IOException:
if an input or output error is detected when the servlet handles the request
logback to summary
private void log(Repository git, Throwable e)
org.eclipse.jgit.http.server back to summary

pack-priv Class ReceivePackServlet.Factory

extends Object
implements Filter
Class Inheritance
All Implemented Interfaces
jakarta.servlet.Filter

Field Summary

Modifier and TypeField and Description
private final ReceivePackFactory<HttpServletRequest>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
destroy()

Overrides default jakarta.servlet.Filter.destroy.

Called by the web container to indicate to a filter that it is being taken out of service.

public void
doFilter(ServletRequest
the ServletRequest object contains the client's request
request
,
ServletResponse
the ServletResponse object contains the filter's response
response
,
FilterChain
the FilterChain for invoking the next filter or the resource
chain
)

Implements jakarta.servlet.Filter.doFilter.

The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain.

public void
init(FilterConfig
a FilterConfig object containing the filter's configuration and initialization parameters
filterConfig
)

Overrides default jakarta.servlet.Filter.init.

Called by the web container to indicate to a filter that it is being placed into service.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

receivePackFactoryback to summary
private final ReceivePackFactory<HttpServletRequest> receivePackFactory

Constructor Detail

Factoryback to summary
pack-priv Factory(ReceivePackFactory<HttpServletRequest> receivePackFactory)

Method Detail

destroyback to summary
public void destroy()

Overrides default jakarta.servlet.Filter.destroy.

Doc from jakarta.servlet.Filter.destroy.

Called by the web container to indicate to a filter that it is being taken out of service.

This method is only called once all threads within the filter's doFilter method have exited or after a timeout period has passed. After the web container calls this method, it will not call the doFilter method again on this instance of the filter.

This method gives the filter an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the filter's current state in memory.

Annotations
@Override
doFilterback to summary
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException

Implements jakarta.servlet.Filter.doFilter.

Doc from jakarta.servlet.Filter.doFilter.

The doFilter method of the Filter is called by the container each time a request/response pair is passed through the chain due to a client request for a resource at the end of the chain. The FilterChain passed in to this method allows the Filter to pass on the request and response to the next entity in the chain.

A typical implementation of this method would follow the following pattern:

  1. Examine the request
  2. Optionally wrap the request object with a custom implementation to filter content or headers for input filtering
  3. Optionally wrap the response object with a custom implementation to filter content or headers for output filtering
    • Either invoke the next entity in the chain using the FilterChain object (chain.doFilter()),
    • or not pass on the request/response pair to the next entity in the filter chain to block the request processing
  4. Directly set headers on the response after invocation of the next entity in the filter chain.
Parameters
request:ServletRequest

the ServletRequest object contains the client's request

response:ServletResponse

the ServletResponse object contains the filter's response

chain:FilterChain

the FilterChain for invoking the next filter or the resource

Annotations
@Override
Exceptions
IOException:
if an I/O related error has occurred during the processing
ServletException:
if an exception occurs that interferes with the filter's normal operation
initback to summary
public void init(FilterConfig filterConfig) throws ServletException

Overrides default jakarta.servlet.Filter.init.

Doc from jakarta.servlet.Filter.init.

Called by the web container to indicate to a filter that it is being placed into service.

The servlet container calls the init method exactly once after instantiating the filter. The init method must complete successfully before the filter is asked to do any filtering work. The container will ensure that actions performed in the init method will be visible to any threads that subsequently call the doFilter method according to the rules in JSR-133 (i.e. there is a 'happens before' relationship between init and doFilter).

The web container cannot place the filter into service if the init method either

  1. Throws a ServletException
  2. Does not return within a time period defined by the web container
Parameters
filterConfig:FilterConfig

a FilterConfig object containing the filter's configuration and initialization parameters

Annotations
@Override
Exceptions
ServletException:
if an exception has occurred that interferes with the filter's normal operation
org.eclipse.jgit.http.server back to summary

pack-priv Class ReceivePackServlet.InfoRefs

extends SmartServiceInfoRefs
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final ReceivePackFactory<HttpServletRequest>

Constructor Summary

AccessConstructor and Description
pack-priv
InfoRefs(ReceivePackFactory<HttpServletRequest> receivePackFactory, List<Filter> filters)

Method Summary

Modifier and TypeMethod and Description
protected void
advertise(HttpServletRequest
request
req
,
RefAdvertiser.PacketLineOutRefAdvertiser
used to frame lines in PacketLineOut format
pck
)

Implements abstract org.eclipse.jgit.http.server.SmartServiceInfoRefs.advertise.

Advertise.

protected void
begin(HttpServletRequest
request
req
,
Repository
repository
db
)

Implements abstract org.eclipse.jgit.http.server.SmartServiceInfoRefs.begin.

Begin service.

Inherited from org.eclipse.jgit.http.server.SmartServiceInfoRefs:
destroydoFilterinitrespond

Field Detail

receivePackFactoryback to summary
private final ReceivePackFactory<HttpServletRequest> receivePackFactory

Constructor Detail

InfoRefsback to summary
pack-priv InfoRefs(ReceivePackFactory<HttpServletRequest> receivePackFactory, List<Filter> filters)

Method Detail

advertiseback to summary
protected void advertise(HttpServletRequest req, RefAdvertiser.PacketLineOutRefAdvertiser pck) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException

Implements abstract org.eclipse.jgit.http.server.SmartServiceInfoRefs.advertise.

Doc from org.eclipse.jgit.http.server.SmartServiceInfoRefs.advertise.

Advertise.

Parameters
req:HttpServletRequest

request

pck:RefAdvertiser.PacketLineOutRefAdvertiser

used to frame lines in PacketLineOut format

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
ServiceNotEnabledException:
if a service is not available
ServiceNotAuthorizedException:
if service requires authentication and the current user didn't provide credentials
beginback to summary
protected void begin(HttpServletRequest req, Repository db) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException

Implements abstract org.eclipse.jgit.http.server.SmartServiceInfoRefs.begin.

Doc from org.eclipse.jgit.http.server.SmartServiceInfoRefs.begin.

Begin service.

Parameters
req:HttpServletRequest

request

db:Repository

repository

Annotations
@Override
Exceptions
IOException:
if an IO error occurred
ServiceNotEnabledException:
if a service is not available
ServiceNotAuthorizedException:
if service requires authentication and the current user didn't provide credentials