Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.util
Class JiveServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.jivesoftware.forum.util.JiveServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class JiveServlet
extends javax.servlet.http.HttpServlet

A servlet that is used to initialize and destroy Jive resources and performs other functions that a servlet is needed for (such as handling attachment operations). This servlet should be registered to be loaded at appserver startup. Below is a sample entry in a Servlet 2.2's webapp web.xml file:

  <servlet
      servlet-name="JiveServlet"
      servlet-class="com.jivesoftware.forum.util.JiveServlet"
  >
      <load-on-startup/>1</load-on-startup/>
  </servlet>
 

See Also:
Serialized Form

Constructor Summary
JiveServlet()
           
 
Method Summary
protected  boolean checkCacheHeaders(long fileSize, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  java.io.File generateThumbnail(java.io.InputStream in, int maxSize, boolean preserveRatio, java.io.File thumbFile)
           
protected  ForumFactory getForumFactory(AuthToken authToken, long forumID, long threadID, long messageID)
           
 java.io.File getThumbnail(java.lang.String attachmentID, int maxSize, boolean preserveRatio)
          Returns the name of an image thumbnail that can be used.
 void init(javax.servlet.ServletConfig config)
          This method will set the "jiveHome" property if its passed in as an init parameter to this servlet.
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles all incoming requests.
protected  void writeFileToResponseOutputStream(javax.servlet.http.HttpServletResponse response, java.io.File image, boolean download, java.lang.String contentType)
           
protected  void writeInputStreamToResponseOutputStream(javax.servlet.http.HttpServletResponse response, java.io.InputStream in, java.lang.String name, long size, boolean download, java.lang.String contentType)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, 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
 

Constructor Detail

JiveServlet

public JiveServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
This method will set the "jiveHome" property if its passed in as an init parameter to this servlet.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
Handles all incoming requests. Calling this servlet with no arguments results in the version of Jive being printed out.

Overrides:
service in class javax.servlet.http.HttpServlet

getThumbnail

public java.io.File getThumbnail(java.lang.String attachmentID,
                                 int maxSize,
                                 boolean preserveRatio)
                          throws java.io.IOException
Returns the name of an image thumbnail that can be used.

Parameters:
attachmentID - the ID of the attachment.
maxSize - the maximum dimension of the thumbnail (height or width)
preserveRatio - true if the aspect ratio of the image should be preserved when creating the thumbnail.
Returns:
the thumbnail image file or null if a thumbnail can't be created.
Throws:
java.io.IOException - if an error occurs creating the thumbnail.

generateThumbnail

protected java.io.File generateThumbnail(java.io.InputStream in,
                                         int maxSize,
                                         boolean preserveRatio,
                                         java.io.File thumbFile)
                                  throws java.io.IOException
Throws:
java.io.IOException

getForumFactory

protected ForumFactory getForumFactory(AuthToken authToken,
                                       long forumID,
                                       long threadID,
                                       long messageID)

writeFileToResponseOutputStream

protected void writeFileToResponseOutputStream(javax.servlet.http.HttpServletResponse response,
                                               java.io.File image,
                                               boolean download,
                                               java.lang.String contentType)
                                        throws java.io.IOException
Throws:
java.io.IOException

writeInputStreamToResponseOutputStream

protected void writeInputStreamToResponseOutputStream(javax.servlet.http.HttpServletResponse response,
                                                      java.io.InputStream in,
                                                      java.lang.String name,
                                                      long size,
                                                      boolean download,
                                                      java.lang.String contentType)
                                               throws java.io.IOException
Throws:
java.io.IOException

checkCacheHeaders

protected boolean checkCacheHeaders(long fileSize,
                                    javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.