Author: fmeschbe
Date: Wed Dec 19 04:37:53 2007
New Revision: 605527
URL: http://svn.apache.org/viewvc?rev=605527&view=rev
Log:
Cosmetics: Move getContextPath method and rename requestHandler variable
to mainSlingServlet.
Modified:
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java
Modified:
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java?rev=605527&r1=605526&r2=605527&view=diff
==============================================================================
---
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java
(original)
+++
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/helper/SlingServletContext.java
Wed Dec 19 04:37:53 2007
@@ -71,7 +71,7 @@
private final Logger log = LoggerFactory.getLogger(getClass());
/** The [EMAIL PROTECTED] SlingMainServlet} to which some calls are
delegated */
- private final SlingMainServlet requestHandler;
+ private final SlingMainServlet slingMainServlet;
/** The service registration of this service as a ManagedService */
private final ServiceRegistration registration;
@@ -82,14 +82,14 @@
* a <code>ManagedService</code> and <code>ServletContext</code> to
* receive configuration information.
*/
- public SlingServletContext(SlingMainServlet requestHandler) {
- this.requestHandler = requestHandler;
+ public SlingServletContext(SlingMainServlet slingMainServlet) {
+ this.slingMainServlet = slingMainServlet;
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(Constants.SERVICE_PID, getClass().getName());
props.put(Constants.SERVICE_DESCRIPTION, "Sling ServletContext");
props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
- registration = requestHandler.getBundleContext().registerService(
+ registration = slingMainServlet.getBundleContext().registerService(
ServletContext.class.getName(), this, props);
}
@@ -113,6 +113,15 @@
return getServletContext().getServletContextName();
}
+ /** Returns the context path of the web application. (Servlet API 2.5) */
+ public String getContextPath() {
+ try {
+ return (String)
getServletContext().getClass().getMethod("getContextPath", (Class<?>[])
null).invoke(getServletContext(), (Object[]) null);
+ } catch (Exception ignore) {
+ return null;
+ }
+ }
+
/**
* Returns the init-param of the servlet context in which Sling is
* configured. This method calls on the <code>ServletContext</code> in
@@ -178,7 +187,7 @@
* string as returned by the servlet context in which Sling is configured.
*/
public String getServerInfo() {
- return requestHandler.getServerInfo();
+ return slingMainServlet.getServerInfo();
}
/**
@@ -324,24 +333,14 @@
return Collections.enumeration(Collections.emptyList());
}
- /** Returns the context path of the web application. (Servlet API 2.5) */
- public String getContextPath() {
- try {
- return (String)
getServletContext().getClass().getMethod("getContextPath",
null).invoke(getServletContext(), null);
- } catch (Exception ignore) {
- return null;
- }
- }
-
// ---------- internal
-----------------------------------------------------
-
/**
* Returns the real servlet context of the servlet container in which the
* Sling Servlet is running.
*/
private ServletContext getServletContext() {
- return requestHandler.getServletContext();
+ return slingMainServlet.getServletContext();
}
}