Java Code Examples for org.apache.jackrabbit.webdav.DavServletResponse#SC_INTERNAL_SERVER_ERROR
The following examples show how to use
org.apache.jackrabbit.webdav.DavServletResponse#SC_INTERNAL_SERVER_ERROR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VersionControlledResourceImpl.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Modify the labels present with the versions of this resource. * * @param labelInfo details of the label * * @throws org.apache.jackrabbit.webdav.DavException error in the DAV communication * @see VersionControlledResource#label(LabelInfo) * @see javax.jcr.version.VersionHistory#addVersionLabel(String, String, * boolean) * @see javax.jcr.version.VersionHistory#removeVersionLabel(String) */ public void label(LabelInfo labelInfo) throws DavException { if (labelInfo == null) { throw new DavException(DavServletResponse.SC_BAD_REQUEST, "Valid label request body required."); } if (!exists()) { throw new DavException(DavServletResponse.SC_NOT_FOUND); } try { if (!isVersionControlled()) { throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "A LABEL request may only be applied to a version-controlled, checked-in resource."); } DavResource[] resArr = this.getReferenceResources(CHECKED_IN); if (resArr.length == 1 && resArr[0] instanceof VersionResource) { ((VersionResource) resArr[0]).label(labelInfo); } else { throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, "DAV:checked-in property on '" + getHref() + "' did not point to a single VersionResource."); } } catch (Exception e) { } }
Example 2
Source File: DeltaVResourceImpl.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) public DavResource[] getReferenceResources(DavPropertyName hrefPropertyName) throws DavException { DavProperty prop = getProperty(hrefPropertyName); List resources = new ArrayList(); if (prop != null && prop instanceof HrefProperty) { HrefProperty hp = (HrefProperty) prop; // process list of hrefs List hrefs = hp.getHrefs(); for (Iterator iter = hrefs.iterator(); iter.hasNext();) { String href = (String) iter.next(); DavResourceLocator locator = getLocator().getFactory().createResourceLocator(getLocator().getPrefix(), href); resources.add(createResourceFromLocator(locator)); } } else { throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR); } return (DavResource[]) resources.toArray(new DavResource[0]); }
Example 3
Source File: DavResourceFactoryImpl.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public DavResource createResource(DavResourceLocator locator, DavSession session) throws DavException { try { DavResource resource = getFromCache(session, locator.getResourcePath()); if (resource != null) return resource; Resource res = resourceService.getResource(locator.getResourcePath(), session); resource = createResource(locator, session, res); putInCache(session, resource); return resource; } catch (Throwable e) { log.error(e.getMessage(), e); throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e); } }
Example 4
Source File: DavResourceFactoryImpl.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public DavResource createResource(DavResourceLocator locator, DavServletRequest request, DavSession session) throws DavException { try { String resourcePath = locator.getResourcePath(); Matcher matcher = versionRequestPattern.matcher(locator.getResourcePath()); String version = null; if (matcher.matches() == true) { version = matcher.group(1); resourcePath = resourcePath.replaceFirst("/vstore/" + version, ""); } DavResource resource; Resource repositoryResource = resourceService.getResource(resourcePath, session); if (repositoryResource == null) { boolean isCollection = DavMethods.isCreateCollectionRequest(request); resource = createNullResource(locator, session, isCollection); } else { repositoryResource.setVersionLabel(version); repositoryResource.setRequestedPerson(Long.parseLong(session.getObject("id").toString())); resource = new VersionControlledResourceImpl(locator, this, session, resourceConfig, repositoryResource); } putInCache(session, resource); return resource; } catch (Exception e) { log.error(e.getMessage(), e); throw new DavException(DavServletResponse.SC_INTERNAL_SERVER_ERROR, e); } }