org.backsource.utils.resource
Class ServletContextURLFactory

java.lang.Object
  extended byorg.backsource.utils.resource.ServletContextURLFactory
All Implemented Interfaces:
URLFactory

public class ServletContextURLFactory
extends java.lang.Object
implements URLFactory

Resolve URI:s to URL by looking them up in the ServletContext.

The URI.getPath() is used to get the resource name.

Version:
$Revison$
Author:
Peter Antman

Constructor Summary
ServletContextURLFactory(javax.servlet.ServletContext ctx)
          Create with a ServletContext.
 
Method Summary
protected  java.lang.String getResURI(URI uri)
           
 java.net.URL getURL(URI uri)
          Construct an URL from URI by looking it up in the ContextClassLoader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletContextURLFactory

public ServletContextURLFactory(javax.servlet.ServletContext ctx)
Create with a ServletContext.

Parameters:
ctx - a servlet context
Throws:
java.lang.IllegalArgumentException - thrown if ctx is null
Method Detail

getURL

public java.net.URL getURL(URI uri)
                    throws java.net.MalformedURLException
Construct an URL from URI by looking it up in the ContextClassLoader.

Specified by:
getURL in interface URLFactory
Throws:
java.net.MalformedURLException

getResURI

protected java.lang.String getResURI(URI uri)


Copyright © 2000-2004 Backsource. All Rights Reserved.