|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--javawebparts.servlet.TextRendererServlet
This servlet serves a dynamically-rendered image of a string of text with
the specified font characteristics.
Example configuration in web.xml:
<servlet>
<servlet-name>TextRendererServlet</servlet-name>
<servlet-class>javawebparts.servlet.
TextRendererServlet</servlet-class>
<init-param>
<param-name>fontName</param-name>
<param-value>arial</param-value>
</init-param>
<init-param>
<param-name>fontPoint</param-name>
<param-value>24</param-value>
</init-param>
<init-param>
<param-name>color</param-name>
<param-value>255,0,0
</param-value>
</init-param>
<init-param>
<param-name>backColor</param-name>
<param-value>255,255,0
</param-value>
</init-param>
<init-param>
<param-name>stylePlain</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>styleBold</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>styleItalic</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>TextRendererServlet</servlet-name>
<url-pattern>/textRenderer</url-pattern>
</servlet-mapping>
Init parameters explained:
Field Summary | |
private java.lang.Integer |
initBackB
backB. |
private java.lang.Integer |
initBackG
backG. |
private java.lang.Integer |
initBackR
backR. |
private java.lang.Integer |
initColB
colB. |
private java.lang.Integer |
initColG
colG. |
private java.lang.Integer |
initColR
colR. |
private java.lang.String |
initFontName
font. |
private java.lang.Integer |
initFontPoint
fontPoint. |
private java.lang.String |
initStyleBold
styleBold. |
private java.lang.String |
initStyleItalic
styleItalic. |
private java.lang.String |
initStylePlain
stylePlain. |
private static org.apache.commons.logging.Log |
log
Log instance. |
Fields inherited from class javax.servlet.http.HttpServlet |
|
Fields inherited from class javax.servlet.GenericServlet |
|
Constructor Summary | |
TextRendererServlet()
|
Method Summary | |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
doGet. |
void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
doPost. |
void |
init(javax.servlet.ServletConfig config)
init. |
static java.io.OutputStream |
renderText(java.util.Map m)
This method is the method which actually renders a given text string using the given font characteristics and returns the image as an OutputStream (ByteArrayOutputStream specifically). |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.apache.commons.logging.Log log
private java.lang.String initFontName
private java.lang.Integer initFontPoint
private java.lang.String initStylePlain
private java.lang.String initStyleBold
private java.lang.String initStyleItalic
private java.lang.Integer initColR
private java.lang.Integer initColG
private java.lang.Integer initColB
private java.lang.Integer initBackR
private java.lang.Integer initBackG
private java.lang.Integer initBackB
Constructor Detail |
public TextRendererServlet()
Method Detail |
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
config
- ServletConfig.
javax.servlet.ServletException
- ServletException.public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
request
- HTTPServletRequest.response
- HTTPServletResponse.
javax.servlet.ServletException
- ServletException.
java.io.IOException
- IOExcpetion.public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doPost
in class javax.servlet.http.HttpServlet
request
- HTTPServletRequestresponse
- HTTPServletResponse
javax.servlet.ServletException
- ServletException
java.io.IOException
- IOExcpetionpublic static java.io.OutputStream renderText(java.util.Map m) throws java.io.IOException
m
- A Map containing all the required elements. See the
javadocs for this class for details.
java.io.IOException
- IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |