if (tokens.length > 0 && tokens[0].length() == 0) { String[] tokensTemp = new String[tokens.length - 1]; for (int i = 1; i < tokens.length; i++) { tokensTemp[i - 1] = tokens[i]; } tokens = tokensTemp; }
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException,            ServletException {        HttpServletRequest request = (HttpServletRequest) req;        HttpServletResponse response = (HttpServletResponse) res;                String uri = request.getRequestURI();                if(!StringUtils.contains(uri, "/horarios")){        	chain.doFilter(request, response);        	return;        }                String context = request.getContextPath();        String newURI = uri.replaceFirst(app, "");        String[] tokens = newURI.split("/");                StringBuffer forwardURI = new StringBuffer(context);                if(tokens.length >=2 && !(tokens[1].equalsIgnoreCase("horarios"))){        	forwardURI.append(notFoundURI);        }        else{	        	        if(tokens.length == 2){	            /* fenix/curso/horarios */	        	String degreeCode = tokens[tokens.length - 2];	        	Integer degreeId;                try {                    degreeId = getDegreeId(degreeCode);                } catch (FenixServiceException e) {                    throw new ServletException(e);                }                if(degreeId != null){		        	forwardURI.append(forwardScheduleList);		        	forwardURI.append(degreeId);		        } else {		        	forwardURI.append(notFoundURI);		        }	        }	        	        else if(tokens.length == 3){	            String className = tokens[2];	            String degreeCode = tokens[0];	        	Integer degreeId;                try {                    degreeId = getDegreeId(degreeCode);                } catch (FenixServiceException e) {                    throw new ServletException(e);                }                if (degreeId != null){                    SchoolClassDTO schoolClassDTO;                    try {                        schoolClassDTO = getClass(className);                    } catch (FenixServiceException e) {                        throw new ServletException(e);                    }                    if (schoolClassDTO != null){                        forwardURI.append(forwardClassSchedule);                        forwardURI.append(schoolClassDTO.getSchoolClassId());                        forwardURI.append("&nameDegreeCurricularPlan=");                        forwardURI.append(schoolClassDTO.getDegreeCurricularPlanName());                        forwardURI.append("&degreeInitials=");                        forwardURI.append(schoolClassDTO.getDegreeInitials());                        forwardURI.append("&degreeID=");                        forwardURI.append(schoolClassDTO.getDegreeId());                        forwardURI.append("&degreeCurricularPlanID=");                        forwardURI.append(schoolClassDTO.getDegreeCurricularPlanId());                        forwardURI.append("&className=");                        forwardURI.append(schoolClassDTO.getSchoolClassName());                    }                }	            	        } else {	        	forwardURI.append(notFoundURI);	        }        }        response.sendRedirect(forwardURI.toString());    }