Package org.jayasoft.woj.server.servlet

Examples of org.jayasoft.woj.server.servlet.UnknwownContentException


        String request = getRequest(uak, visibility, org, mod, rev, path);
        LOGGER.debug("looking for servers able to handle "+request);
        List servers = getServersUpToHandle(uak, visibility, org, mod, rev, path);
        LOGGER.debug("found servers able to handle "+request+": "+servers);
        if (servers.isEmpty()) {
            throw new UnknwownContentException(visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
        } else {           
            Server selected = (Server)servers.get(RANDOM.nextInt(servers.size()));
            LOGGER.info("selected "+selected+" to handle "+request+" among "+servers);
            if (WOJServer.getInstance().getServerManagementService().getLocalServer().equals(selected)) {
                return doGetContentReference(uak, visibility, org, mod, rev, path);
View Full Code Here


    }

    private List getServersUpToHandle(UAK uak, String visibility, String org, String mod, String rev, String path) {
        ModuleDescriptor md = getModuleDescriptor(uak, visibility, org, mod, rev);
        if (md == null) {
            throw new UnknwownContentException(visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
        }
        List servers = WOJServer.getInstance().getDataService().getServerDao().getServersHandling(md);
        if (servers == null) {
            return Collections.EMPTY_LIST;
        } else {
View Full Code Here

                contentReader = getStandardFileReader(f);
                if (contentReader==null) {
                    if (ref.getReferencePath().endsWith("/")) {
                        contentReader = getDirectoryReader(ref, f);
                    } else {
                        throw new UnknwownContentException(f.getName() + " , it doesn't end with a trailing slash");
                    }
                }
                if (contentReader==null) {
                    contentReader = getErrorNoContentReader(ref, f);
                }
View Full Code Here

        }
    }
   
    public void dispatch(UAK uak, ContentReference ref, boolean redirected) {
        if (redirected) {
            throw new UnknwownContentException(ref.getModuleInfo().getVisibility().toString()+"/"+ref.getModuleInfo().getOrganisation()+"/"+ref.getModuleInfo().getModule()+"/"+ref.getModuleInfo().getRevision()+"/"+ref.getReferencePath());
        }
        ContentModuleInfo moduleInfo = ref.getModuleInfo();
        if (dispatch(uak, moduleInfo.getVisibility().toString(), moduleInfo.getOrganisation(), moduleInfo.getModule(), moduleInfo.getRevision(), ref.getReferencePath()) != null) {
            throw new UnknwownContentException(ref.getModuleInfo().getVisibility().toString()+"/"+ref.getModuleInfo().getOrganisation()+"/"+ref.getModuleInfo().getModule()+"/"+ref.getModuleInfo().getRevision()+"/"+ref.getReferencePath());
        }
    }
View Full Code Here

    public ContentReference getContentReference(UAK uak, String url, boolean redirected) {
        String[] parts = url.split("/");
        if (parts.length < 5) {
          String msg = "invalid URL: "+url+": doesn't contain at least 5 parts";
            LOGGER.warn(msg);
            throw new UnknwownContentException(url);
        }
       
        String visibility = parts[0];
        String org = parts[1];
        String mod = parts[2];
View Full Code Here

        if (Parameters.SERVLET_NAME.DISPATCH.equals(visibility)) {
            LOGGER.info("no visibility found in url");
            ModuleDescriptorDao dao = WOJServer.getInstance().getDataService().getModuleDescriptorDao();
            md = dao.getModuleDescriptor(org, mod, rev, uak.getUserId(), uak.getGroups());
            if (md == null) {
                throw new UnknwownContentException(visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
            }
            v = md.getVisibility();
        } else {
            v = Visibility.fromString(visibility);
        }
       
        if (v == Visibility.PRIVATE) {
            ServletHelper.ensureCurrentRequestEncrypted(uak, visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
        }
               
        Long accessorId = null;
        boolean hasSources = true;
        boolean hasJavadoc = true;
        if (md != null || !Visibility.PUBLIC.equals(v)) {
            if (md == null) {
                ModuleDescriptorDao dao= WOJServer.getInstance().getDataService().getModuleDescriptorDao();
                md = dao.getModuleDescriptor(org, mod, rev, uak.getUserId(), uak.getGroups(), v);
            }
           
            // look for accessor id
            if (md == null) {
                throw new UnknwownContentException(visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
            } else {
                accessorId = md.getAccessorId();
                hasSources = md.hasSources();
                hasJavadoc = md.hasJavadoc();
            }
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.server.servlet.UnknwownContentException

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.