org.hd.d.pg2k.webSvr.threeD
Class DataServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.hd.d.pg2k.webSvr.threeD.DataServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public final class DataServlet
extends javax.servlet.http.HttpServlet

3D Walkthrough data servlet. Supports 3D walkthrough app by servicing its simple, small, incremental data requests.

All requests are GET requests.

Also contains static client-side send/receive code to keep everything in one place.

See Also:
Serialized Form

Field Summary
static java.lang.String DSVNAME_HTTPFAIL
          General stats event name: failures handling input HTTP requests.
static java.lang.String DSVNAME_HTTPREJOP
          General stats event name: inbound HTTP request rejected by request op-code.
static java.lang.String DSVNAME_HTTPREQUEST
          General stats event name: inbound HTTP request.
private  WebUtils.ServletLoggerWithFallback logger
          Our logger which falls back to System.out if servlet log not available; never null.
private static long serialVersionUID
          Unique Serialisation class ID generated by http://random.hd.org/.
private  StatsLogger.StatsConfig statsIDDSV
          The stats set to which we log general tunnel servlet stats.
private static DataSourceBean.AEPLinkedKey WTKey
          Key for 3DWT-linked data in DataSourceBean.
 
Constructor Summary
DataServlet()
           
 
Method Summary
 void destroy()
          Unhook from servlet logger.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Respond to a GET request from 3DWT clients.
private static Tuple.Pair<LightweightMetaDataFetchInterface.GalleryBasicMetaData,java.util.List<Name.ExhibitFull>> getData(DataSourceBean dsb)
          Get the filtered data associated with the current DataSourceBean; never null.
private static DataSourceBean getDataSourceBean(javax.servlet.ServletContext ctxt, javax.servlet.http.HttpServletRequest request)
          Get singleton (per-servlet-context) data pipeline/cache instance.
 void init(javax.servlet.ServletConfig servletConfig)
          Hook into servlet logger.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
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

logger

private final WebUtils.ServletLoggerWithFallback logger
Our logger which falls back to System.out if servlet log not available; never null.


statsIDDSV

private final StatsLogger.StatsConfig statsIDDSV
The stats set to which we log general tunnel servlet stats. The unique codes are the constants DSVNAME_XXX.


DSVNAME_HTTPREQUEST

public static final java.lang.String DSVNAME_HTTPREQUEST
General stats event name: inbound HTTP request.

See Also:
Constant Field Values

DSVNAME_HTTPFAIL

public static final java.lang.String DSVNAME_HTTPFAIL
General stats event name: failures handling input HTTP requests.

See Also:
Constant Field Values

DSVNAME_HTTPREJOP

public static final java.lang.String DSVNAME_HTTPREJOP
General stats event name: inbound HTTP request rejected by request op-code.

See Also:
Constant Field Values

WTKey

private static final DataSourceBean.AEPLinkedKey WTKey
Key for 3DWT-linked data in DataSourceBean.


serialVersionUID

private static final long serialVersionUID
Unique Serialisation class ID generated by http://random.hd.org/.

See Also:
Constant Field Values
Constructor Detail

DataServlet

public DataServlet()
Method Detail

destroy

public void destroy()
Unhook from servlet logger.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

init

public void init(javax.servlet.ServletConfig servletConfig)
          throws javax.servlet.ServletException
Hook into servlet logger.

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

getDataSourceBean

private static DataSourceBean getDataSourceBean(javax.servlet.ServletContext ctxt,
                                                javax.servlet.http.HttpServletRequest request)
Get singleton (per-servlet-context) data pipeline/cache instance. The config param must not be null, but for some operations (such as calling destroy()) request can be null.

This does not cache its return value.


doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws java.io.IOException
Respond to a GET request from 3DWT clients.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
java.io.IOException - if an input/output error occurs

getData

private static Tuple.Pair<LightweightMetaDataFetchInterface.GalleryBasicMetaData,java.util.List<Name.ExhibitFull>> getData(DataSourceBean dsb)
                                                                                                                    throws java.io.IOException
Get the filtered data associated with the current DataSourceBean; never null. A new value is created on first use and when the AEP changes.

This call should always be very fast except when doing the initial filtering/construction of the exhibit list when there would be a danger of races and redundant resource usage, so we serialise calls to eliminate this possibility.

Throws:
java.io.IOException

DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.