no.sesat.commons.resourcefeed
Class ResourceServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by no.sesat.commons.resourcefeed.ResourceServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public final class ResourceServlet
extends HttpServlet

Resource Provider. Serves configuration files (properties, xml), css, gifs, jpgs, javascript, classes, jar files and velocity templates for search-portal. Css, images, and javascript require direct access from client.

Version:
$Id: ResourceServlet.java 7225 2009-04-09 00:32:20Z ssmiweve $
See Also:
Serialized Form

Constructor Summary
ResourceServlet()
           
 
Method Summary
protected  void doGet(HttpServletRequest request, HttpServletResponse response)
          
protected  void doPost(HttpServletRequest request, HttpServletResponse response)
          
protected  long getLastModified(HttpServletRequest req)
          Assigned to the time when the servlet is initialised via the init(ServletConfig) method.
 String getServletInfo()
          
 void init(ServletConfig config)
          
protected  void processRequest(HttpServletRequest request, HttpServletResponse response)
          Processes requests for both HTTP GET and POST methods.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceServlet

public ResourceServlet()
Method Detail

getServletInfo

public String getServletInfo()

Specified by:
getServletInfo in interface Servlet
Overrides:
getServletInfo in class GenericServlet

init

public void init(ServletConfig config)

Specified by:
init in interface Servlet
Overrides:
init in class GenericServlet

processRequest

protected void processRequest(HttpServletRequest request,
                              HttpServletResponse response)
                       throws ServletException,
                              IOException
Processes requests for both HTTP GET and POST methods. This servlet ignores URL parameters and POST content, as all the information is in the path, so it really doesn't matter if it is a GET or POST. Checks: - resource exists, - correct path is being used, - configuration/template resources are only accessed by schibsted machines, The resource is served to the ServletOutputStream byte by byte from getClass().getResourceAsStream(..)

Parameters:
request - servlet request
response - servlet response
Throws:
ServletException - if ServletException occurs
IOException - if IOException occurs

doGet

protected void doGet(HttpServletRequest request,
                     HttpServletResponse response)
              throws ServletException,
                     IOException

Overrides:
doGet in class HttpServlet
Throws:
ServletException
IOException

doPost

protected void doPost(HttpServletRequest request,
                      HttpServletResponse response)
               throws ServletException,
                      IOException

Overrides:
doPost in class HttpServlet
Throws:
ServletException
IOException

getLastModified

protected long getLastModified(HttpServletRequest req)
Assigned to the time when the servlet is initialised via the init(ServletConfig) method. Any redeployment of the skin results in an update in the last-modified response header. Editing the files "in-place" on disk will not have any effect on the last-modified header.

Overrides:
getLastModified in class HttpServlet
Parameters:
req - incoming HttpServletRequest request
Returns:
last-modified header (in milliseconds)


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.