org.apache.turbine.services.servlet
Class TurbineServletService
java.lang.Object
|
+--org.apache.turbine.services.BaseInitable
|
+--org.apache.turbine.services.BaseService
|
+--org.apache.turbine.services.TurbineBaseService
|
+--org.apache.turbine.services.servlet.TurbineServletService
- All Implemented Interfaces:
- Initable, Service, ServletService
- public class TurbineServletService
- extends TurbineBaseService
- implements ServletService
This class provides a context service when the application
is run in a ServletContainer. It is mainly a wrapper around
the ServletContext API.
This class requires Servlet API 2.1 or better.
- Version:
- $Id: TurbineServletService.java,v 1.2 2001/09/16 03:32:02 jvanzyl Exp $
- Author:
- Kevin A. Burton, Raphaël Luta, Jeff Brekke, Santiago Gala, Jason van Zyl, Jon S. Stevens
Method Summary |
java.lang.String |
expandRelative(java.lang.String path)
Expands a string that points to a relative path or path list,
leaving it as an absolute path based on the servlet context. |
java.lang.String |
getContextPath()
Returns the context path for this
Turbine application. |
java.lang.String |
getRealPath(java.lang.String uri)
Returns the complete filesystem path for a
given URI |
java.net.URL |
getResource(java.lang.String uri)
Returns an URL object for a given URI string. |
java.io.InputStream |
getResourceAsStream(java.lang.String uri)
Same as getResource except that it returns an InputStream |
java.lang.String |
getServerName()
Returns the server name that this
Turbine application is running
on. |
java.lang.String |
getServerPort()
Returns the port that this Turbine
application is running through
on the server. |
java.lang.String |
getServerScheme()
Returns the server scheme for this
Turbine application. |
javax.servlet.ServletConfig |
getServletConfig()
Returns the servlet config used by this
Turbine web application. |
javax.servlet.ServletContext |
getServletContext()
Returns the servlet context used by this
Turbine web application. |
void |
init(javax.servlet.ServletConfig servletConfig)
Called during Turbine.init() |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
servletContext
private javax.servlet.ServletContext servletContext
servletConfig
private javax.servlet.ServletConfig servletConfig
TurbineServletService
public TurbineServletService()
init
public void init(javax.servlet.ServletConfig servletConfig)
- Called during Turbine.init()
- Overrides:
init
in class TurbineBaseService
- Parameters:
config
- A ServletConfig.
getResource
public java.net.URL getResource(java.lang.String uri)
- Returns an URL object for a given URI string.
This URI is considered relative to the context.
- Specified by:
getResource
in interface ServletService
- Parameters:
uri
- the URI to resolve as an URL- Returns:
- an URL object or null is the uri is malformed or
can't be resolved
- See Also:
ServletContext.getResource(java.lang.String)
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String uri)
- Same as getResource except that it returns an InputStream
- Specified by:
getResourceAsStream
in interface ServletService
- Parameters:
uri
- the URI to resolve- Returns:
- an InputStream on the URI content or null
- See Also:
ServletContext.getResourceAsStream(java.lang.String)
getRealPath
public java.lang.String getRealPath(java.lang.String uri)
- Returns the complete filesystem path for a
given URI
- Specified by:
getRealPath
in interface ServletService
- Parameters:
uri
- the URI to resolve- Returns:
- the full system path of this URI
- See Also:
ServletContext.getRealPath(java.lang.String)
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
- Returns the servlet config used by this
Turbine web application.
- Specified by:
getServletConfig
in interface ServletService
- Returns:
- turbine servlet config
getServletContext
public javax.servlet.ServletContext getServletContext()
- Returns the servlet context used by this
Turbine web application.
- Specified by:
getServletContext
in interface ServletService
- Returns:
- turbine servlet context
getServerScheme
public java.lang.String getServerScheme()
- Returns the server scheme for this
Turbine application. This will either
be http or https.
- Specified by:
getServerScheme
in interface ServletService
- Returns:
- String
getServerName
public java.lang.String getServerName()
- Returns the server name that this
Turbine application is running
on.
- Specified by:
getServerName
in interface ServletService
- Returns:
- String
getServerPort
public java.lang.String getServerPort()
- Returns the port that this Turbine
application is running through
on the server.
- Specified by:
getServerPort
in interface ServletService
- Returns:
- String
getContextPath
public java.lang.String getContextPath()
- Returns the context path for this
Turbine application.
- Specified by:
getContextPath
in interface ServletService
- Returns:
- String
expandRelative
public java.lang.String expandRelative(java.lang.String path)
- Expands a string that points to a relative path or path list,
leaving it as an absolute path based on the servlet context.
It will return null if the text is empty or the config object
is null.
- Parameters:
config
- The ServletConfig.text
- The String containing a path or path list.- Returns:
- A String with the expanded path or path list.
Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.