42 lines
1.5 KiB
Java
42 lines
1.5 KiB
Java
|
|
package it.acxent.cc.servlet;
|
||
|
|
|
||
|
|
import it.acxent.cc.Attivita;
|
||
|
|
import it.acxent.jsp.Ab;
|
||
|
|
import it.acxent.servlet.AcServlet;
|
||
|
|
import java.util.Locale;
|
||
|
|
import javax.servlet.http.HttpServletRequest;
|
||
|
|
import javax.servlet.http.HttpServletResponse;
|
||
|
|
|
||
|
|
public class IndexWwwSvlt extends AcServlet {
|
||
|
|
private static final long serialVersionUID = -6624665938374872005L;
|
||
|
|
|
||
|
|
private static final String HTML = ".html";
|
||
|
|
|
||
|
|
private static final String INDEX = "index-";
|
||
|
|
|
||
|
|
private static final String LOCATION = "Location";
|
||
|
|
|
||
|
|
private static final String _INC_MENU_JSP = "_inc_menu.jsp";
|
||
|
|
|
||
|
|
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||
|
|
try {
|
||
|
|
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
|
||
|
|
String currentLang = (String)req.getSession().getAttribute("LANG".toLowerCase());
|
||
|
|
if (currentLang == null || currentLang.isEmpty())
|
||
|
|
currentLang = Ab.getBrowserLang(req, Locale.ENGLISH.getLanguage());
|
||
|
|
if (attivita.getLangDisponibili().indexOf(currentLang) < 0)
|
||
|
|
currentLang = attivita.getLangSeNonDisponibile();
|
||
|
|
req.getSession().setAttribute("LANG".toLowerCase(), currentLang);
|
||
|
|
String url = req.getRequestURL().toString();
|
||
|
|
System.out.println("INDEX.HTML Incomming URL = " + url + " lang_:" + currentLang);
|
||
|
|
res.setStatus(301);
|
||
|
|
res.setHeader("Location", attivita.getWwwAddress() + "index-" + attivita.getWwwAddress() + ".html");
|
||
|
|
} catch (Exception e) {
|
||
|
|
handleDebug(e);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
protected boolean isSecureServlet(HttpServletRequest req) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|