Package org.b3log.latke.servlet

Examples of org.b3log.latke.servlet.HTTPRequestContext


            LOGGER.finer("Try to get preference to confirm whether the preference exixts");
            final JSONObject preference = preferenceQueryService.getPreference();
            if (null == preference) {
                LOGGER.log(Level.WARNING, "B3log Solo has not been initialized, so redirects to /init");

                final HTTPRequestContext context = new HTTPRequestContext();
                context.setRequest((HttpServletRequest) request);
                context.setResponse((HttpServletResponse) response);

                request.setAttribute(Keys.HttpRequest.REQUEST_URI, Latkes.getContextPath() + "/init");
                request.setAttribute(Keys.HttpRequest.REQUEST_METHOD, HTTPRequestMethod.GET.name());

                HTTPRequestDispatcher.dispatch(context);
View Full Code Here


     * @see HTTPRequestDispatcher#dispatch(org.b3log.latke.servlet.HTTPRequestContext)
     */
    private void dispatchToArticleOrPageProcessor(final ServletRequest request, final ServletResponse response,
                                                  final JSONObject article, final JSONObject page)
            throws ServletException, IOException {
        final HTTPRequestContext context = new HTTPRequestContext();
        context.setRequest((HttpServletRequest) request);
        context.setResponse((HttpServletResponse) response);

        if (null != article) {
            request.setAttribute(Article.ARTICLE, article);
            request.setAttribute(Keys.HttpRequest.REQUEST_URI, Latkes.getContextPath() + "/article");
        } else {
View Full Code Here

            return;
        }

        LOGGER.log(Level.INFO, "B3log Solo has not been initialized, so redirects to /init");

        final HTTPRequestContext context = new HTTPRequestContext();

        context.setRequest((HttpServletRequest) request);
        context.setResponse((HttpServletResponse) response);

        request.setAttribute(Keys.HttpRequest.REQUEST_URI, Latkes.getContextPath() + "/init");
        request.setAttribute(Keys.HttpRequest.REQUEST_METHOD, HTTPRequestMethod.GET.name());

        final HttpControl httpControl = new HttpControl(DispatcherServlet.SYS_HANDLER.iterator(), context);

        try {
            httpControl.nextHandler();
        } catch (final Exception e) {
            context.setRenderer(new HTTP500Renderer(e));
        }

        DispatcherServlet.result(context);
    }
View Full Code Here

     * @see HTTPRequestDispatcher#dispatch(org.b3log.latke.servlet.HTTPRequestContext)
     */
    private void dispatchToArticleOrPageProcessor(final ServletRequest request, final ServletResponse response,
        final JSONObject article, final JSONObject page)
        throws ServletException, IOException {
        final HTTPRequestContext context = new HTTPRequestContext();

        context.setRequest((HttpServletRequest) request);
        context.setResponse((HttpServletResponse) response);

        if (null != article) {
            request.setAttribute(Article.ARTICLE, article);
            request.setAttribute(Keys.HttpRequest.REQUEST_URI, Latkes.getContextPath() + "/article");
        } else {
            request.setAttribute(Page.PAGE, page);
            request.setAttribute(Keys.HttpRequest.REQUEST_URI, Latkes.getContextPath() + "/page");
        }

        request.setAttribute(Keys.HttpRequest.REQUEST_METHOD, HTTPRequestMethod.GET.name());

        final HttpControl httpControl = new HttpControl(DispatcherServlet.SYS_HANDLER.iterator(), context);

        try {
            httpControl.nextHandler();
        } catch (final Exception e) {
            context.setRenderer(new HTTP500Renderer(e));
        }

        DispatcherServlet.result(context);
    }
View Full Code Here

TOP

Related Classes of org.b3log.latke.servlet.HTTPRequestContext

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.