Package org.apache.lenya.cms.cocoon.components.context

Examples of org.apache.lenya.cms.cocoon.components.context.ContextUtility


     * @param webappUrl The web application URL.
     * @return A publication.
     */
    protected Publication getPublication(String webappUrl) {
        Publication publication = null;
        ContextUtility util = null;
        try {
            util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            Request request = util.getRequest();
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);

            URLInformation info = new URLInformation(webappUrl);
            String pubId = info.getPublicationId();

View Full Code Here


    protected boolean isUsecaseAuthorized(String webappUrl, String usecaseName) throws Exception {
        boolean authorized = false;
        ServiceSelector selector = null;
        AccessControllerResolver acResolver = null;
        AccessController accessController = null;
        ContextUtility contextUtil = null;
        try {
            selector = (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE
                    + "Selector");
            acResolver = (AccessControllerResolver) selector
                    .select(AccessControllerResolver.DEFAULT_RESOLVER);
            accessController = acResolver.resolveAccessController(webappUrl);

            contextUtil = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            Request request = contextUtil.getRequest();
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            URLInformation info = new URLInformation(webappUrl);
            Publication pub = factory.getPublication(info.getPublicationId());
            Role[] roles = PolicyUtil.getRoles(request);
View Full Code Here

                sourceUri = uri.substring(0, questionMarkIndex);
                Query query = new Query(uri.substring(questionMarkIndex + 1));
                String revisionString = query.getValue("rev", null);
                if (revisionString != null) {
                   
                    ContextUtility util = null;
                    try {
                        util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
                        Request request = util.getRequest();
                        String webappUrl = ServletHelper.getWebappURI(request);
                       
                        Publication pub = PublicationUtil.getPublication(this.manager, request);
                        Document currentDoc = pub.getFactory().getFromURL(webappUrl);
                        if (currentDoc.getSourceURI().equals(sourceUri)) {
View Full Code Here

    private String contextPath;
   
    protected String getContextPath() {
        if (this.contextPath == null) {
            ContextUtility context = null;
            try {
                context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
                this.contextPath = context.getRequest().getContextPath();
            } catch (ServiceException e) {
                throw new RuntimeException(e);
            }
            finally {
                if (context != null) {
View Full Code Here

        }
    }

    protected String getContextPath() throws ServiceException {
        String prefix;
        ContextUtility ctxUtil = null;
        try {
            ctxUtil = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            prefix = ctxUtil.getRequest().getContextPath();
        } finally {
            if (ctxUtil != null) {
                this.manager.release(ctxUtil);
            }
        }
View Full Code Here

    }

    protected synchronized Proxy initializeProxy(Object key) {
        Proxy proxy;
        proxy = new Proxy();
        ContextUtility context = null;
        try {
            context = (ContextUtility) manager.lookup(ContextUtility.ROLE);
            proxy.setUrl(context.getRequest().getContextPath());
        } catch (ServiceException e) {
            throw new RuntimeException(e);
        }
        finally {
            if (context != null) {
View Full Code Here

   
    private String contextPath;
   
    protected String getContextPath() {
        if (this.contextPath == null) {
            ContextUtility context = null;
            try {
                context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
                this.contextPath = context.getRequest().getContextPath();
            } catch (ServiceException e) {
                throw new RuntimeException(e);
            }
            finally {
                if (context != null) {
View Full Code Here

        // now check all publications and add their indexes:
        PublicationManager pubManager = null;
        SourceResolver resolver = null;
        Source confSource = null;
        ContextUtility util = null;
        try {
            util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            Request request = util.getRequest();
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            pubManager = (PublicationManager) this.manager.lookup(PublicationManager.ROLE);
            Publication[] publications = pubManager.getPublications(factory);
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
View Full Code Here

    public void addPublication(String pubId) throws PublicationException {
        Map id2config = getId2config();
        if (id2config.containsKey(pubId)) {
            throw new PublicationException("The publication [" + pubId + "] already exists.");
        }
        ContextUtility context = null;
        try {
            context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            PublicationConfiguration config = new PublicationConfiguration(pubId,
                    this.servletContextPath, context.getRequest().getContextPath());
            ContainerUtil.enableLogging(config, getLogger());
            id2config.put(pubId, config);
        } catch (ServiceException e) {
            throw new PublicationException(e);
        }
View Full Code Here

       
        if (!event.getDescriptor().equals(DocumentEvent.REMOVED)) {
            return;
        }
       
        ContextUtility util = null;
        try {
            util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            Request request = util.getRequest();
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            Publication pub = factory.getPublication(event.getPublicationId());
            File contentFile = pub.getContentDirectory(event.getArea());
            String contentUri = contentFile.toURI().toString();
            SourceUtil.deleteEmptyCollections(contentUri, this.manager);
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.cocoon.components.context.ContextUtility

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.