Package org.klomp.snark.web
Class I2PSnarkServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.klomp.snark.web.BasicServlet
org.klomp.snark.web.I2PSnarkServlet
- All Implemented Interfaces:
Serializable,Servlet,ServletConfig
public class I2PSnarkServlet extends BasicServlet
Refactored to eliminate Jetty dependencies.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class org.klomp.snark.web.BasicServlet
BasicServlet.HttpContent -
Field Summary
Fields Modifier and Type Field Description (package private) StringcspNoncestatic StringPROP_CONFIG_FILE -
Constructor Summary
Constructors Constructor Description I2PSnarkServlet() -
Method Summary
Modifier and Type Method Description voiddestroy()voiddoGet(HttpServletRequest request, HttpServletResponse response)Handle what we can here, calling super.doGet() for the rest.voiddoPost(HttpServletRequest request, HttpServletResponse response)Handle what we can here, calling super.doPost() for the rest.FilegetResource(String pathInContext)We override this to set the file relative to the storage directory for the torrent.voidinit(ServletConfig cfg)booleanisAdvanced()(package private) StringtoIcon(String path)Pick an icon; try to catch the common types in an i2p environment Pkg private for FileTypeSorter.(package private) static Stringurlify(String s)This is for a full URL.Methods inherited from class org.klomp.snark.web.BasicServlet
addMimeMapping, addPaths, decodePath, doDelete, doOptions, doTrace, encodePath, getContent, getMimeType, loadMimeMap, passConditionalHeaders, sendData, setResourceBase, setWarBase, writeHeadersMethods inherited from class javax.servlet.http.HttpServlet
doHead, doPut, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
PROP_CONFIG_FILE
- See Also:
- Constant Field Values
-
cspNonce
String cspNonce
-
-
Constructor Details
-
I2PSnarkServlet
public I2PSnarkServlet()
-
-
Method Details
-
init
- Specified by:
initin interfaceServlet- Overrides:
initin classBasicServlet- Throws:
ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfaceServlet- Overrides:
destroyin classGenericServlet
-
getResource
We override this to set the file relative to the storage directory for the torrent.- Overrides:
getResourcein classBasicServlet- Parameters:
pathInContext- should always start with /- Returns:
- The resource to serve or null if not existing
-
doGet
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExceptionHandle what we can here, calling super.doGet() for the rest.- Overrides:
doGetin classBasicServlet- Throws:
ServletExceptionIOException- Since:
- 0.8.3
-
doPost
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExceptionHandle what we can here, calling super.doPost() for the rest.- Overrides:
doPostin classBasicServlet- Throws:
ServletExceptionIOException- Since:
- Jetty 7
-
isAdvanced
public boolean isAdvanced() -
urlify
This is for a full URL. For a path only, use encodePath().- Since:
- 0.7.14
-
toIcon
Pick an icon; try to catch the common types in an i2p environment Pkg private for FileTypeSorter.- Returns:
- file name not including ".png"
- Since:
- 0.7.14
-