Example usage for javax.servlet ServletContext ServletContext

List of usage examples for javax.servlet ServletContext ServletContext

Introduction

In this page you can find the example usage for javax.servlet ServletContext ServletContext.

Prototype

ServletContext

Source Link

Usage

From source file:jp.dip.komusubi.botter.gae.GaeContextFactory.java

/**
 * @return/*from w w w. j  av a2 s .c o  m*/
 */
private static ServletContext getDefaultServletContext() {
    return new ServletContext() {

        @Override
        public Object getAttribute(String arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public Enumeration getAttributeNames() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public ServletContext getContext(String arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getContextPath() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getInitParameter(String arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public Enumeration getInitParameterNames() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public int getMajorVersion() {
            // TODO Auto-generated method stub
            return 0;
        }

        @Override
        public String getMimeType(String arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public int getMinorVersion() {
            // TODO Auto-generated method stub
            return 0;
        }

        @Override
        public RequestDispatcher getNamedDispatcher(String arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getRealPath(String arg0) {
            String filename = arg0.replace("/WEB-INF", "");
            String path = "target/test-classes/";
            if (testCaseClass != null)
                path += testCaseClass.getPackage().getName().replace(".", "/");
            else
                path += filename;
            return path;
        }

        @Override
        public RequestDispatcher getRequestDispatcher(String arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public URL getResource(String arg0) throws MalformedURLException {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public InputStream getResourceAsStream(String arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public Set getResourcePaths(String arg0) {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getServerInfo() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public Servlet getServlet(String arg0) throws ServletException {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getServletContextName() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public Enumeration getServletNames() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public Enumeration getServlets() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public void log(String arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void log(Exception arg0, String arg1) {
            // TODO Auto-generated method stub

        }

        @Override
        public void log(String arg0, Throwable arg1) {
            // TODO Auto-generated method stub

        }

        @Override
        public void removeAttribute(String arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void setAttribute(String arg0, Object arg1) {
            // TODO Auto-generated method stub

        }

    };
}

From source file:org.openmeetings.cli.Admin.java

private ClassPathXmlApplicationContext getApplicationContext(final String ctxName) {
    if (ctx == null) {
        OMContextListener omcl = new OMContextListener();
        omcl.contextInitialized(new ServletContextEvent(new ServletContext() {
            public void setAttribute(String arg0, Object arg1) {
            }//from  w w w  .j a  v  a  2  s .  c  o m

            public void removeAttribute(String arg0) {
            }

            public void log(String arg0, Throwable arg1) {
            }

            public void log(Exception arg0, String arg1) {
            }

            public void log(String arg0) {
            }

            @SuppressWarnings("rawtypes")
            public Enumeration getServlets() {
                return null;
            }

            @SuppressWarnings("rawtypes")
            public Enumeration getServletNames() {
                return null;
            }

            public String getServletContextName() {
                return null;
            }

            public Servlet getServlet(String arg0) throws ServletException {
                return null;
            }

            public String getServerInfo() {
                return null;
            }

            @SuppressWarnings("rawtypes")
            public Set getResourcePaths(String arg0) {
                return null;
            }

            public InputStream getResourceAsStream(String arg0) {
                return null;
            }

            public URL getResource(String arg0) throws MalformedURLException {
                return null;
            }

            public RequestDispatcher getRequestDispatcher(String arg0) {
                return null;
            }

            public String getRealPath(String arg0) {
                return null;
            }

            public RequestDispatcher getNamedDispatcher(String arg0) {
                return null;
            }

            public int getMinorVersion() {
                return 0;
            }

            public String getMimeType(String arg0) {
                return null;
            }

            public int getMajorVersion() {
                return 0;
            }

            @SuppressWarnings("rawtypes")
            public Enumeration getInitParameterNames() {
                return null;
            }

            public String getInitParameter(String arg0) {
                return null;
            }

            public String getContextPath() {
                return ctxName;
            }

            public ServletContext getContext(String arg0) {
                return null;
            }

            @SuppressWarnings("rawtypes")
            public Enumeration getAttributeNames() {
                return null;
            }

            public Object getAttribute(String arg0) {
                return null;
            }
        }));
        try {
            ctx = new ClassPathXmlApplicationContext("openmeetings-applicationContext.xml");
        } catch (Exception e) {
            handleError("Unable to obtain application context", e);
        }
    }
    return ctx;
}