Package org.jboss.capedwarf.server.api.servlet

Examples of org.jboss.capedwarf.server.api.servlet.RequestHandler


        for (HandlerMapping hm : mappings)
            hm.initialize(context);
    }

    public void handle(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        RequestHandler handler = findHandler(req);
        handler.initialize(context);
        handler.handle(req, resp);
    }
View Full Code Here


     * @return matching request handler
     * @throws ServletException if handler is not found
     */
    protected RequestHandler findHandler(HttpServletRequest req) throws ServletException {
        for (HandlerMapping hm : mappings) {
            RequestHandler handler = hm.findHandler(req);
            if (handler != null)
                return handler;
        }
        throw new ServletException("No such mapping: " + req.getRequestURL() + " - " + mappings);
    }
View Full Code Here

    public void initialize(ServletContext context) {
    }

    public RequestHandler findHandler(HttpServletRequest req) {
        String path = req.getPathInfo();
        RequestHandler handler = handlers.get(path);
        if (handler != null)
            return handler;

        for (String ep : handlers.keySet()) {
            if (path.startsWith(ep))
View Full Code Here

    @SuppressWarnings({"unchecked"})
    public void handle(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String actionName = req.getParameter("action");
        if (actionName != null) {
            RequestHandler action = actions.get(actionName);
            if (action == null) {
                Class<RequestHandler> ac = classes.get(actionName);
                if (ac != null) {
                    if (beanManager == null)
                        throw new IllegalArgumentException("No Weld manager present");

                    InjectionTarget<RequestHandler> it = beanManager.createInjectionTarget(beanManager.createAnnotatedType(ac));
                    CreationalContext<RequestHandler> cc = beanManager.createCreationalContext(null);
                    action = it.produce(cc);
                    it.inject(action, cc);

                    action.initialize(context);

                    actions.put(actionName, action);
                }
            }

            if (action != null)
                action.handle(req, resp);
            else
                throw new ServletException("No such matching action: " + actionName);
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.capedwarf.server.api.servlet.RequestHandler

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.