Пример #1
0
    private void handleCapability(String capabilityName) {
      AttributesImpl attributes = new AttributesImpl();
      start(capabilityName);

      start("wcs:DCPType");
      start("wcs:HTTP");

      // String baseURL = RequestUtils.proxifiedBaseURL(request.getBaseUrl(),
      // wcs.getGeoServer().getGlobal().getProxyBaseUrl());
      String url = ResponseUtils.buildURL(request.getBaseUrl(), "wcs", null, URLType.SERVICE);
      attributes.addAttribute("", "xlink:href", "xlink:href", "", url + "?");

      start("wcs:Get");
      start("wcs:OnlineResource", attributes);
      end("wcs:OnlineResource");
      end("wcs:Get");
      end("wcs:HTTP");
      end("wcs:DCPType");

      attributes = new AttributesImpl();
      attributes.addAttribute("", "xlink:href", "xlink:href", "", url + "?");

      start("wcs:DCPType");
      start("wcs:HTTP");
      start("wcs:Post");
      start("wcs:OnlineResource", attributes);
      end("wcs:OnlineResource");
      end("wcs:Post");
      end("wcs:HTTP");
      end("wcs:DCPType");
      end(capabilityName);
    }
Пример #2
0
  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws IOException, ServletException {

    if (request.isSecure()) {
      chain.doFilter(request, response);
      return;
    }

    HttpServletRequest httpRequest = (HttpServletRequest) request;

    StringBuffer buff = new StringBuffer("https://");
    buff.append(httpRequest.getServerName())
        .append(":")
        .append(sslPort)
        .append(httpRequest.getContextPath())
        .append(httpRequest.getServletPath());

    Map<String, String> kvp = new HashMap<String, String>();
    if (httpRequest.getQueryString() != null) {
      for (String kvpString : httpRequest.getQueryString().split("&")) {
        String[] kvpArray = kvpString.split("=");
        if (kvpArray == null || kvpArray.length != 2) {
          LOGGER.warning("Unknown query parameter: " + kvpString);
          continue;
        }
        kvp.put(kvpArray[0], kvpArray[1]);
      }
    }
    String redirectURL =
        ResponseUtils.buildURL(buff.toString(), httpRequest.getPathInfo(), kvp, null);

    if (LOGGER.isLoggable(Level.INFO))
      LOGGER.info("Redirecting " + httpRequest.getRequestURL() + " to " + redirectURL);
    ((HttpServletResponse) response).sendRedirect(redirectURL);
  }