Marotta tipo aquele redirecionamento que vc fez pro site de alarmes,eles querem que eu faça um pro site da mutuos...tipo na hora que você inicia o jetty ele abre o redirecionador,mas não o executa.vo posta o redirect aqui:
Redirecionador:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.mortbay.jetty.servlet.DefaultServlet;
/**
*
* @author marcelo
*/
public class Redirect extends DefaultServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try {
int parametro = Integer.parseInt(request.getParameter("idSecao"));
if (parametro == 8 || parametro == 10) {
if (parametro == 8) {
response.sendRedirect("http://www.mutuos.com.br/mutuos/Pagina.do?idSecao=12");
} else if (parametro == 10) {
response.sendRedirect("http://www.mutuos.com.br/mutuos/Pagina.do?");
}
}
/*switch (Integer.parseInt(request.getParameter("idSecao"))) {
case 8:
response.sendRedirect("http://www.mutuos.com.br/mutuos/Pagina.do?idSecao=12");
break;
case 10:
response.sendRedirect("http://www.mutuos.com.br/mutuos/Pagina.do?");
break;
default:
response.sendRedirect("http://www.mutuos.com.br/mutuos/pagina.do?");
}*/
} catch (Exception e) {
response.sendRedirect("http://www.mutuos.com.br");
}
}
// <editor-fold defaultstate="collapsed" desc="Métodos HttpServlet. Clique no sinal de + à esquerda para editar o código.">
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
Xml:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "
http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Mixin the RewriteHandler -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<!-- =========================================================== -->
<!-- Configure Rewrite Handler -->
<!-- =========================================================== -->
<Get id="oldhandler" name="handler"/>
<Set name="handler">
<New id="Rewrite" class="org.mortbay.jetty.handler.rewrite.RewriteHandler">
<Set name="handler"><Ref id="oldhandler"/></Set>
<Set name="rewriteRequestURI">true</Set>
<Set name="rewritePathInfo">false</Set>
<Set name="originalPathAttribute">requestedPath</Set>
<Set name="rules">
<Array type="org.mortbay.jetty.handler.rewrite.Rule">
<!-- return an error message if low on threads; put this at the top so it will be processed first -->
<Item>
<New id="lowThreads" class="org.mortbay.jetty.handler.rewrite.LowThreadsRuleContainer">
<!-- set the trigger for low threads ridiculously low
uncomment the block below to see it in action -->
<!--Ref id="Server">
<Get id="serverThreadPool" name="threadPool">
<Set name="minThreads">3</Set>
<Set name="maxThreads">4</Set>
<Set name="lowThreads">0</Set>
</Get>
</Ref>
<Set name="threadPool"><Ref id="serverThreadPool"/></Set-->
<Call name="addRule">
<Arg>
<New id="busyresponse" class="org.mortbay.jetty.handler.rewrite.ResponsePatternRule">
<Set name="pattern">/*</Set>
<Set name="code">500</Set>
<Set name="reason">Server busy</Set>
</New>
</Arg>
</Call>
</New>
</Item>
<!-- Add rule to protect against IE ssl bug -->
<Item>
<New class="org.mortbay.jetty.handler.rewrite.MsieSslRule"/>
</Item>
<!-- protect favicon handling -->
<Item>
<New class="org.mortbay.jetty.handler.rewrite.HeaderPatternRule">
<Set name="pattern">/favicon.ico</Set>
<Set name="name">Cache-Control</Set>
<Set name="value">Max-Age=3600,public</Set>
<Set name="terminating">true</Set>
</New>
</Item>
<!-- add a regex rule -->
<Item>
<New class="org.mortbay.jetty.handler.rewrite.RewriteRegexRule">
<Set name="regex">/mutuos/(.*)</Set>
<Set name="replacement">/Redirecionador/Redirect</Set>
</New>
</Item>
<!-- add a header pattern rule -->
<Item>
<New id="header" class="org.mortbay.jetty.handler.rewrite.HeaderPatternRule">
<Set name="pattern">*.jsp</Set>
<Set name="name">Server</Set>
<Set name="value">Server for JSP</Set>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
</Configure>
Foi mal ta te encheno mais o pessoal aqui ta em cima e eu não sei mais o que fazer!!!
Forte abraço!!!
Márcio!!!