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 requests must match the pattern <base URL> +
"jwt/tile?" + <request data>. The request data can either be the serialized
FlattenedRenderSpecificationData
(needs to have the format
"v=<UUID>&r=<SPEC>" at the beginning) or the String "brokenImage".
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 class
Simple implementation of theRenderControls
to 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.TileRenderService
Fields 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 com.levigo.jadice.web.shared.model.internal.RenderSpecification
createRenderSpecification
(com.levigo.jadice.web.shared.model.internal.FlattenedRenderSpecificationData flattenedRenderSpecData) Transforms the flattenedFlattenedRenderSpecificationData
(which was received in the Request) into a "real"RenderSpecification
.protected void
doGet
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) static String
getClientId
(String queryString) Extracts the client-ID from a given tile-request URL.protected void
getData
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected void
handleRequestAsynchronously
(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 void
handleTileCancelCallback
(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async) Callback-method when a Tile-render-request was cancelledprotected void
handleTileErrorCallback
(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async, Throwable e) Callback-method when an error occurred in a Tile-render-requestprotected void
handleTileSuccessCallback
(AtomicBoolean requestStillValid, jakarta.servlet.AsyncContext async, BufferedImage tileData, boolean clientSupportsWebp, String renderSpecHashCode) Success-callback when a Tile was successfully rendered.protected void
protected void
setTileImageFuture
(com.levigo.jadice.web.server.internal.concurrent.TileRenderFuture tileImageFuture, TileRenderAsyncListener tileRenderAsyncListener) Moved to own method so it can be overridden in Testsprotected jakarta.servlet.AsyncContext
startAsync
(jakarta.servlet.http.HttpServletRequest request) protected com.levigo.jadice.web.shared.model.internal.RenderSpecification
unmarshalRenderSpecification
(String requestData) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, service
Methods 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
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException - Overrides:
doGet
in 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:
IndexOutOfBoundsException
ar.com.hjg.pngj.PngjOutputException
IOException
-
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(String requestData) throws com.google.gwt.user.client.rpc.SerializationException - Throws:
com.google.gwt.user.client.rpc.SerializationException
-
logClientClosedException
-