org.klomp.snark.web

## Class I2PSnarkServlet

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - org.mortbay.jetty.servlet.Default
      - - org.klomp.snark.web.I2PSnarkServlet

- All Implemented Interfaces:
    Serializable, Servlet, ServletConfig

      public class I2PSnarkServlet
      extends Default

  We extend Default instead of HTTPServlet so we can handle i2psnark/ file requests with http:// instead of the flaky and often-blocked-by-the-browser file://
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PROP_CONFIG_FILE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2PSnarkServlet()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()`
    `protected Resource` | `getResource(String pathInContext)` We override this instead of passing a resource base to super(), because if a resource base is set, super.getResource() always uses that base, and we can't get any resources (like icons) out of the .war
    `void` | `handleGet(HttpServletRequest request, HttpServletResponse response, String pathInContext, Resource resource, boolean endsWithSlash)` Tell the browser to cache the icons
    `void` | `init(ServletConfig cfg)`
    `void` | `service(HttpServletRequest req, HttpServletResponse resp)` Some parts modified from:

    - ### Methods inherited from class org.mortbay.jetty.servlet.Default

      `handleDelete, handleMove, handleOptions, handlePut, init, passConditionalHeaders, sendData, sendDirectory, writeHeaders`

    - ### Methods inherited from class javax.servlet.http.HttpServlet

      `doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service`

    - ### Methods inherited from class javax.servlet.GenericServlet

      `getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROP_CONFIG_FILE

          public static final String PROP_CONFIG_FILE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### I2PSnarkServlet

          public I2PSnarkServlet()

  - ### Method Detail

    - #### init

          public void init(ServletConfig cfg)
                    throws ServletException

      Specified by:
        `init` in interface `Servlet`
      Overrides:
        `init` in class `GenericServlet`
      Throws:
        `ServletException`

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `Servlet`
      Overrides:
        `destroy` in class `GenericServlet`

    - #### getResource

          protected Resource getResource(String pathInContext)
                                  throws IOException

      We override this instead of passing a resource base to super(), because if a resource base is set, super.getResource() always uses that base, and we can't get any resources (like icons) out of the .war
      Overrides:
        `getResource` in class `Default`
      Throws:
        `IOException`

    - #### handleGet

          public void handleGet(HttpServletRequest request,
                       HttpServletResponse response,
                       String pathInContext,
                       Resource resource,
                       boolean endsWithSlash)
                         throws ServletException,
                                IOException

      Tell the browser to cache the icons
      Overrides:
        `handleGet` in class `Default`
      Throws:
        `ServletException`
        `IOException`
      Since:
        0.8.3

    - #### service

          public void service(HttpServletRequest req,
                     HttpServletResponse resp)
                       throws ServletException,
                              IOException

      Some parts modified from:

                // ========================================================================
                // $Id: Default.java,v 1.51 2006/10/08 14:13:18 gregwilkins Exp $
                // Copyright 199-2004 Mort Bay Consulting Pty. Ltd.
                // ------------------------------------------------------------------------
                // Licensed under the Apache License, Version 2.0 (the "License");
                // you may not use this file except in compliance with the License.
                // You may obtain a copy of the License at
                // http://www.apache.org/licenses/LICENSE-2.0
                // Unless required by applicable law or agreed to in writing, software
                // distributed under the License is distributed on an "AS IS" BASIS,
                // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
                // See the License for the specific language governing permissions and
                // limitations under the License.
                // ========================================================================

      Overrides:
        `service` in class `Default`
      Throws:
        `ServletException`
        `IOException`