Package org.apache.wiki

Examples of org.apache.wiki.WikiContext


    /** {@inheritDoc} */
    public final int doWikiStartTag()
        throws IOException
    {
        WikiEngine engine = m_wikiContext.getEngine();
        WikiContext ctx;
       
        if( m_pageName == null )
        {
            ctx = m_wikiContext;
        }
        else
        {
            ctx = (WikiContext)m_wikiContext.clone();
            ctx.setPage( engine.getPage(m_pageName) );
        }

        Integer vernew = (Integer) pageContext.getAttribute( ATTR_NEWVERSION,
                                                             PageContext.REQUEST_SCOPE );
        Integer verold = (Integer) pageContext.getAttribute( ATTR_OLDVERSION,
                                                             PageContext.REQUEST_SCOPE );

        log.info("Request diff between version "+verold+" and "+vernew);

        if( ctx.getPage() != null )
        {
            JspWriter out = pageContext.getOut();

            String diff = engine.getDiff( ctx,
                                          vernew.intValue(),
View Full Code Here


                /**
                 *  We want inclusion to occur within the context of
                 *  its own page, because we need the links to be correct.
                 */
               
                WikiContext includedContext = (WikiContext) context.clone();
                includedContext.setPage( page );

                String pageData = engine.getPureText( page );
                String moreLink = "";

                if( section != -1 )
View Full Code Here

            String username = author.getName();

            WikiPage entryPage = new WikiPage( m_engine, pageName );
            entryPage.setAuthor( username );

            WikiContext context = new WikiContext( m_engine, request, entryPage );

            StringBuffer text = new StringBuffer();
            text.append( "!"+title.getBody() );
            text.append( "\n\n" );
            text.append( content.getBody() );
View Full Code Here

            if( !("true".equals(p.getAttribute(WeblogPlugin.ATTR_ISWEBLOG)) ) )
                continue;

            String encodedName = TextUtil.urlEncodeUTF8( p.getName() );

            WikiContext context = new WikiContext( m_engine, p );

            String title = TextUtil.replaceEntities(org.apache.wiki.rss.Feed.getSiteName(context));

            Link postlink = createLink( "service.post",
                                        m_engine.getBaseURL()+"atom/"+encodedName,
View Full Code Here

    private void buildContext()
    {
        //
        //  Build a clone of the current context
        //
        WikiContext context = (WikiContext)m_wikiContext.clone();
       
        Object o = m_iterator.next();
       
        if( o instanceof WikiPage )
            context.setPage( (WikiPage)o );

        //
        //  Push it to the iterator stack, and set the id.
        //
        pageContext.setAttribute( WikiTagBase.ATTR_CONTEXT,
View Full Code Here

     * @return map of TimeFormats
     * @since 2.7.x
     */
    public Map listTimeFormats(PageContext pageContext)
    {
        WikiContext context = WikiContext.findContext( pageContext );
        Properties props = m_engine.getWikiProperties();
        ArrayList<String> tfArr = new ArrayList<String>(40);
        LinkedHashMap<String,String> resultMap = new LinkedHashMap<String,String>();

        /* filter timeformat properties */
 
View Full Code Here

                acl = getPermissions(parent);
            } else {
                //
                //  Or, try parsing the page
                //
                WikiContext ctx = new WikiContext(m_engine, page);

                ctx.setVariable(RenderingManager.VAR_EXECUTE_PLUGINS, Boolean.FALSE);

                m_engine.getHTML(ctx, page);

                page = m_engine.getPage(page.getName(), page.getVersion());
                acl = page.getAcl();
View Full Code Here

            //   interpreting the jsp)

            try
            {
                w.enterState( "Delivering response", 30 );
                WikiContext wikiContext = getWikiContext( request );
                String r = filter( wikiContext, responseWrapper );
               
                if (m_useOutputStream)
                {
                    OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream(),
                                                                    response.getCharacterEncoding());
                    out.write(r);
                    out.flush();
                    out.close();
                }
                else
                {
                    response.getWriter().write(r);
                }
           
                // Clean up the UI messages and loggers
                if( wikiContext != null )
                {
                    wikiContext.getWikiSession().clearMessages();
                }

                // fire PAGE_DELIVERED event
                fireEvent( WikiPageEvent.PAGE_DELIVERED, pagename );
View Full Code Here

     */
    protected WikiContext getWikiContext( ServletRequest  request )
    {
        HttpServletRequest httpRequest = (HttpServletRequest) request;
   
        WikiContext ctx = (WikiContext) httpRequest.getAttribute( WikiTagBase.ATTR_CONTEXT );
       
        return ctx;
    }
View Full Code Here

    public final int doAfterBody()
        throws JspException
    {
        try
        {
            WikiContext context = (WikiContext) pageContext.getAttribute( WikiTagBase.ATTR_CONTEXT,
                                                                          PageContext.REQUEST_SCOPE );

            //
            //  Because the TranslateTag should not affect any of the real page attributes
            //  we have to make a clone here.
            //
           
            context = context.deepClone();
           
            //
            //  Get the page data.
            //
            BodyContent bc = getBodyContent();
            String wikiText = bc.getString();
            bc.clearBody();

            if( wikiText != null )
            {
                wikiText = wikiText.trim();
           
                String result = context.getEngine().textToHTML( context, wikiText );

                getPreviousOut().write( result );
            }
        }
        catch( Exception e )
View Full Code Here

TOP

Related Classes of org.apache.wiki.WikiContext

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.