List of usage examples for javax.servlet.http HttpServletRequest getRequestURI
public String getRequestURI();
From source file:architecture.ee.web.util.ServletUtils.java
public static String getServletPath(HttpServletRequest request) { String thisPath = request.getServletPath(); if (thisPath == null) { String requestURI = request.getRequestURI(); if (request.getPathInfo() != null) thisPath = requestURI.substring(0, requestURI.indexOf(request.getPathInfo())); else/* www . j ava 2s . co m*/ thisPath = requestURI; } else if (thisPath.equals("") && request.getPathInfo() != null) thisPath = request.getPathInfo(); return thisPath; }
From source file:com.belajar_filter.config.FilterBeanConfig.java
public static Filter myFilter() { Filter filter = new Filter() { private ServletContext context; @Override/*from www. ja v a 2 s . co m*/ public void init(FilterConfig filterConfig) throws ServletException { log.debug("initiate general filter config"); this.context = filterConfig.getServletContext(); this.context.log("AuthenticationFilter initialized"); } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc) throws IOException, ServletException { log.debug("execute do filter ... "); HttpServletResponse response = (HttpServletResponse) res; HttpServletRequest request = (HttpServletRequest) req; String getParam = request.getParameter("name"); String urlRequest = request.getRequestURI(); log.debug("intercept url request : " + urlRequest); log.debug("intercept param : " + getParam); if ("aji".equals(getParam)) { log.debug("is aji"); fc.doFilter(req, res); } else { log.debug("is not aji"); response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE); } } @Override public void destroy() { } }; return filter; }
From source file:com.edgenius.core.util.WebUtil.java
public static boolean isAjaxRequest(HttpServletRequest request) { String uri = request.getRequestURI(); for (String suffix : AJAX_URL_SUFFIX) { if (uri.endsWith(suffix)) return true; }/*w ww.j a v a 2s. com*/ return false; }
From source file:org.apache.atlas.web.util.Servlets.java
/** * Returns the URI of the given request. * * @param httpRequest an HTTP servlet request * @return the URI, including the query string *///w ww. j av a 2 s . c om public static String getRequestURI(HttpServletRequest httpRequest) { final StringBuilder url = new StringBuilder(100).append(httpRequest.getRequestURI()); if (httpRequest.getQueryString() != null) { url.append('?').append(httpRequest.getQueryString()); } return url.toString(); }
From source file:com.thinkberg.webdav.WebdavHandler.java
protected static URL getBaseUrl(HttpServletRequest request) { try {//from www .ja v a2 s. co m String requestUrl = request.getRequestURL().toString(); String requestUri = request.getRequestURI(); String requestUrlBase = requestUrl.substring(0, requestUrl.length() - requestUri.length()); return new URL(requestUrlBase); } catch (MalformedURLException e) { // ignore ... } return null; }
From source file:com.thinkberg.moxo.dav.WebdavHandler.java
static URL getBaseUrl(HttpServletRequest request) { try {//from w ww .j a v a 2s. c o m String requestUrl = request.getRequestURL().toString(); String requestUri = request.getRequestURI(); String requestUrlBase = requestUrl.substring(0, requestUrl.length() - requestUri.length()); return new URL(requestUrlBase); } catch (MalformedURLException e) { // ignore ... } return null; }
From source file:com.eastcom.baseframe.web.common.utils.Servlets.java
public static String getRequestURI(HttpServletRequest request) { return request.getRequestURI(); }
From source file:info.magnolia.cms.core.Path.java
public static String getExtension(HttpServletRequest req) { return StringUtils.substringAfterLast(req.getRequestURI(), "."); //$NON-NLS-1$ }
From source file:com.liusoft.dlog4j.util.RequestUtils.java
/** * ?URL//from ww w.j a v a 2 s.c om * @param req * @return */ public static String getRequestURL(HttpServletRequest req) { StringBuffer url = new StringBuffer(req.getRequestURI()); String param = req.getQueryString(); if (param != null) { url.append('?'); url.append(param); } String path = url.toString(); return path.substring(req.getContextPath().length()); }
From source file:grails.util.GrailsWebUtil.java
/** * Retrieves the URI from the request from either the include attribute or the request.getRequestURI() method. * * @param request The HttpServletRequest instance * @return The String URI/* w w w .j a v a2 s . c om*/ */ public static String getUriFromRequest(HttpServletRequest request) { Object includeUri = request.getAttribute("javax.servlet.include.request_uri"); return includeUri == null ? request.getRequestURI() : (String) includeUri; }