Package org.apache.jetspeed.aggregator

Examples of org.apache.jetspeed.aggregator.PortletContent


                    ObjectID windowId = (null != window ? window.getId() : null);
                    log.warn("Portlet Rendering job to be interrupted by timeout (" + job.getTimeout() + "ms): " + windowId);
                }

                int waitCount = 0;
                PortletContent content = job.getPortletContent();

                while (!content.isComplete()) {
                    if (++waitCount > 10) {
                        break;
                    }

                    worker.interrupt();

                    synchronized (content) {
                        content.wait();
                    }
                }
            } catch (Exception e) {
                log.error("Exceptiong during job killing.", e);
            }
View Full Code Here


    {
        try
        {
            HttpServletRequest servletRequest = requestContext.getRequest();
            HttpServletResponse servletResponse = requestContext.getResponse();
            PortletContent content = new PortletContentImpl();
            HttpBufferedResponse bufferedResponse =
                new HttpBufferedResponse(servletResponse, content.getWriter());
            ServletContext crossContext = requestContext.getConfig().getServletContext().getContext(request.getPortletApplicationContextPath());           
            RequestDispatcher dispatcher = crossContext.getRequestDispatcher(headerResource);
            if (dispatcher != null)
                dispatcher.include(servletRequest, bufferedResponse);           
            bufferedResponse.flushBuffer();
            BufferedReader reader = new BufferedReader(new StringReader(content.getContent()));
            String buffer;
            StringBuffer headerText = new StringBuffer();
            while ((buffer = reader.readLine()) != null)
            {
                headerText.append( buffer ).append( "\r\n" );
View Full Code Here

        try
        {
            for (Iterator iter = renderingJobs.iterator(); iter.hasNext(); )
            {
                RenderingJob job = (RenderingJob) iter.next();
                PortletContent portletContent = job.getPortletContent();
               
                synchronized (portletContent)
                {
                    if (!portletContent.isComplete())
                    {
                        portletContent.wait();
                    }
                }
            }
        }
        catch (Exception e)
View Full Code Here

                    PortletWindow window = job.getWindow();
                    ObjectID windowId = (null != window ? window.getId() : null);
                    log.warn("Portlet Rendering job to be interrupted by timeout (" + job.getTimeout() + "ms): " + windowId);
                }

                PortletContent content = job.getPortletContent();
               
                synchronized (content)
                {
                    if (!content.isComplete()) {
                        worker.interrupt();
                        content.wait();
                    }
                }
               
            } catch (Exception e) {
                log.error("Exceptiong during job killing.", e);
View Full Code Here

    {
        try
        {
            HttpServletRequest servletRequest = requestContext.getRequest();
            HttpServletResponse servletResponse = requestContext.getResponse();
            PortletContent content = new PortletContentImpl();
            HttpBufferedResponse bufferedResponse =
                new HttpBufferedResponse(servletResponse, content.getWriter());
            ServletContext crossContext = requestContext.getConfig().getServletContext().getContext(request.getPortletApplicationContextPath());           
            RequestDispatcher dispatcher = crossContext.getRequestDispatcher(headerResource);
            if (dispatcher != null)
                dispatcher.include(servletRequest, bufferedResponse);           
            bufferedResponse.flushBuffer();
            BufferedReader reader = new BufferedReader(new StringReader(content.getContent()));
            String buffer;
            StringBuffer headerText = new StringBuffer();
            while ((buffer = reader.readLine()) != null)
            {
                headerText.append( buffer ).append( "\r\n" );
View Full Code Here

        context.getParameterMap().put("encoder", "desktop");
        ContentCacheKey cckey2 = contentCache.createCacheKey(context, window2);
        assertEquals(cckey2.getKey(), "david/desktop/555-02");
       
        // create some PortletContent mock objects
        PortletContent content1 = new MockPortletContent(cckey1, 100, "ContentOne", "content1content1content1content1");
        PortletContent content2 = new MockPortletContent(cckey2, 200, "ContentTwo", "content2content2content2content2");
       
        // put it in the cache
        CacheElement element1 = contentCache.createElement(cckey1, content1);
        contentCache.put(element1);
        CacheElement element2 = contentCache.createElement(cckey2, content2);
        contentCache.put(element2);
       
        // assert the gets
        Object result1 = contentCache.get(cckey1);
        assertNotNull(result1);
        System.out.println("result 1 = " + result1);
        Object result2 = contentCache.get(cckey2);
        assertNotNull(result2);
        System.out.println("result 2 = " + result2);
       
        // assert isKey Apis       
        assertTrue(contentCache.isKeyInCache(cckey1));
               
       
        // test removes
        contentCache.remove(cckey1);
        assertFalse(contentCache.isKeyInCache(cckey1));       
        assertTrue(contentCache.isKeyInCache(cckey2));
       
        // test user stuff
        request.setUserPrincipal(new MockPrincipal("sean"));       
        // create a simple key
        String window3 = "555-03";
        ContentCacheKey cckey3 = contentCache.createCacheKey(context, window3);
        assertEquals(cckey3.getKey(), "sean/desktop/555-03");

        // create a another key for desktop
        String window4 = "555-04";
        ContentCacheKey cckey4 = contentCache.createCacheKey(context, window4);
        assertEquals(cckey4.getKey(), "sean/desktop/555-04");
       
        // create some PortletContent mock objects
        PortletContent content3 = new MockPortletContent(cckey3, 300, "ContentThree", "content3content3content3content3");
        PortletContent content4 = new MockPortletContent(cckey4, 400, "ContentTwo", "content4content4content4content4");
       
        // put it in the cache
        CacheElement element3 = contentCache.createElement(cckey3, content3);
        contentCache.put(element3);
        CacheElement element4 = contentCache.createElement(cckey4, content4);
View Full Code Here

        context.getParameterMap().put("encoder", "desktop");
        ContentCacheKey cckey2 = contentCache.createCacheKey(context, window2);
        assertEquals(cckey2.getKey(), sessionId + "/desktop/555-02");
       
        // create some PortletContent mock objects
        PortletContent content1 = new MockPortletContent(cckey1, 100, "ContentOne", "content1content1content1content1");
        PortletContent content2 = new MockPortletContent(cckey2, 200, "ContentTwo", "content2content2content2content2");
       
        // put it in the cache
        CacheElement element1 = contentCache.createElement(cckey1, content1);
        contentCache.put(element1);
        CacheElement element2 = contentCache.createElement(cckey2, content2);
        contentCache.put(element2);
       
        // assert the gets
        Object result1 = contentCache.get(cckey1);
        assertNotNull(result1);
        System.out.println("result 1 = " + result1);
        Object result2 = contentCache.get(cckey2);
        assertNotNull(result2);
        System.out.println("result 2 = " + result2);
       
        // assert isKey Apis       
        assertTrue(contentCache.isKeyInCache(cckey1));
               
       
        // test removes
        contentCache.remove(cckey1);
        assertFalse(contentCache.isKeyInCache(cckey1));       
        assertTrue(contentCache.isKeyInCache(cckey2));
       
        // test user stuff
        session = new MockHttpSession();
        request.setSession(session);       
        sessionId = session.getId();       
        request.setUserPrincipal(new MockPrincipal("sean"));       
        // create a simple key
        String window3 = "555-03";
        ContentCacheKey cckey3 = contentCache.createCacheKey(context, window3);
        assertEquals(cckey3.getKey(), sessionId + "/desktop/555-03");

        // create a another key for desktop
        String window4 = "555-04";
        ContentCacheKey cckey4 = contentCache.createCacheKey(context, window4);
        assertEquals(cckey4.getKey(), sessionId + "/desktop/555-04");
       
        // create some PortletContent mock objects
        PortletContent content3 = new MockPortletContent(cckey3, 300, "ContentThree", "content3content3content3content3");
        PortletContent content4 = new MockPortletContent(cckey4, 400, "ContentTwo", "content4content4content4content4");
       
        // put it in the cache
        CacheElement element3 = contentCache.createElement(cckey3, content3);
        contentCache.put(element3);
        CacheElement element4 = contentCache.createElement(cckey4, content4);
View Full Code Here

            try
            {
                for (Iterator iter = renderingJobs.iterator(); iter.hasNext(); )
                {
                    RenderingJob job = (RenderingJob) iter.next();
                    PortletContent portletContent = job.getPortletContent();
                   
                    synchronized (portletContent)
                    {
                        if (!portletContent.isComplete())
                        {
                            portletContent.wait();
                        }
                    }
                }
            }
            catch (Exception e)
View Full Code Here

                       
                        boolean isTimeout = job.isTimeout();
                       
                        if (isTimeout)
                        {
                            PortletContent content = job.getPortletContent();
                           
                            if (interruptOnTimeout)
                            {
                                Thread worker = (Thread) job.getWorkerAttribute(WORKER_THREAD_ATTR);
                               
                                if (worker != null)
                                {
                                    synchronized (content)
                                    {
                                        if (!content.isComplete()) {
                                            worker.interrupt();
                                            content.wait();
                                        }
                                    }
                                }
                            }
                            else
                            {
                                synchronized (content)
                                {
                                    content.completeWithError();
                                }
                            }
                        }
                       
                        if (status == WorkEvent.WORK_COMPLETED || status == WorkEvent.WORK_REJECTED || isTimeout)
View Full Code Here

                    PortletWindow window = job.getWindow();
                    ObjectID windowId = (null != window ? window.getId() : null);
                    log.warn("Portlet Rendering job to be interrupted by timeout (" + job.getTimeout() + "ms): " + windowId);
                }

                PortletContent content = job.getPortletContent();
                Thread worker = (Thread) job.getWorkerAttribute(WORKER_THREAD_ATTR);
               
                if (worker != null)
                {
                    synchronized (content)
                    {
                        if (!content.isComplete()) {
                            worker.interrupt();
                            content.wait();
                        }
                    }
                }
            } catch (Exception e) {
                log.error("Exceptiong during job killing.", e);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.aggregator.PortletContent

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.