Class TileServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.levigo.jadice.web.conn.server.TileServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
public class TileServlet
extends jakarta.servlet.http.HttpServlet
This servlet handles HTTP tile requests.
The "@WebServlet"-Annotation was removed as this Servlet needs some Autowired components, therefore the servlet has to be manually registered by a ServletRegistrationBean
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classSimple implementation of theRenderControlsto be fed with the deserialized settings manually on the server because the client implementation is not accessible on the server.static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.levigo.jadice.web.server.internal.TileRenderServiceFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
ConstructorsConstructorDescriptionTileServlet(com.levigo.jadice.web.server.internal.TileRenderService tileRenderService) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) static StringgetClientId(String queryString) Extracts the client-ID from a given tile-request URL.protected voidgetData(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) static StringgetParamValueAsStringContainingArrayDecoded(String queryString, String paramName) protected voidhandleRequestAsynchronously(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, com.levigo.jadice.web.shared.model.internal.RenderSpecification spec, String renderSpecHashCode) Starts the asynchronous processing of the tile-rendering by initializing an async-context.protected voidhandleTileCancelCallback(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async) Callback-method when a Tile-render-request was cancelledprotected voidhandleTileErrorCallback(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async, Throwable e) Callback-method when an error occurred in a Tile-render-requestprotected voidhandleTileSuccessCallback(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async, BufferedImage tileData, boolean clientSupportsWebp, String renderSpecHashCode) Success-callback when a Tile was successfully rendered.protected voidprotected voidsetTileImageFuture(com.levigo.jadice.web.server.internal.concurrent.TileRenderFuture tileImageFuture, TileRenderAsyncListener tileRenderAsyncListener) Moved to own method so it can be overridden in Testsprotected jakarta.servlet.AsyncContextstartAsync(jakarta.servlet.http.HttpServletRequest request) protected PageSegmentHandle[]unmarshalHandles(String handlesString) protected com.levigo.jadice.web.shared.model.internal.RenderSpecificationunmarshalRenderSpecification(jakarta.servlet.http.HttpServletRequest request) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
tileRenderService
@Autowired protected com.levigo.jadice.web.server.internal.TileRenderService tileRenderService
-
-
Constructor Details
-
TileServlet
public TileServlet() -
TileServlet
public TileServlet(com.levigo.jadice.web.server.internal.TileRenderService tileRenderService)
-
-
Method Details
-
getClientId
Extracts the client-ID from a given tile-request URL.- Parameters:
queryString- the queryString of the tile-request URL- Returns:
- the extracted client-id for the given tile-request
-
getParamValueAsStringContainingArrayDecoded
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException - Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletException
-
getData
protected void getData(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IndexOutOfBoundsException, ar.com.hjg.pngj.PngjOutputException, IOException - Throws:
IndexOutOfBoundsExceptionar.com.hjg.pngj.PngjOutputExceptionIOException
-
startAsync
protected jakarta.servlet.AsyncContext startAsync(jakarta.servlet.http.HttpServletRequest request) -
setTileImageFuture
protected void setTileImageFuture(com.levigo.jadice.web.server.internal.concurrent.TileRenderFuture tileImageFuture, TileRenderAsyncListener tileRenderAsyncListener) Moved to own method so it can be overridden in Tests -
handleTileSuccessCallback
protected void handleTileSuccessCallback(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async, BufferedImage tileData, boolean clientSupportsWebp, String renderSpecHashCode) Success-callback when a Tile was successfully rendered. Writes the result to the response- Parameters:
requestStillValid- flag that is set to invalid by the async-context when the async-request timed-outasync- the async-context for this operationtileData- the result of the tile-render-process (the actual image)
-
handleTileCancelCallback
protected void handleTileCancelCallback(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async) Callback-method when a Tile-render-request was cancelled- Parameters:
requestStillValid- flag that is set to invalid by the async-context when the async-request timed-outasync- the async-context for this operation
-
handleTileErrorCallback
protected void handleTileErrorCallback(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async, Throwable e) Callback-method when an error occurred in a Tile-render-request- Parameters:
requestStillValid- flag that is set to invalid by the async-context when the async-request timed-outasync- the async-context for this operatione- the error
-
unmarshalRenderSpecification
protected com.levigo.jadice.web.shared.model.internal.RenderSpecification unmarshalRenderSpecification(jakarta.servlet.http.HttpServletRequest request) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
unmarshalHandles
protected PageSegmentHandle[] unmarshalHandles(String handlesString) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
logClientClosedException
-