org.klomp.snark.web
Class I2PSnarkServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.mortbay.jetty.servlet.DefaultServlet
              extended by org.klomp.snark.web.I2PSnarkServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig, org.mortbay.resource.ResourceFactory

public class I2PSnarkServlet
extends DefaultServlet

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
static String PROP_CONFIG_FILE
           
 
Constructor Summary
I2PSnarkServlet()
           
 
Method Summary
 void destroy()
           
 void doGet(HttpServletRequest request, HttpServletResponse response)
          Tell the browser to cache the icons
 org.mortbay.resource.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 init(ServletConfig cfg)
           
 void service(HttpServletRequest req, HttpServletResponse resp)
          Some parts modified from:
(package private) static String urlify(String s)
           
 
Methods inherited from class org.mortbay.jetty.servlet.DefaultServlet
doPost, doTrace, getInitParameter, init, passConditionalHeaders, sendData, sendDirectory, writeHeaders, writeOptionHeaders, writeOptionHeaders
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
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 DefaultServlet

getResource

public org.mortbay.resource.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

Specified by:
getResource in interface org.mortbay.resource.ResourceFactory
Overrides:
getResource in class DefaultServlet

doGet

public void doGet(HttpServletRequest request,
                  HttpServletResponse response)
           throws ServletException,
                  IOException
Tell the browser to cache the icons

Overrides:
doGet in class DefaultServlet
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 HttpServlet
Throws:
ServletException
IOException

urlify

static String urlify(String s)
Since:
0.7.14