Package org.apache.lenya.cms.linking

Examples of org.apache.lenya.cms.linking.LinkRewriter


    }

    protected String rewrite(Request request, String url) throws RepositoryException,
            ConfigurationException {
        Session session = RepositoryUtil.getSession(this.manager, request);
        LinkRewriter rewriter = new OutgoingLinkRewriter(this.manager, session, request
                .getRequestURI(), request.isSecure(), false, this.relativeUrls);
        if (!rewriter.matches(url)) {
            throw new ConfigurationException("The URL [" + url + "] can't be rewritten!");
        }
        return rewriter.rewrite(url);
    }
View Full Code Here


        try {
            context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            Request request = context.getRequest();
            boolean ssl = request.isSecure();

            LinkRewriter rewriter = new OutgoingLinkRewriter(this.manager, getSession(),
                    getSourceURL(), ssl, false, false);
            Map asset2proxyUrl = new HashMap();
            setParameter("asset2proxyUrl", asset2proxyUrl);

            Document[] resources = getResourceDocuments();

            for (int i = 0; i < resources.length; i++) {

                String originalUrl = resources[i].getCanonicalWebappURL();
                int lastDotIndex = originalUrl.lastIndexOf('.');
                String extension = resources[i].getSourceExtension();
                String url = originalUrl.substring(0, lastDotIndex) + "." + extension;

                String proxyUrl = rewriter.rewrite(url);
                asset2proxyUrl.put(resources[i], proxyUrl);

            }

            setParameter("assets", resources);
View Full Code Here

        Request request = ContextHelper.getRequest(this.context);
        String requesturi = request.getRequestURI();
        setParameter("requesturi", requesturi);
        URLInformation info = new URLInformation(getSourceURL());
        String pubId = info.getPublicationId();
        LinkRewriter rewriter = new OutgoingLinkRewriter(this.manager, getSession(),
                    getSourceURL(), request.isSecure(), false, false);
       
        setParameter("proxyUrl",rewriter.rewrite("/" + pubId));
    }
View Full Code Here

                    PolicyManager policyManager = accessController.getPolicyManager();
                    Policy policy = policyManager.getPolicy(accessController.getAccreditableManager(),
                            url);
                    if (policy.isSSLProtected()) {
                        Session session = RepositoryUtil.getSession(this.manager, request);
                        LinkRewriter rewriter = new OutgoingLinkRewriter(this.manager, session, url,
                                false, true, false);
                        String sslUri = rewriter.rewrite(url);
                        return Collections.singletonMap(KEY_REDIRECT_URI, sslUri);
                    }
                }
   
            } finally {
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.linking.LinkRewriter

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.