[jboss-user] [Security & JAAS/JBoss] - Re: problem with https

cibermon do-not-reply at jboss.com
Fri Mar 27 06:58:56 EDT 2009


Hola chicos, despu??s de buscar mucho he optado por una soluci??n que ni mucho menos es ??ptima pero al menos funciona.

 Lo que he hecho es hacer un filtro que rediriga a la misma pagina pero con http:// y con el puerto 8080 o el que corresponda. Os pego el codigo.

 

public class ControlProtocolo implements Filter{

    public void destroy() {
        System.out.println(".... destruido filtro Control de Protocolo");
    }

    public void doFilter(ServletRequest arg0, ServletResponse arg1,
            FilterChain arg2) throws IOException, ServletException {

        if (arg0.isSecure()){
            HttpServletRequest httpRequest = (HttpServletRequest) arg0;
            HttpServletResponse httpResponse = (HttpServletResponse) arg1;
           
            StringBuffer redirectURL = new StringBuffer();

            redirectURL.append("http://");
            redirectURL.append(httpRequest.getServerName());
            redirectURL.append(":8080");
            redirectURL.append(httpRequest.getContextPath());
            redirectURL.append(httpRequest.getServletPath());

            String queryString = httpRequest.getQueryString();
            if (queryString!=null){
                redirectURL.append("?");
                redirectURL.append(queryString);
            }

            httpResponse.sendRedirect(redirectURL.toString());
           
        }else{
            arg2.doFilter(arg0, arg1);
        }
         

   
    }

    public void init(FilterConfig arg0) throws ServletException {
        System.out.println("Iniciando filtro Control de Protocolo ...");

    }

}

 

Y en el web.xml, logicamente s??lo lo voy a aplicar a la zona nosegura, que es la candidata a ser redireccionada.

 {filter}

       {filter-name>controlProtocoloFilter{/filter-name}      

{filter-class}

           es.carm.javato.infoWeb.filtros.ControlProtocolo
        {/filter-class} 

{/filter}
    {filter-mapping}
        {filter-name}controlProtocoloFilter{/filter-name}
        {url-pattern}/nosegura/*{/url-pattern}
    {/filter-mapping}

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221510#4221510

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221510



More information about the jboss-user mailing list