List of usage examples for javax.servlet.http HttpServletRequest getPathInfo
public String getPathInfo();
From source file:eu.rethink.lhcb.broker.servlet.WellKnownServlet.java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { LOG.debug("got GET request on {}", req.getPathInfo()); handleRequest(req, resp);//from w w w.j ava 2 s .c o m }
From source file:it.geosolutions.opensdi2.configurations.controller.OSDIModuleController.java
/** * It returns the scopeID extracting the first part of the path after the servlet path. * If the module is implemented as a spring controller (as suggested) the method request.getPathInfo() * used in this method internally returns the path after the the URL of the SpringMVC Dispatcher Servlet. * So the first part of the result will be for sure the name of the module as defined by convention. * // ww w .j a va 2 s .c o m * the URL of the SpringMVC Dispatcher Servlet * * @param req * @return */ protected String getScopeID(HttpServletRequest req) { String path = req.getPathInfo(); if (path == null) { throw new IllegalArgumentException( "The path found in the request is null... this should never happen..."); } LOGGER.debug( "Extracting first part of the following path '" + path + "' in order to get the module name..."); String[] parts = path.split("/"); if (parts == null || parts.length == 0 || parts[0] == null) { throw new IllegalArgumentException("no scopeID is found... this should never happen..."); } if (StringUtils.isNotEmpty(parts[0])) { return parts[0]; } for (int i = 0; i < parts.length; i++) { if (StringUtils.isNotEmpty(parts[i])) { return parts[i]; } } String scopeID = getPathFragment(req, 0); if (scopeID == null) { throw new IllegalArgumentException( "no scopeID is found after all the possible attemps... this should never happen..."); } return scopeID; }
From source file:cat.calidos.morfeu.webapp.GenericHttpServlet.java
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String path = req.getPathInfo(); log.trace("GenericMorfeuServlet::doPost {}", path); Map<String, String> params = normaliseParams(req.getParameterMap()); params.put(METHOD, req.getMethod()); String content = IOUtils.toString(req.getInputStream(), Config.DEFAULT_CHARSET); params.put(POST_VALUE, content);//from ww w . ja v a2s .c o m params = processParams(params); ControlComponent controlComponent = putControl(path, params); handleResponse(resp, controlComponent); }
From source file:com.ecyrd.jspwiki.dav.WikiDavServlet.java
@Override protected void doOptions(HttpServletRequest req, HttpServletResponse res) { log.debug("DAV doOptions for path " + req.getPathInfo()); res.setHeader("DAV", "1"); // We support only Class 1 res.setHeader("Allow", "GET, PUT, POST, OPTIONS, PROPFIND, PROPPATCH, MOVE, COPY, DELETE"); res.setStatus(HttpServletResponse.SC_OK); }
From source file:de.thischwa.pmcms.server.ZipProxyServlet.java
@Override protected void doRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String reqPath = req.getPathInfo(); if (reqPath.startsWith("/")) reqPath = reqPath.substring(1);//from w w w . j a va 2s .c o m ZipEntry entry = zipInfo.get(reqPath); if (entry == null) { logger.debug(Utils.join("Requested path not found: [", reqPath, "]")); resp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } logger.debug(Utils.join("Requested path: [", reqPath, "]")); ServletUtils.establishContentType(reqPath, resp); InputStream in = null; try { in = new BufferedInputStream(zipFile.getInputStream(entry)); IOUtils.copy(in, resp.getOutputStream()); logger.debug("Rendered: " + reqPath); } catch (FileNotFoundException e) { logger.error("zipped resource not found: " + reqPath); } finally { IOUtils.closeQuietly(in); } }
From source file:eu.rethink.lhcb.broker.servlet.WellKnownServlet.java
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { LOG.debug("got POST request on {}", req.getPathInfo()); handleRequest(req, resp);//from w w w . j ava 2s.c om }
From source file:eu.semlibproject.annotationserver.filters.AuthFilter.java
/** * Check if the request for an open API (authentication not required) * /*from w w w . j a v a 2s. c o m*/ * @param request the httpServletRequest * @return <code>true</code> is the requested API is open */ private boolean isANoAuthAPI(HttpServletRequest request) { String pathInfo = request.getPathInfo(); return noAuthAPI.contains(pathInfo); }
From source file:com.apress.progwt.server.web.controllers.CollegeController.java
@RequestMapping(method = RequestMethod.GET) public String collegeHandler(HttpServletRequest req, ModelMap model) throws InfrastructureException { log.debug("SERVLET PATH: " + req.getServletPath() + " " + req.getPathInfo() + " " + req.getQueryString()); String path = req.getPathInfo(); path = path.replace('_', ' '); String[] pathParts = path.split("/"); log.debug("!path parts " + Arrays.toString(pathParts)); // "/college/dartmouth" splits to [,dartmouth] if (pathParts.length < 2) { return getNotFoundView(); }/* w ww . jav a2s . c o m*/ String schoolName = pathParts[1]; School school = schoolService.getSchoolDetails(schoolName); if (school == null) { model.addAttribute("message", "Couldn't find school " + schoolName); return getNotFoundView(); } PostsList forumPosts = schoolService.getForum(school, 0, 10); ForumBootstrap forumBootstrap = new ForumBootstrap(serializer, forumPosts, school); model.addAttribute("forumBootstrap", forumBootstrap); model.addAttribute("school", school); model.addAttribute("interestedIn", schoolService.getUsersInterestedIn(school)); ControllerUtil.updateModelMapWithDefaults(model, req, userService); return view; }
From source file:de.bermuda.arquillian.example.ContentTypeProxyServlet.java
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String localPathInfo = req.getPathInfo() == null ? "" : req.getPathInfo(); String queryString = req.getQueryString(); log.info("Setting URL to: " + serviceURL.toExternalForm() + localPathInfo); PostMethod post = new PostMethod(serviceURL.toExternalForm() + localPathInfo); post.setQueryString(queryString);// w ww . j a v a 2 s. c o m copyRequestHeaders(req, post); copyRequestBody(req, post); try { int statusCode = client.executeMethod(post); if (statusCode != HttpStatus.SC_OK) { log.warn("Could not post request to i.Serve: " + statusCode); } migrateResponseHeader(resp, post); copyResponseContent(resp, post); } catch (HttpException e) { log.error("Catched HTTPException: ", e); } catch (IOException e) { log.error("Catched IOException: ", e); } }
From source file:ca.flop.jpublish.dwr.DWRUrlProcessor.java
public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException { log.info("-Why are you calling me? " + request.getPathInfo()); }