| | |
| | | ServletServerHttpResponse ssRes = new ServletServerHttpResponse(res); |
| | | |
| | | // æ£æ¥ç¼åæ¯å¦è¿æ |
| | | if (checkIfNotModify(ssReq, ssRes)) { |
| | | // 设置ç¼å头 |
| | | setBrowerCache(ssRes); |
| | | return; |
| | | } |
| | | // if (checkIfNotModify(ssReq, ssRes)) { |
| | | // // 设置ç¼å头 |
| | | // setBrowerCache(ssRes); |
| | | // return; |
| | | // } |
| | | |
| | | // 设置è¿åå¾çç±»å |
| | | res.setContentType("image/png"); |
| | |
| | | // å®ä¹è¾å
¥æµï¼éè¿è¾å
¥æµè¯»åæä»¶å
容 |
| | | FileInputStream fileInputStream; |
| | | |
| | | // y = (1 << z) - y - 1 |
| | | y = (int) Math.pow(2, z) - y - 1; |
| | | String path = config.getTilePath() + File.separator + layer + File.separator + z + File.separator + x + File.separator + y + ".png"; |
| | | |
| | | File file = new File(path); |
| | | if (!file.exists() || file.isDirectory()) { |
| | | ClassPathResource resource = new ClassPathResource("wmts/nofound.png"); |
| | | fileInputStream = new FileInputStream(resource.getFile()); |
| | | } else { |
| | | System.out.println(path); |
| | | fileInputStream = new FileInputStream(file); |
| | | } |
| | | |
| | | int len = 0; |
| | | byte[] bytes = new byte[1024]; |
| | | while ((len = fileInputStream.read(bytes)) != -1) { |
| | | // éè¿è¾å
¥æµè¯»åæä»¶æ°æ®ï¼ç¶åéè¿ä¸è¿°çè¾åºæµååæµè§å¨ |
| | | outputStream.write(bytes, 0, len); |
| | | outputStream.flush(); |
| | | } |
| | | |
| | | // å
³éèµæº |
| | | outputStream.close(); |
| | | fileInputStream.close(); |
| | | |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |