Example usage for javax.servlet.http HttpServletRequest getPathInfo

List of usage examples for javax.servlet.http HttpServletRequest getPathInfo

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getPathInfo.

Prototype

public String getPathInfo();

Source Link

Document

Returns any extra path information associated with the URL the client sent when it made this request.

Usage

From source file:gallery.web.controller.wallpaper.WallpaperResizeController.java

@Override
public long getLastModified(HttpServletRequest request) {
    return wallpaperService.getWallpaperLastModified(request.getPathInfo());
}

From source file:com.thinkberg.moxo.dav.UnlockHandler.java

public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
    FileObject object = getResourceManager().getFileObject(request.getPathInfo());
    String lockTokenHeader = request.getHeader("Lock-Token");
    String lockToken = lockTokenHeader.substring(1, lockTokenHeader.length() - 1);
    log("UNLOCK(" + lockToken + ")");

    if (LockManager.getInstance().releaseLock(object, lockToken)) {
        response.setStatus(HttpServletResponse.SC_NO_CONTENT);
    } else {/*  w w  w  .j  ava  2s.c om*/
        response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    }
}

From source file:io.mapzone.controller.vm.repository.ProjectInstanceIdentifier.java

/**
 * //  w  w  w .j a va2  s  .  c o m
 * @param request
 */
public ProjectInstanceIdentifier(HttpServletRequest request) {
    try {
        String[] parts = split(URLDecoder.decode(request.getPathInfo(), "UTF8"), "/");
        this.project = parts[1];
        this.organization = parts[0];
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.thinkberg.moxo.dav.HeadHandler.java

public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
    FileObject object = getResourceManager().getFileObject(request.getPathInfo());

    if (object.exists()) {
        if (FileType.FOLDER.equals(object.getType())) {
            response.sendError(HttpServletResponse.SC_FORBIDDEN);
        } else {/*from   w  w  w. j a  va 2s. com*/
            setHeader(response, object.getContent());
        }
    } else {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
    }
}

From source file:gov.nih.nci.cabig.ctms.lookandfeel.AssetServlet.java

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    if (req.getPathInfo().contains("..")) {
        resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Illegal path");
        return;/*from w w w.  j a v  a  2s.  co  m*/
    }
    String resource = resourcePath(req.getPathInfo());
    String mimeType = contentType(req.getPathInfo());
    if (mimeType != null) {
        resp.setContentType(mimeType);
    }
    // TODO: this is primitive.  Should add content-length at least
    InputStream resStream = getClass().getResourceAsStream(resource);
    if (resStream == null) {
        resp.sendError(HttpServletResponse.SC_NOT_FOUND);
    } else {
        IOUtils.copy(resStream, resp.getOutputStream());
    }
}

From source file:com.cloudera.oryx.kmeans.serving.web.DistanceToNearestServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    CharSequence pathInfo = request.getPathInfo();
    if (pathInfo == null) {
        response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No path");
        return;//from  w w w  . j av a2 s . com
    }
    String line = pathInfo.subSequence(1, pathInfo.length()).toString();

    Generation generation = getGenerationManager().getCurrentGeneration();
    if (generation == null) {
        response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
                "API method unavailable until model has been built and loaded");
        return;
    }

    String[] tokens = DelimitedDataUtils.decode(line);
    RealVector vector = generation.toVector(tokens);
    if (vector == null) {
        response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Wrong column count");
        return;
    }
    double distance = findClosest(generation, vector).getSquaredDistance();
    response.getWriter().write(Double.toString(distance));
}

From source file:com.orangeandbronze.jblubble.sample.UploadServlet.java

@Override
protected long getLastModified(HttpServletRequest request) {
    String pathInfo = request.getPathInfo();
    if (pathInfo == null) {
        pathInfo = "/";
    }//  ww w.ja v a  2  s.c  o  m
    if (!"/create".equals(pathInfo) && pathInfo.length() > 1) {
        LOGGER.debug("GET Last-Modified {}{}", PATH, pathInfo);
        BlobKey blobKey = new BlobKey(pathInfo.substring(1));
        BlobInfo blobInfo = blobstoreService.getBlobInfo(blobKey);
        return blobInfo.getDateCreated().getTime();
    }
    return super.getLastModified(request);
}

From source file:nl.npcf.eav.web.EAVExceptionResolver.java

public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object o,
        Exception e) {/*from  ww  w .j  ava  2 s .c  o m*/
    String pathInfo = request.getPathInfo();
    if (pathInfo != null && pathInfo.startsWith("/edit")) {
        try {
            PrintWriter out = response.getWriter();
            out.println("<html><head><title>Exception</title></head><body>");
            out.println("<pre>");
            out.println(EAVResponse.getStackTrace(e));
            out.println("</pre>");
            out.println("</body>");
        } catch (IOException e1) {
            logger.fatal("Can't report exception");
        }
    } else {
        response.setContentType("text/xml");
        try {
            new EAVXStream().toXML(EAVResponse.create(e), response.getOutputStream());
        } catch (IOException e1) {
            logger.fatal("Cannot respond with exception", e);
        }
    }
    return null;
}

From source file:org.dspace.app.webui.cris.controller.FormRelationManagementController.java

private String getUUID(HttpServletRequest request) {
    String pathInfo = request.getPathInfo();
    // example /uuid/XXXXXXXXX/relMgmt/publications
    String path = pathInfo.substring("/uuid/".length());
    String[] splitted = path.split("/");
    String uuid = splitted[0];/*www  .j ava  2s.com*/
    return uuid;
}

From source file:org.dspace.app.webui.cris.controller.FormRelationManagementController.java

private String getRelationType(HttpServletRequest request) {
    String pathInfo = request.getPathInfo();
    // example /uuid/XXXXXXXXX/relMgmt/publications
    String path = pathInfo.substring("/uuid/".length());
    String[] splitted = path.split("/");
    String type = splitted[2];//from ww  w.jav a2  s.co m
    return type;
}