List of usage examples for org.apache.shiro.web.filter.authz SslFilter DEFAULT_HTTPS_PORT
int DEFAULT_HTTPS_PORT
To view the source code for org.apache.shiro.web.filter.authz SslFilter DEFAULT_HTTPS_PORT.
Click Source Link
From source file:com.wms.studio.filter.HttpFilter.java
License:Apache License
protected String getScheme(String requestScheme, int port) { if (port == this.port) { return this.scheme; } else if (port == SslFilter.DEFAULT_HTTPS_PORT) { return SslFilter.HTTPS_SCHEME; } else {//from w ww . j av a 2s . co m return requestScheme; } }
From source file:com.wms.studio.filter.HttpFilter.java
License:Apache License
/** * Redirects the request to the same exact incoming URL, but with the port listed in the filter's configuration. * * @param request the incoming <code>ServletRequest</code> * @param response the outgoing <code>ServletResponse</code> * @param mappedValue the config specified for the filter in the matching request's filter chain. * @return {@code false} always to force a redirect. *//*from ww w . j av a2s .c o m*/ @Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException { //just redirect to the specified port: int port = toPort(mappedValue); String scheme = getScheme(request.getScheme(), port); StringBuilder sb = new StringBuilder(); sb.append(scheme).append("://"); sb.append(request.getServerName()); if (port != DEFAULT_HTTP_PORT && port != SslFilter.DEFAULT_HTTPS_PORT) { sb.append(":"); sb.append(port); } if (request instanceof HttpServletRequest) { sb.append(WebUtils.toHttp(request).getRequestURI()); String query = WebUtils.toHttp(request).getQueryString(); if (query != null) { sb.append("?").append(query); } } WebUtils.issueRedirect(request, response, sb.toString()); return false; }