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

pack-priv abstract Class ObjectFileServlet

extends HttpServlet
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.http.server.ObjectFileServlet.Loose, org.eclipse.jgit.http.server.ObjectFileServlet.PackData
Static Imports
jakarta.servlet.http.HttpServletResponse.SC_NOT_FOUND, .HttpServletResponse.SC_NOT_MODIFIED, org.eclipse.jgit.http.server.ServletUtils.getRepository, org.eclipse.jgit.util.HttpSupport.HDR_ETAG, .HttpSupport.HDR_IF_MODIFIED_SINCE, .HttpSupport.HDR_IF_NONE_MATCH, .HttpSupport.HDR_LAST_MODIFIED

Sends any object from GIT_DIR/objects/??/0 38, or any pack file.

Nested and Inner Type Summary

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

Field Summary

Modifier and TypeField and Description
private final String
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
doGet(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.doGet.

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

protected void
doHead(final HttpServletRequest
the request object that is passed to the servlet
req
,
final HttpServletResponse
the response object that the servlet uses to return the headers to the clien
rsp
)

Overrides jakarta.servlet.http.HttpServlet.doHead.

Receives an HTTP HEAD request from the protected service method and handles the request.

pack-priv abstract String
etag(FileSender sender)

private static File
private void
serve(final HttpServletRequest req, final HttpServletResponse rsp, final boolean sendBody)

Inherited from jakarta.servlet.http.HttpServlet:
doDeletedoOptionsdoPatchdoPostdoPutdoTracegetLastModifiedinitisSensitiveHeaderserviceservice

Field Detail

contentTypeback to summary
private final String contentType
serialVersionUIDback to summary
private static final long serialVersionUID

Hides jakarta.servlet.http.HttpServlet.serialVersionUID.

Constructor Detail

ObjectFileServletback to summary
pack-priv ObjectFileServlet(String contentType)

Method Detail

doGetback to summary
public void doGet(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException

Overrides jakarta.servlet.http.HttpServlet.doGet.

Doc from jakarta.servlet.http.HttpServlet.doGet.

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

Overriding this method to support a GET request also automatically supports an HTTP HEAD request. A HEAD request is a GET request that returns no body in the response, only the request header fields.

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.

The GET method should be safe, that is, without any side effects for which users are held responsible. For example, most form queries have no side effects. If a client request is intended to change stored data, the request should use some other HTTP method.

The GET method should also be idempotent, meaning that it can be safely repeated. Sometimes making a method safe also makes it idempotent. For example, repeating queries is both safe and idempotent, but buying a product online or modifying data is neither safe nor idempotent.

If the request is incorrectly formatted, doGet 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 GET request
doHeadback to summary
protected void doHead(final HttpServletRequest req, final HttpServletResponse rsp) throws ServletException, IOException

Overrides jakarta.servlet.http.HttpServlet.doHead.

Doc from jakarta.servlet.http.HttpServlet.doHead.

Receives an HTTP HEAD request from the protected service method and handles the request. The client sends a HEAD request when it wants to see only the headers of a response, such as Content-Type or Content-Length. The HTTP HEAD method counts the output bytes in the response to set the Content-Length header accurately.

If you override this method, you can avoid computing the response body and just set the response headers directly to improve performance. Make sure that the doHead method you write is both safe and idempotent (that is, protects itself from being called multiple times for one HTTP HEAD request).

The default implementation calls doGet(HttpServletRequest, HttpServletResponse). If the ServletConfig init parameter LEGACY_DO_HEAD is set to "TRUE", then the response instance is wrapped so that the response body is discarded.

If the HTTP HEAD request is incorrectly formatted, doHead returns an HTTP "Bad Request" message.

Parameters
req:HttpServletRequest

the request object that is passed to the servlet

rsp:HttpServletResponse

the response object that the servlet uses to return the headers to the clien

Annotations
@Override
Exceptions
ServletException:
if the request for the HEAD could not be handled
IOException:
if an input or output error occurs
etagback to summary
pack-priv abstract String etag(FileSender sender) throws IOException
objectsback to summary
private static File objects(HttpServletRequest req)
serveback to summary
private void serve(final HttpServletRequest req, final HttpServletResponse rsp, final boolean sendBody) throws IOException
org.eclipse.jgit.http.server back to summary

pack-priv Class ObjectFileServlet.Loose

extends ObjectFileServlet
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv String
Inherited from org.eclipse.jgit.http.server.ObjectFileServlet:
doGetdoHead

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.eclipse.jgit.http.server.ObjectFileServlet.serialVersionUID.

Constructor Detail

Looseback to summary
pack-priv Loose()

Method Detail

etagback to summary
pack-priv String etag(FileSender sender) throws IOException

Implements abstract org.eclipse.jgit.http.server.ObjectFileServlet.etag.

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

pack-priv Class ObjectFileServlet.Pack

extends PackData
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
Pack()

Method Summary

Inherited from org.eclipse.jgit.http.server.ObjectFileServlet.PackData:
etag

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.eclipse.jgit.http.server.ObjectFileServlet.PackData.serialVersionUID.

Constructor Detail

Packback to summary
pack-priv Pack()
org.eclipse.jgit.http.server back to summary

private abstract Class ObjectFileServlet.PackData

extends ObjectFileServlet
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.http.server.ObjectFileServlet.Pack, org.eclipse.jgit.http.server.ObjectFileServlet.PackIdx

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
PackData(String contentType)

Method Summary

Modifier and TypeMethod and Description
pack-priv String
Inherited from org.eclipse.jgit.http.server.ObjectFileServlet:
doGetdoHead

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.eclipse.jgit.http.server.ObjectFileServlet.serialVersionUID.

Constructor Detail

PackDataback to summary
pack-priv PackData(String contentType)

Method Detail

etagback to summary
pack-priv String etag(FileSender sender) throws IOException

Implements abstract org.eclipse.jgit.http.server.ObjectFileServlet.etag.

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

pack-priv Class ObjectFileServlet.PackIdx

extends PackData
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from org.eclipse.jgit.http.server.ObjectFileServlet.PackData:
etag

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.eclipse.jgit.http.server.ObjectFileServlet.PackData.serialVersionUID.

Constructor Detail

PackIdxback to summary
pack-priv PackIdx()