| | |
| | | @RequestMapping(value = {"/{token}/{id}/**"}) |
| | | public void proxyUrl(@NotNull @PathVariable String token, @NotNull @PathVariable int id, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | proxyService.proxyUrl(token, id, req, res); |
| | | proxyService.proxyUrl(token, id, false, req, res); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | WebHelper.writeStr2Page(res, ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "URL代理", notes = "URL代理") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "令牌", dataType = "String", paramType = "path", required = true, example = "1eb2ea8f-5cfd-4e6c-95c9-17ab0f7bce71"), |
| | | @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "path", required = true, example = "1"), |
| | | }) |
| | | @RequestMapping(value = {"/rest/{token}/{id}/**"}) |
| | | public void proxyRestUrl(@NotNull @PathVariable String token, @NotNull @PathVariable int id, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | proxyService.proxyUrl(token, id, true, req, res); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | WebHelper.writeStr2Page(res, ex.getMessage()); |
| | |
| | | /** |
| | | * 用户访问量 |
| | | */ |
| | | public static int MAX_USER_LOGIN; |
| | | public static int MAX_USER_LOGIN = 1000; |
| | | |
| | | /** |
| | | * 服务上限 |
| | | */ |
| | | public static int MAX_SERVERS; |
| | | public static int MAX_SERVERS = 100000; |
| | | } |
| | |
| | | proxyUrl = request.getRequestURL().substring(0, request.getRequestURL().indexOf(proxyUrl) + proxyUrl.length()); |
| | | str = str.replace(strs[0], proxyUrl); |
| | | |
| | | if (!StringHelper.isEmpty(strs[1])) { |
| | | str = str.replace("?" + strs[1], "").replace("&" + strs[1], ""); |
| | | } |
| | | |
| | | if (StaticData.THREE == res.getFirm() && str.contains(StaticData.REST_LAYER)) { |
| | | |
| | | |
| | | str = str.replace(strs[0].replace("/wmts/layer/", StaticData.REST_LAYER), proxyUrl.replace("/proxy/", "/proxy/rest/")); |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * URL代理 |
| | | */ |
| | | public void proxyUrl(String token, int resId, HttpServletRequest req, HttpServletResponse res) throws Exception { |
| | | public void proxyUrl(String token, int resId, boolean isRest, HttpServletRequest req, HttpServletResponse res) throws Exception { |
| | | // 3.获取用户 |
| | | UserEntity ue = getUser(req, res, token); |
| | | if (null == ue) { |