All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wings.template.parser.SpecialTagHandler Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 1997-1999 The Java Apache Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the Java Apache 
 *    Project for use in the Apache JServ servlet engine project
 *    (http://java.apache.org/)."
 *
 * 4. The names "Apache JServ", "Apache JServ Servlet Engine" and 
 *    "Java Apache Project" must not be used to endorse or promote products 
 *    derived from this software without prior written permission.
 *
 * 5. Products derived from this software may not be called "Apache JServ"
 *    nor may "Apache" nor "Apache JServ" appear in their names without 
 *    prior written permission of the Java Apache Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the Java Apache 
 *    Project for use in the Apache JServ servlet engine project
 *    (http://java.apache.org/)."
 *    
 * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Java Apache Group. For more information
 * on the Java Apache Project and the Apache JServ Servlet Engine project,
 * please see .
 */

/**
 * SpecialTagHandler represents a tag which requires
 * handling within server side parsed page. This could be a
 * class handling <SERVLET>-Tags or any other tag. See
 * PageParser, SSI and ParameterPropagatingSSI for examples.
 *
 * 

A class to plug into PageParser must implement * this interface and must have a simple constructor * without parameters and can then be added with * addTagHandler() to a PageParser servlet. * * @author Henner Zeller */ /* * Copyright 2000,2005 wingS development team. * * This file is part of wingS (http://wingsframework.org). * * wingS is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * Please see COPYING for the complete licence. */ package org.wings.template.parser; import java.io.IOException; import java.io.Reader; public interface SpecialTagHandler { /** * Parse tag. * This method is invoked if a tag with a name * this class is registered for is found. * It gets the ServletConfiguration of the PageParser * servet and a PositionReader, placed after name of * the current tag.

* The parseTag() method is called before * any processing is done. Its purpose is to parse the area * this tag spans and probably read in parameters used at * execution time.

* This method returns the last tag belonging to the * area handled by this handler (for server side included * servlets, this would be </SERVLET>). * For simple one-tag Handlers this is simply the tag passed * to this method. If the Handler decides not to handle this tag, this * method should return null. * * @param context The context used while parsing; contains * at least the HttpServletRequest and HttpServletResponse. * @param input The PositionReader, located after the Name token * of the Tag * @param startPos The Position parsing of this token began * @param startTag the SGMLTag found in the file. */ SGMLTag parseTag(ParseContext context, PositionReader input, long startPos, SGMLTag startTag) throws IOException; /** * Get start position of the area in the sourcefile this * handler processes. * This is usually the position of the "<" * of the <SpecialTag> within the inputfile. */ long getTagStart(); /** * Get the length of the area in the sourcefile. * The area this handler processes is skipped in the inputfile. * Usually this represents the length of the single * <SpecialTag> or the * area <SpecialTag>...</SpecialTag> */ long getTagLength(); /** * actually perform the action associated with this tag. * * @throws Exception anything can happen .. and throw an Exception * which is caught in PageParser */ void executeTag(ParseContext context, Reader input) throws Exception; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy