001/* 
002    Licensed to the Apache Software Foundation (ASF) under one
003    or more contributor license agreements.  See the NOTICE file
004    distributed with this work for additional information
005    regarding copyright ownership.  The ASF licenses this file
006    to you under the Apache License, Version 2.0 (the
007    "License"); you may not use this file except in compliance
008    with the License.  You may obtain a copy of the License at
009
010       http://www.apache.org/licenses/LICENSE-2.0
011
012    Unless required by applicable law or agreed to in writing,
013    software distributed under the License is distributed on an
014    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015    KIND, either express or implied.  See the License for the
016    specific language governing permissions and limitations
017    under the License.  
018 */
019package org.apache.wiki.tags;
020
021import org.apache.wiki.ui.TemplateManager;
022
023/**
024 *  This tag is used to include any programmatic includes into the
025 *  output stream.  Actually, what it does is that it simply emits a
026 *  tiny marker into the stream, and then a ServletFilter will take
027 *  care of the actual inclusion.
028 *  
029 *
030 */
031public class IncludeResourcesTag extends WikiTagBase
032{
033    private static final long serialVersionUID = 0L;
034        
035    private String m_type;
036
037    @Override
038    public void initTag()
039    {
040        super.initTag();
041        m_type = null;
042    }
043    
044    public void setType(final String type )
045    {
046        m_type = type;
047    }
048    
049    @Override
050    public int doWikiStartTag() throws Exception
051    {
052        //String marker = m_wikiContext.getEngine().getTemplateManager().getMarker(m_wikiContext, m_type);
053        //String marker = TemplateManager.getMarker(pageContext, m_type);
054        final String marker = TemplateManager.getMarker(m_wikiContext, m_type);
055
056        pageContext.getOut().println( marker );
057        
058        return SKIP_BODY;
059    }
060
061}