Package javax.servlet

Examples of javax.servlet.ServletConfig


        {
            stream.writeObject( _configParams );
        }
        else
        {
            ServletConfig servletConfig = getServletConfig();
            assert servletConfig != null;
            HashMap params = new HashMap();
           
            for ( Enumeration e = servletConfig.getInitParameterNames(); e.hasMoreElements(); )
            {
                String name = ( String ) e.nextElement();
                params.put( name, servletConfig.getInitParameter( name ) );
            }
           
            stream.writeObject( params );
        }
    }
View Full Code Here


    /**
     * <p>Clean up after ourselves as this application shuts down.</p>
     */
    public void destroy() {

        ServletConfig config = getServletConfig();
        ServletContext context = getServletContext();
        String attr = config.getInitParameter(CONFIG_ATTR);
        if (attr != null) {
            context.removeAttribute(attr);
        }
        CatalogFactory.clear();

View Full Code Here

     *
     * @throws ServletException if the servlet could not be initialized
     */
    public void init() throws ServletException {

        ServletConfig config = getServletConfig();
        ServletContext context = getServletContext();
        if (log.isInfoEnabled()) {
            log.info("Initializing chain servlet '"
                     + config.getServletName() + "'");
        }

        // Retrieve servlet init parameters that we need
        String attr = config.getInitParameter(CONFIG_ATTR);
        String classResources =
            context.getInitParameter(CONFIG_CLASS_RESOURCE);
        String ruleSet = context.getInitParameter(RULE_SET);
        String webResources = context.getInitParameter(CONFIG_WEB_RESOURCE);

View Full Code Here

        ori.setHttpMethod("GET");
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        HttpServletResponse response = new HttpServletResponseFilter(
                                           EasyMock.createMock(HttpServletResponse.class), null);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        ServletConfig config = EasyMock.createMock(ServletConfig.class);       
       
        EasyMock.replay(request);
        EasyMock.replay(context);
        EasyMock.replay(config);
       
        Message m = new MessageImpl();
        m.put(AbstractHTTPDestination.HTTP_REQUEST, request);
        m.put(AbstractHTTPDestination.HTTP_RESPONSE, response);
        m.put(AbstractHTTPDestination.HTTP_CONTEXT, context);
        m.put(AbstractHTTPDestination.HTTP_CONFIG, config);
       
        List<Object> params =
            JAXRSUtils.processParameters(ori, new MetadataMap<String, String>(), m);
        assertEquals("4 parameters expected", 4, params.size());
        assertSame(request.getClass(), params.get(0).getClass());
        assertSame(response.getClass(), params.get(1).getClass());
        assertSame(context.getClass(), params.get(2).getClass());
        assertSame(config.getClass(), params.get(3).getClass());
       
    }
View Full Code Here

            if (defaultParams.getEnvironment() == null) {
                Application application = context.getApplication();
                String environmentName = getAppParameter(application, LibraryRequestParams.PARAM_ENVIRONMENT, LibraryRequestParams.DEFAULT_ENVIRONMENT);
                SBTEnvironment environment = (SBTEnvironment) context.getBean(environmentName);
                if (environment == null) {
                    ServletConfig config = getServletConfig();
                    String defaultEndpoints = getAppParameter(application, LibraryRequestParams.PARAM_ENDPOINTS, LibraryRequestParams.DEFAULT_ENDPOINTS);
                    String endpoints = getInitParameter(config, LibraryRequestParams.PARAM_ENDPOINTS, defaultEndpoints);
                    String defaultClientProps = getAppParameter(application, LibraryRequestParams.PARAM_CLIENT_PROPERTIES, LibraryRequestParams.DEFAULT_CLIENT_PROPERTIES);
                    String clientProps = getInitParameter(config, LibraryRequestParams.PARAM_CLIENT_PROPERTIES, defaultClientProps);
View Full Code Here

        // TODO: must be a better way to get this than using a static
        servletHost = new WebAppServletHost();
        servletHosts.put(Thread.currentThread().getContextClassLoader(), servletHost);

        // Initialize the Servlet host
        servletHost.init(new ServletConfig() {
            public String getInitParameter(String name) {
                return config.getInitParameter(name);
            }

            public Enumeration getInitParameterNames() {
View Full Code Here

     * @throws ServletException
     */
    public void init(final FilterConfig filterConfig) throws ServletException {
       
        // Create a Servlet config wrapping the given filter config
        ServletConfig servletConfig = servletConfig(filterConfig);

        // Get the Servlet context
        ServletContext servletContext = servletConfig.getServletContext();

        // Initialize the context path
        contextPath = contextPath(servletContext);

        // Derive the node name from the Webapp context path
View Full Code Here

     *
     * @param filterConfig
     * @return
     */
    private static ServletConfig servletConfig(final FilterConfig filterConfig) {
        ServletConfig servletConfig = new ServletConfig() {
            public String getInitParameter(String name) {
                return filterConfig.getInitParameter(name);
            }

            public Enumeration getInitParameterNames() {
View Full Code Here

        redirectAttributes = parseMapSequence(servletConfig.getInitParameter(REDIRECT_ATTRIBUTES_PARAMETER));
           
       
    }
    public final void init(final FilterConfig filterConfig) throws ServletException {
        init(new ServletConfig() {
            public String getServletName() {
                return filterConfig.getFilterName();
            }
            public ServletContext getServletContext() {
                return filterConfig.getServletContext();
View Full Code Here

    private int maximumMessages = 100;
    private Timer clientCleanupTimer = new Timer();
    private HashMap<String,AjaxWebClient> ajaxWebClients = new HashMap<String,AjaxWebClient>();

    public void init() throws ServletException {
        ServletConfig servletConfig = getServletConfig();
        String name = servletConfig.getInitParameter("defaultReadTimeout");
        if (name != null) {
            defaultReadTimeout = asLong(name);
        }
        name = servletConfig.getInitParameter("maximumReadTimeout");
        if (name != null) {
            maximumReadTimeout = asLong(name);
        }
        name = servletConfig.getInitParameter("maximumMessages");
        if (name != null) {
            maximumMessages = (int)asLong(name);
        }
        clientCleanupTimer.schedule( new ClientCleaner(), 5000, 60000 );
    }
View Full Code Here

TOP

Related Classes of javax.servlet.ServletConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.