Package org.apache.jackrabbit.server.util

Examples of org.apache.jackrabbit.server.util.RequestData


            throws IOException, DavException {
        if (canHandle(DavMethods.DAV_POST, webdavRequest, davResource)) {
            // special remoting request: the defined parameters are exclusive
            // and cannot be combined.
            Session session = getRepositorySession(webdavRequest);
            RequestData data = new RequestData(webdavRequest, getTempDirectory(getServletContext()));
            String loc = null;
            try {
                String[] pValues;
                if ((pValues = data.getParameterValues(PARAM_CLONE)) != null) {
                    loc = clone(session, pValues, davResource.getLocator());
                } else if ((pValues = data.getParameterValues(PARAM_COPY)) != null) {
                    loc = copy(session, pValues, davResource.getLocator());
                } else if (data.getParameterValues(PARAM_DIFF) != null) {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    processDiff(session, targetPath, data);
                } else {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    loc = modifyContent(session, targetPath, data);
                }

                // TODO: append entity
                if (loc == null) {
                    webdavResponse.setStatus(HttpServletResponse.SC_OK);
                } else {
                    webdavResponse.setHeader(DeltaVConstants.HEADER_LOCATION, loc);
                    webdavResponse.setStatus(HttpServletResponse.SC_CREATED);
                }
            } catch (RepositoryException e) {
                log.warn(e.getMessage());
                throw new JcrDavException(e);
            } catch (DiffException e) {
                log.warn(e.getMessage());
                Throwable cause = e.getCause();
                if (cause instanceof RepositoryException) {
                    throw new JcrDavException((RepositoryException) cause);
                } else {
                    throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid diff format.");
                }
            } finally {
                data.dispose();
            }
        } else {
            super.doPost(webdavRequest, webdavResponse, davResource);
        }
    }
View Full Code Here


            throws IOException, DavException {
        if (canHandle(DavMethods.DAV_POST, webdavRequest, davResource)) {
            // special remoting request: the defined parameters are exclusive
            // and cannot be combined.
            Session session = getRepositorySession(webdavRequest);
            RequestData data = new RequestData(webdavRequest, getTempDirectory(getServletContext()));
            String loc = null;
            try {
                String[] pValues;
                if ((pValues = data.getParameterValues(PARAM_CLONE)) != null) {
                    loc = clone(session, pValues, davResource.getLocator());
                } else if ((pValues = data.getParameterValues(PARAM_COPY)) != null) {
                    loc = copy(session, pValues, davResource.getLocator());
                } else if (data.getParameterValues(PARAM_DIFF) != null) {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    processDiff(session, targetPath, data);
                } else {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    loc = modifyContent(session, targetPath, data);
                }

                // TODO: append entity
                if (loc == null) {
                    webdavResponse.setStatus(HttpServletResponse.SC_OK);
                } else {
                    webdavResponse.setHeader(DeltaVConstants.HEADER_LOCATION, loc);
                    webdavResponse.setStatus(HttpServletResponse.SC_CREATED);
                }
            } catch (RepositoryException e) {
                log.warn(e.getMessage());
                throw new JcrDavException(e);
            } catch (DiffException e) {
                log.warn(e.getMessage());
                Throwable cause = e.getCause();
                if (cause instanceof RepositoryException) {
                    throw new JcrDavException((RepositoryException) cause);
                } else {
                    throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid diff format.");
                }
            } finally {
                data.dispose();
            }
        } else {
            super.doPost(webdavRequest, webdavResponse, davResource);
        }
    }
View Full Code Here

            throws IOException, DavException {
        if (canHandle(DavMethods.DAV_POST, webdavRequest, davResource)) {
            // special remoting request: the defined parameters are exclusive
            // and cannot be combined.
            Session session = getRepositorySession(webdavRequest);
            RequestData data = new RequestData(webdavRequest, getTempDirectory(getServletContext()));
            String loc = null;
            try {
                String[] pValues;
                if ((pValues = data.getParameterValues(PARAM_CLONE)) != null) {
                    loc = clone(session, pValues, davResource.getLocator());
                } else if ((pValues = data.getParameterValues(PARAM_COPY)) != null) {
                    loc = copy(session, pValues, davResource.getLocator());
                } else if (data.getParameterValues(PARAM_DIFF) != null) {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    processDiff(session, targetPath, data);
                } else {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    loc = modifyContent(session, targetPath, data);
                }

                // TODO: append entity
                if (loc == null) {
                    webdavResponse.setStatus(HttpServletResponse.SC_OK);
                } else {
                    webdavResponse.setHeader(DeltaVConstants.HEADER_LOCATION, loc);
                    webdavResponse.setStatus(HttpServletResponse.SC_CREATED);
                }
            } catch (RepositoryException e) {
                log.warn(e.getMessage());
                throw new JcrDavException(e);
            } catch (DiffException e) {
                log.warn(e.getMessage());
                Throwable cause = e.getCause();
                if (cause instanceof RepositoryException) {
                    throw new JcrDavException((RepositoryException) cause);
                } else {
                    throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid diff format.");
                }
            } finally {
                data.dispose();
            }
        } else {
            super.doPost(webdavRequest, webdavResponse, davResource);
        }
    }
View Full Code Here

            throws IOException, DavException {
        if (canHandle(DavMethods.DAV_POST, webdavRequest, davResource)) {
            // special remoting request: the defined parameters are exclusive
            // and cannot be combined.
            Session session = getRepositorySession(webdavRequest);
            RequestData data = new RequestData(webdavRequest, getTempDirectory(getServletContext()));
            String loc = null;
            try {
                String[] pValues;
                String[] includes = null; // multi-read over POST
                if ((pValues = data.getParameterValues(PARAM_CLONE)) != null) {
                    loc = clone(session, pValues, davResource.getLocator());
                } else if ((pValues = data.getParameterValues(PARAM_COPY)) != null) {
                    loc = copy(session, pValues, davResource.getLocator());
                } else if (data.getParameterValues(PARAM_DIFF) != null) {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    processDiff(session, targetPath, data);
                } else if ((pValues = data.getParameterValues(PARAM_INCLUDE)) != null
                        && canHandle(DavMethods.DAV_GET, webdavRequest, davResource)) {
                    includes = pValues;
                } else {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    loc = modifyContent(session, targetPath, data);
                }

                // TODO: append entity
                if (loc == null) {
                    webdavResponse.setStatus(HttpServletResponse.SC_OK);
                    if (includes != null) {
                        webdavResponse.setContentType("text/plain;charset=utf-8");
                        JsonWriter writer = new JsonWriter(webdavResponse.getWriter());

                        DavResourceLocator locator = davResource.getLocator();
                        String path = locator.getRepositoryPath();

                        Node node = session.getNode(path);
                        int depth = ((WrappingLocator) locator).getDepth();

                        writeMultiple(writer, node, includes, depth);
                    }
                } else {
                    webdavResponse.setHeader(DeltaVConstants.HEADER_LOCATION, loc);
                    webdavResponse.setStatus(HttpServletResponse.SC_CREATED);
                }
            } catch (RepositoryException e) {
                log.warn(e.getMessage());
                throw new JcrDavException(e);
            } catch (DiffException e) {
                log.warn(e.getMessage());
                Throwable cause = e.getCause();
                if (cause instanceof RepositoryException) {
                    throw new JcrDavException((RepositoryException) cause);
                } else {
                    throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid diff format.");
                }
            } finally {
                data.dispose();
            }
        } else {
            super.doPost(webdavRequest, webdavResponse, davResource);
        }
    }
View Full Code Here

            throws IOException, DavException {
        if (canHandle(DavMethods.DAV_POST, webdavRequest, davResource)) {
            // special remoting request: the defined parameters are exclusive
            // and cannot be combined.
            Session session = getRepositorySession(webdavRequest);
            RequestData data = new RequestData(webdavRequest, getTempDirectory(getServletContext()));
            String loc = null;
            try {
                String[] pValues;
                String[] includes = null; // multi-read over POST
                if ((pValues = data.getParameterValues(PARAM_CLONE)) != null) {
                    loc = clone(session, pValues, davResource.getLocator());
                } else if ((pValues = data.getParameterValues(PARAM_COPY)) != null) {
                    loc = copy(session, pValues, davResource.getLocator());
                } else if (data.getParameterValues(PARAM_DIFF) != null) {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    processDiff(session, targetPath, data);
                } else if ((pValues = data.getParameterValues(PARAM_INCLUDE)) != null
                        && canHandle(DavMethods.DAV_GET, webdavRequest, davResource)) {
                    includes = pValues;
                } else {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    loc = modifyContent(session, targetPath, data);
                }

                // TODO: append entity
                if (loc == null) {
                    webdavResponse.setStatus(HttpServletResponse.SC_OK);
                    if (includes != null) {
                        webdavResponse.setContentType("text/plain;charset=utf-8");
                        JsonWriter writer = new JsonWriter(webdavResponse.getWriter());

                        DavResourceLocator locator = davResource.getLocator();
                        String path = locator.getRepositoryPath();

                        Node node = session.getNode(path);
                        int depth = ((WrappingLocator) locator).getDepth();

                        writeMultiple(writer, node, includes, depth);
                    }
                } else {
                    webdavResponse.setHeader(DeltaVConstants.HEADER_LOCATION, loc);
                    webdavResponse.setStatus(HttpServletResponse.SC_CREATED);
                }
            } catch (RepositoryException e) {
                log.warn(e.getMessage());
                throw new JcrDavException(e);
            } catch (DiffException e) {
                log.warn(e.getMessage());
                Throwable cause = e.getCause();
                if (cause instanceof RepositoryException) {
                    throw new JcrDavException((RepositoryException) cause);
                } else {
                    throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid diff format.");
                }
            } finally {
                data.dispose();
            }
        } else {
            super.doPost(webdavRequest, webdavResponse, davResource);
        }
    }
View Full Code Here

            throws IOException, DavException {
        if (canHandle(DavMethods.DAV_POST, webdavRequest, davResource)) {
            // special remoting request: the defined parameters are exclusive
            // and cannot be combined.
            Session session = getRepositorySession(webdavRequest);
            RequestData data = new RequestData(webdavRequest, getTempDirectory(getServletContext()));
            String loc = null;
            try {
                String[] pValues;
                if ((pValues = data.getParameterValues(PARAM_CLONE)) != null) {
                    loc = clone(session, pValues, davResource.getLocator());
                } else if ((pValues = data.getParameterValues(PARAM_COPY)) != null) {
                    loc = copy(session, pValues, davResource.getLocator());
                } else if (data.getParameterValues(PARAM_DIFF) != null) {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    processDiff(session, targetPath, data);
                } else {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    loc = modifyContent(session, targetPath, data);
                }

                // TODO: append entity
                if (loc == null) {
                    webdavResponse.setStatus(HttpServletResponse.SC_OK);
                } else {
                    webdavResponse.setHeader(DeltaVConstants.HEADER_LOCATION, loc);
                    webdavResponse.setStatus(HttpServletResponse.SC_CREATED);
                }
            } catch (RepositoryException e) {
                log.warn(e.getMessage());
                throw new JcrDavException(e);
            } catch (DiffException e) {
                log.warn(e.getMessage());
                Throwable cause = e.getCause();
                if (cause instanceof RepositoryException) {
                    throw new JcrDavException((RepositoryException) cause);
                } else {
                    throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid diff format.");
                }
            } finally {
                data.dispose();
            }
        } else {
            super.doPost(webdavRequest, webdavResponse, davResource);
        }
    }
View Full Code Here

            throws IOException, DavException {
        if (canHandle(DavMethods.DAV_POST, webdavRequest, davResource)) {
            // special remoting request: the defined parameters are exclusive
            // and cannot be combined.
            Session session = getRepositorySession(webdavRequest);
            RequestData data = new RequestData(webdavRequest, getTempDirectory(getServletContext()));
            String loc = null;
            try {
                String[] pValues;
                if ((pValues = data.getParameterValues(PARAM_CLONE)) != null) {
                    loc = clone(session, pValues, davResource.getLocator());
                } else if ((pValues = data.getParameterValues(PARAM_COPY)) != null) {
                    loc = copy(session, pValues, davResource.getLocator());
                } else if (data.getParameterValues(PARAM_DIFF) != null) {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    processDiff(session, targetPath, data);
                } else {
                    String targetPath = davResource.getLocator().getRepositoryPath();
                    loc = modifyContent(session, targetPath, data);
                }

                // TODO: append entity
                if (loc == null) {
                    webdavResponse.setStatus(HttpServletResponse.SC_OK);
                } else {
                    webdavResponse.setHeader(DeltaVConstants.HEADER_LOCATION, loc);
                    webdavResponse.setStatus(HttpServletResponse.SC_CREATED);
                }
            } catch (RepositoryException e) {
                log.warn(e.getMessage());
                throw new JcrDavException(e);
            } catch (DiffException e) {
                log.warn(e.getMessage());
                Throwable cause = e.getCause();
                if (cause instanceof RepositoryException) {
                    throw new JcrDavException((RepositoryException) cause);
                } else {
                    throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Invalid diff format.");
                }
            } finally {
                data.dispose();
            }
        } else {
            super.doPost(webdavRequest, webdavResponse, davResource);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.server.util.RequestData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.