List of usage examples for javax.servlet.http HttpServletRequest getServletPath
public String getServletPath();
From source file:de.sainth.recipe.backend.rest.controller.LogoutController.java
@RequestMapping() @ResponseStatus(HttpStatus.NO_CONTENT)// w w w. j a v a 2s.co m void logout(HttpServletRequest request, HttpServletResponse response) { if ("/logout".equals(request.getServletPath())) { Optional<Cookie> cookie = Arrays.stream(request.getCookies()) .filter(c -> "recipe_bearer".equals(c.getName())).findFirst(); if (cookie.isPresent()) { Cookie c = cookie.get(); c.setValue(""); c.setPath("/"); c.setMaxAge(0); response.addCookie(c); } response.setStatus(HttpServletResponse.SC_NO_CONTENT); } }
From source file:com.roncoo.pay.controller.filter.UserFilter.java
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; String uri = request.getServletPath(); // LOG.info("=== uri=" + uri); // ?//from w w w. j a va2 s. co m RpUserInfo rpUserInfo = (RpUserInfo) request.getSession().getAttribute(ConstantClass.USER); // ,??? if (uri.contains("merchant") && rpUserInfo == null) { HttpServletResponse response = (HttpServletResponse) res; response.sendRedirect(request.getContextPath() + "/login"); } else { chain.doFilter(req, res); } }
From source file:com.clemble.social.UserInterceptor.java
private boolean requireSignIn(HttpServletRequest request, HttpServletResponse response) throws Exception { if (!request.getServletPath().startsWith("/signin")) { new RedirectView("/signin", true).render(null, request, response); return false; } else {//from w w w . j ava2 s . c o m return true; } }
From source file:net.sf.j2ep.rules.Cloud9RewriteRule.java
/** * Will see if the directory for the incoming URI is the same * as this rule is set to match on.// ww w .j a va 2 s . c o m * * @see net.sf.j2ep.model.Rule#matches(javax.servlet.http.HttpServletRequest) */ public boolean matches(HttpServletRequest request) { String uri = request.getServletPath(); //System.out.println("matches" + uri + " ref" + request.getHeader("Referer")); return (uri.startsWith(directory)); }
From source file:org.smigo.HomeController.java
@RequestMapping(value = { "/garden-planner", "/login", "/register", "/forum", "/account", "/request-password-link", "/accept-terms-of-service", "/welcome-back" }, method = RequestMethod.GET) public String getGarden(Model model, HttpServletRequest request, HttpServletResponse response) { final String path = request.getServletPath().replace("/", ""); model.addAttribute("msgTitle", "msg.concat.title." + path); model.addAttribute("msgDescription", "msg.concat.metadescription." + path); return "ng.jsp"; }
From source file:com.eryansky.common.orm.hibernate.OpenSessionInViewFilter.java
/** * ?,???.//from ww w . ja v a 2 s .c o m */ @Override protected boolean shouldNotFilter(final HttpServletRequest request) throws ServletException { String path = request.getServletPath(); // INCLUDEURLfalse???EXCLUDE???. for (String suffix : DEFAULT_INCLUDE_SUFFIXS) { if (path.endsWith(suffix)) return false; } for (String suffix : excludeSuffixs) { if (path.endsWith(suffix)) return true; } return false; }
From source file:com.anderl.hibernate.ext.IgnorableFilter.java
protected boolean isIgnoredUrl(HttpServletRequest request) { String currentUrl = request.getServletPath(); initIgnoredUrls();//from www . j a v a 2 s . c om if (ignoredUrls == null) return false; for (String ignoredUrl : ignoredUrls) { if (currentUrl.startsWith(ignoredUrl)) return true; } return false; }
From source file:com.googlecode.psiprobe.controllers.BeanToXmlController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String path = request.getServletPath(); String internalPath = path.replaceAll(xmlMarker, ""); Controller controller = (Controller) getApplicationContext().getBean(internalPath); if (controller != null) { ModelAndView modelAndView = controller.handleRequest(request, response); if (modelAndView.getModel() != null) { TransportableModel tm = new TransportableModel(); tm.putAll(modelAndView.getModel()); XStream x = new XStream(); x.toXML(tm, response.getWriter()); }/* ww w . j a v a 2 s . c o m*/ } return null; }
From source file:com.apress.progwt.server.web.controllers.MyListController.java
@Override protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse arg1) throws Exception { log.debug("SERVLET PATH: " + req.getServletPath() + " " + req.getPathInfo() + " " + req.getQueryString()); Map<String, Object> model = getDefaultModel(req); ModelAndView mav = getMav();/* w w w . jav a 2 s. com*/ mav.addAllObjects(model); return mav; }
From source file:com.bstek.dorado.web.servlet.DoradoServlet.java
@Override protected HttpServletRequest checkMultipart(HttpServletRequest request) throws MultipartException { String servletName = request.getServletPath(); if (!"/dorado".equals(servletName)) { return super.checkMultipart(request); } else {//from ww w. j a v a2 s .c o m return request; } }