// not a GWC supported format
requestMistmatchTarget.append("not a GWC supported format: ").append(me.getMessage());
return null;
}
final GridSubset gridSubset;
final long[] tileIndex;
final Map<String, String> fullParameters;
try {
boolean axisFlip = false;
final List<GridSubset> crsMatchingGridSubsets;
{
CoordinateReferenceSystem crs = request.getCrs();
int epsgId;
// are we in wms 1.3 land?
if(CRS.getAxisOrder(crs) == AxisOrder.NORTH_EAST) {
axisFlip = true;
}
String srs = request.getSRS();
epsgId = Integer.parseInt(srs.substring(srs.lastIndexOf(':') + 1));
SRS srs2 = SRS.getSRS(epsgId);
crsMatchingGridSubsets = tileLayer.getGridSubsetsForSRS(srs2);
}
final BoundingBox tileBounds;
{
Envelope bbox = request.getBbox();
if(axisFlip) {
tileBounds = new BoundingBox(bbox.getMinY(), bbox.getMinX(), bbox.getMaxY(),
bbox.getMaxX());
} else {
tileBounds = new BoundingBox(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(),
bbox.getMaxY());
}
}
if (crsMatchingGridSubsets.isEmpty()) {
requestMistmatchTarget.append("no cache exists for requested CRS");
return null;
}
{
long[] matchingTileIndex = new long[3];
final int reqW = request.getWidth();
final int reqH = request.getHeight();
gridSubset = findBestMatchingGrid(tileBounds, crsMatchingGridSubsets, reqW, reqH,
matchingTileIndex);
if (gridSubset == null) {
requestMistmatchTarget.append("request does not align to grid(s) ");
for (GridSubset gs : crsMatchingGridSubsets) {
requestMistmatchTarget.append('\'').append(gs.getName()).append("' ");
}
return null;
}
tileIndex = matchingTileIndex;
}
{
Map<String, String> requestParameterMap = request.getRawKvp();
fullParameters = tileLayer.getModifiableParameters(requestParameterMap, "UTF-8");
}
} catch (Exception e) {
if (log.isLoggable(Level.FINE)) {
e.printStackTrace();
log.log(Level.FINE, "Exception caught checking gwc dispatch preconditions", e);
}
Throwable rootCause = getRootCause(e);
requestMistmatchTarget.append("exception occurred: ")
.append(rootCause.getClass().getSimpleName()).append(": ")
.append(e.getMessage());
return null;
}
ConveyorTile tileReq;
final String gridSetId = gridSubset.getName();
HttpServletRequest servletReq = null;
HttpServletResponse servletResp = null;
String layerName = tileLayer.getName();
tileReq = new ConveyorTile(storageBroker, layerName, gridSetId, tileIndex, mimeType,
fullParameters, servletReq, servletResp);