List of usage examples for javax.servlet.http HttpServletRequest getRequestURI
public String getRequestURI();
From source file:io.seldon.api.handler.ApiHandlerExceptionResolver.java
@Override protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { String requestURI = request.getRequestURI(); String queryString = request.getQueryString(); logger.error("Uncaught exception: " + ex.getMessage() + " for " + requestURI + " with query " + queryString, ex);// w w w. j av a2 s .c o m return super.doResolveException(request, response, handler, ex); }
From source file:net.anthonychaves.bookmarks.web.UserAuthorizationInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String uri = request.getRequestURI(); User user = (User) request.getSession().getAttribute("user"); if (user != null || uri.indexOf("login") != -1) { return true; } else {// w w w . j a va 2 s . com response.sendError(HttpServletResponse.SC_FORBIDDEN, UNAUTHORIZED_MSG); return false; } }
From source file:mvc.interceptor.AutorizadorInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object controller) throws Exception { String uri = request.getRequestURI(); String contextPath = request.getContextPath(); if (uri.endsWith(contextPath) || uri.contains("index") || uri.contains("formLogin") || uri.contains("efetuaLogin") || uri.contains("listaTarefas") || uri.contains("resources")) { return true; }//from w ww . ja va 2s . c o m HttpSession session = request.getSession(); if (session.getAttribute("usuarioLogado") != null) { return true; } response.sendRedirect("formLogin"); return false; }
From source file:com.redhat.rhn.frontend.struts.RhnUnpagedListAction.java
/** * Sets up the ListControl filter data//from w w w. ja va 2s . c om * @param lc ListControl to use * @param request ServletRequest * @param viewer user requesting the page */ public void filterList(ListControl lc, ServletRequest request, User viewer) { /* * Make sure we have a user. If not, something bad happened and we should * just bail out with an exception. Since this is probably the result of * a bad uid param, throw a BadParameterException. */ if (viewer == null) { throw new BadParameterException("Null viewer"); } String filterData = request.getParameter(RequestContext.FILTER_STRING); request.setAttribute("isFiltered", Boolean.valueOf(!StringUtils.isEmpty(filterData))); if (!StringUtils.isBlank(filterData)) { HttpServletRequest req = (HttpServletRequest) request; createSuccessMessage(req, "filter.clearfilter", req.getRequestURI()); } lc.setFilterData(filterData); }
From source file:de.adorsys.oauth.server.RememberMeMatcher.java
@Override public boolean match(HttpServerExchange exchange, HttpServletRequest request) { String clientId = request.getParameter("client_id"); if (!request.getRequestURI().endsWith("/auth") || clientId == null) { return false; }// w ww.j a v a 2 s . c o m Cookie cookieToken = getCookieToken(clientId, request); return cookieToken != null; }
From source file:it.cnr.ilc.latmorphwebapp.ProxyHandler.java
private String getPath(final HttpServletRequest request) { try {// w ww . j a v a 2 s.c o m return StringUtils.replace(new URI(request.getRequestURI()).getPath(), "//", "/"); } catch (final URISyntaxException e) { return StringUtils.EMPTY; } }
From source file:eu.cloudwave.wp5.feedbackhandler.controller.AbstractBaseRestController.java
/** * Is called whenever an {@link Exception} in a controller method is thrown. * /*from w w w . jav a2 s. c om*/ * @param exception * the exception that arose * @param request * the request that caused the exception * @return an error message */ @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody public final RestRequestErrorDto handleException(final Exception exception, final HttpServletRequest request) { LogManager.getLogger(getClass()).error(String.format(EXCEPTION_MESSAGE, request.getRequestURI()), exception); return new RestRequestErrorDto(ErrorType.GENERAL, exception.getMessage()); }
From source file:Controladores.AutorizadorAcesso.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object controller) throws Exception { String uri = request.getRequestURI(); if (uri.toUpperCase().contains("RESTRITO")) { if (request.getSession().getAttribute("logado") == null || (boolean) request.getSession().getAttribute("logado") == false) { if (request.getQueryString() != null) { uri += "?" + request.getQueryString(); }//from w w w .j av a 2s .co m request.getSession().setAttribute("endereco", uri); RequestDispatcher dispacher = request.getRequestDispatcher("exibe-login"); dispacher.forward(request, response); return false; } } return true; }
From source file:org.spring4gwt.server.SpringGwtRemoteServiceServlet.java
/** * Parse the service name from the request URL. * /*w w w .ja va 2 s . co m*/ * @param request * @return bean name */ protected String getService(HttpServletRequest request) { String url = request.getRequestURI(); String service = url.substring(url.lastIndexOf("/") + 1); if (logger.isDebugEnabled()) { logger.debug("Service for URL {} is {}", url, service); } return service; }
From source file:eu.cloudwave.wp5.feedbackhandler.controller.AbstractBaseUiController.java
/** * Is called whenever an {@link Exception} in a controller method is thrown. * /*from w w w . j a va 2 s. co m*/ * @param exception * the exception that arose * @param request * the request that caused the exception * @return an error message */ @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody public final ModelAndView handleException(final Exception exception, final HttpServletRequest request) { LogManager.getLogger(getClass()).error(String.format(EXCEPTION_MESSAGE, request.getRequestURI()), exception); return htmlErrorPage(exception.getMessage()); }