Package com.uwyn.jhighlight.servlet
Class HighlightFilter
- java.lang.Object
-
- com.uwyn.jhighlight.servlet.HighlightFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public final class HighlightFilter extends java.lang.Object implements javax.servlet.Filter
A servlet filter that offers on-the-fly syntax highlighting for Java, HTML, XHTML, XML and LZX files.The filter should be declared in a similar fashion as this:
<filter> <filter-name>jhighlight</filter-name> <filter-class>com.uwyn.jhighlight.servlet.HighlightFilter</filter-class> </filter> <filter-mapping> <filter-name>jhighlight</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
It will respond to files with the following extensions:
.javas
,.htmls
,.htms
,.xhtmls
,.xmls
and.lzxs
. These will be automatically mapped to files without the lasts
in the filenames. Thus, for example, a request like this:http://myhost.com/folder/MySource.javas
will retrieve this file:
http://myhost.com/folder/MySource.java
The contents of this file will be automatically highlighted and the resulting HTML will be served.
- Since:
- 1.0
- Version:
- $Revision: 3108 $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
HighlightFilter.CharResponseWrapper
private static class
HighlightFilter.ServletOutputStreamWrapper
private static class
HighlightFilter.SourceRequestWrapper
-
Constructor Summary
Constructors Constructor Description HighlightFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
void
init(javax.servlet.FilterConfig filterConfig)
-
-
-
Method Detail
-
init
public void init(javax.servlet.FilterConfig filterConfig)
- Specified by:
init
in interfacejavax.servlet.Filter
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Filter
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
java.io.IOException
javax.servlet.ServletException
-
-