List of usage examples for javax.servlet.http HttpServletRequest getPathInfo
public String getPathInfo();
From source file:com.xclinical.mdr.server.DocumentServlet.java
protected Document fromPath(HttpServletRequest req) { String path = req.getPathInfo(); if (path == null) { return null; } else {/*from w w w . j a v a 2 s . c o m*/ String idString = path.substring(1); Key key = Key.create(com.xclinical.mdr.client.iso11179.model.Document.URN, Long.parseLong(idString)); Document document = (Document) PMF.find(key); return document; } }
From source file:cat.calidos.morfeu.webapp.GenericHttpServlet.java
/** @param req from the servlet * @return normalised path that does not start with '/' *//* www.j ava2s . c om*/ protected String normalisedPathFrom(HttpServletRequest req) { //String path = req.getPathTranslated(); String path = req.getPathInfo(); // internal model paths are not started with a slash (see tests) if (path.startsWith("/")) { path = path.substring(1); } return path; }
From source file:com.citrix.cpbm.portal.fragment.controllers.AbstractAPIProxyController.java
@RequestMapping(value = { "/{apiSuffix}", "/{apiSuffix}/", "/{apiSuffix}/**" }) public void request(@PathVariable String apiSuffix, HttpServletRequest httpRequest, HttpServletResponse httpResponse) { String urlFragment = getUrlFragment(apiSuffix, httpRequest.getPathInfo()); handleRequest(apiSuffix, urlFragment, httpRequest, httpResponse); }
From source file:org.openi.pentaho.plugin.JAXRSPluginServlet.java
@Override public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.debug("servicing request for resource " + request.getPathInfo()); //$NON-NLS-1$ super.service(request, response); }
From source file:org.toobsframework.pres.url.mapping.RestHandlerMapping.java
@Override protected Object getHandlerInternal(HttpServletRequest request) throws Exception { String[] paths = UrlMappingUtil.tokenizePath(request.getPathInfo()); UrlMapping mapping = urlManager.getUrlMapping(paths); if (mapping == null) { return null; }/*w ww.jav a 2 s. co m*/ RestDispatchInfo dispatchInfo = createDispatchInfo(paths, mapping); createRequestAttributes(request, dispatchInfo); return getController(dispatchInfo); }
From source file:controllers.ChargesControllerServlet.java
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request/* w ww .ja v a2 s. c o m*/ * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String path = request.getPathInfo(); String url = path; if (url == null || url.equals("/")) { url = "/WEB-INF/jsp/charges/index.jsp"; ArrayList charges = models.Charge.all(); request.setAttribute("charges", charges); } else if (url.matches("/new")) { url = "/WEB-INF/jsp/charges/new.jsp"; } else if (url.matches("/\\d+/buy")) { url = "/WEB-INF/jsp/charges/buy.jsp"; } else if (url.matches("/\\d+")) { url = "/WEB-INF/jsp/charges/show.jsp"; } request.getRequestDispatcher(url).forward(request, response); }
From source file:org.shredzone.bullshitcharts.servlet.ChartServlet.java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pathInfo = req.getPathInfo(); PlotGenerator generator = null;/* w w w .j a va2s . c o m*/ if ("/pie.png".equals(pathInfo)) { generator = new ChoicePieGenerator(); } else if ("/agree.png".equals(pathInfo)) { generator = new AgreementPieGenerator(); } else if ("/line.png".equals(pathInfo)) { generator = new LineChartGenerator(); } else if ("/bar.png".equals(pathInfo)) { generator = new BarChartGenerator(); } else { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } generator.configure(req); Plot plot = generator.generate(); // Generate the chart JFreeChart chart = new JFreeChart(plot); chart.setAntiAlias(true); chart.setTextAntiAlias(true); chart.setBorderVisible(false); chart.removeLegend(); String title = req.getParameter("title"); if (title != null) { chart.setTitle(title); } // Write the chart to a byte array. It is small enough so it won't load the // server's memory too much. try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { ChartUtilities.writeChartAsPNG(baos, chart, IMAGE_WIDTH, IMAGE_HEIGHT); byte[] data = baos.toByteArray(); // Stream the chart resp.setContentType("image/png"); resp.setContentLength(data.length); resp.setHeader("Cache-Control", "no-cache, must-revalidate"); resp.setHeader("Expires", "Sat, 01 Jan 2000 00:00:00 GMT"); resp.getOutputStream().write(data); } }
From source file:jp.co.opentone.bsol.linkbinder.view.servlet.WebResourceServlet.java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String path = req.getPathInfo(); if (isJavascript(path)) { serveResource(req, resp, javascript, path); } else if (isStylesheet(path)) { serveResource(req, resp, stylesheet, path); } else {/*from w w w . j ava2 s . co m*/ resp.sendError(HttpServletResponse.SC_NOT_FOUND); } }
From source file:org.socialsignin.springsocial.security.signin.SpringSocialSecurityAccessDeniedHandler.java
public String getUri(HttpServletRequest request) { return request.getServletPath() + (request.getPathInfo() == null ? "" : request.getPathInfo()); }
From source file:com.myjeeva.spring.security.securechannel.AbstractCrossDomainRetryEntryPoint.java
/** * {@inheritDoc}//www . j a v a2 s . c o m */ public void commence(ServletRequest req, ServletResponse res) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; String pathInfo = request.getPathInfo(); String queryString = request.getQueryString(); String contextPath = request.getContextPath(); String destination = request.getServletPath() + ((pathInfo == null) ? "" : pathInfo) + ((queryString == null) ? "" : ("?" + queryString)); String redirectUrl = contextPath; Integer currentPort = new Integer(portResolver.getServerPort(request)); Integer redirectPort = getMappedPort(currentPort); if (redirectPort != null) { boolean includePort = redirectPort.intValue() != standardPort; redirectUrl = scheme + getMappedDomain(request.getServerName()) + ((includePort) ? (":" + redirectPort) : "") + contextPath + destination; } LOG.debug(" Cross Domain EntryPoint Redirecting to: " + redirectUrl); ((HttpServletResponse) res).sendRedirect(((HttpServletResponse) res).encodeRedirectURL(redirectUrl)); }