Package com.alibaba.citrus.turbine

Examples of com.alibaba.citrus.turbine.TurbineRunData


        //has action and execute success
        getInvocationContext("http://localhost/app1/aaa/bbb/myOtherModule.jsp?action=aaa/bbb/MyOtherAction");
        initRequestContext();

        TurbineRunData rundata = getTurbineRunData(request);
        rundata.setRedirectTarget("other");

        pipeline.newInvocation().invoke();
        assertEquals(null, rundata.getRequest().getAttribute("module.action.aaa.bbb.MyOtherAction"));
    }
View Full Code Here


    @Override
    protected void init() throws Exception {
    }

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunData rundata = getTurbineRunData(request);
        if (ignoreTarget(rundata.getTarget())) {
            pipelineContext.invokeNext();
            return;
        }

        //默认是中文
        String[] temp = rundata.getCookies().getStrings("locale");
        String locale = null;
        if (temp != null) {
            if (temp.length > 1) {
                locale = temp[temp.length - 1];
            } else if (temp.length == 1) {
View Full Code Here

        pipelineContext.invokeNext();
    }
   
   
    private void invokeCheckServicePrivilege(User user) {
      TurbineRunData rundata = getTurbineRunData(request);
      HttpSession session = request.getSession();
     
      @SuppressWarnings("unchecked")
      Map<String, String[]> requestMapping = request.getParameterMap();
     
View Full Code Here

    public MappingRuleService getMappingRuleService() {
        return mappingRuleService;
    }

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunData rundata = getTurbineRunData(request);

        // 检查重定向标志,如果是重定向,则不需要将页面输出。
        if (!rundata.isRedirected()) {
            setContentType(rundata);
            performScreenModule(rundata);
        }

        pipelineContext.invokeNext();
View Full Code Here

    public RequestHandlerValve(HttpRequestHandler handler) {
        this.handler = assertNotNull(handler, "handler");
    }

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunData rundata = getTurbineRunData(request);
        handler.handleRequest(rundata.getRequest(), rundata.getResponse());
        pipelineContext.invokeNext();
    }
View Full Code Here

    protected void init() throws Exception {
        substName = defaultIfNull(substName, DEFAULT_SUBSTITUTION_NAME);
    }

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunData rundata = getTurbineRunData(request);
        Substitution subst = getSubstitution(pipelineContext);

        String resourceName;

        if (subst != null && this.resourceName != null) {
            resourceName = trimToNull(subst.substitute(this.resourceName));
        } else {
            resourceName = ServletUtil.getResourcePath(rundata.getRequest());
        }

        try {
            resourceName = URI.create(resourceName).normalize().toString();

            if (resourceName.contains("../")) {
                resourceName = null;
            }
        } catch (IllegalArgumentException e) {
            resourceName = null;
        }

        Resource resource = null;

        if (resourceName != null) {
            resource = loader.getResource(resourceName);
        }

        if (resource == null || !resource.exists()) {
            throw new com.alibaba.citrus.webx.ResourceNotFoundException("Could not find resource: " + resourceName);
        }

        InputStream istream = null;
        OutputStream ostream = null;

        try {
            URLConnection connection = resource.getURL().openConnection();
            String contentType = connection.getContentType();

            if (contentType != null) {
                rundata.getResponse().setContentType(contentType);
            }

            istream = connection.getInputStream();

            // 现在已经取得输入流,开始输出。
            bufferedRequestContext.setBuffering(false);

            ostream = rundata.getResponse().getOutputStream();

            StreamUtil.io(istream, ostream, true, false);
        } catch (IOException e) {
            throw new PipelineException("Failed reading resource: " + resource);
        } finally {
View Full Code Here

    @Autowired
    private ModuleLoaderService moduleLoaderService;

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunData rundata = getTurbineRunData(request);

        // 检查重定向标志,如果是重定向,则不需要将页面输出。
        if (!rundata.isRedirected()) {
            String action = rundata.getAction();

            // 如果找到action,则执行之。
            if (!StringUtil.isEmpty(action)) {
                String actionKey = "_action_" + action;

                // 防止重复执行同一个action。
                if (rundata.getRequest().getAttribute(actionKey) == null) {
                    rundata.getRequest().setAttribute(actionKey, "executed");

                    try {
                        moduleLoaderService.getModule(ACTION_MODULE, action).execute();
                    } catch (ModuleLoaderException e) {
                        throw new PipelineException("Could not load action module: " + action, e);
View Full Code Here

    public void setJavascriptContentType(String javascriptContentType) {
        this.javascriptContentType = trimToNull(javascriptContentType);
    }

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunData rundata = getTurbineRunData(request);

        if (!rundata.isRedirected()) {
            Object resultObject = consumeInputValue(pipelineContext);

            if (resultObject == null) {
                return;
            }
View Full Code Here

    protected void init() throws Exception {
        substName = defaultIfNull(substName, DEFAULT_SUBSTITUTION_NAME);
    }

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunData rundata = getTurbineRunData(request);
        Substitution subst = getSubstitution(pipelineContext);

        String resourceName;

        if (subst != null && this.resourceName != null) {
            resourceName = trimToNull(subst.substitute(this.resourceName));
        } else {
            resourceName = ServletUtil.getResourcePath(rundata.getRequest());
        }

        try {
            resourceName = URI.create(resourceName).normalize().toString();

            if (resourceName.contains("../")) {
                resourceName = null;
            }
        } catch (IllegalArgumentException e) {
            resourceName = null;
        }

        Resource resource = null;

        if (resourceName != null) {
            resource = loader.getResource(resourceName);
        }

        if (resource == null || !resource.exists()) {
            throw new com.alibaba.citrus.webx.ResourceNotFoundException("Could not find resource: " + resourceName);
        }

        InputStream istream = null;
        OutputStream ostream = null;

        try {
            URLConnection connection = resource.getURL().openConnection();
            String contentType = connection.getContentType();

            if (contentType != null) {
                rundata.getResponse().setContentType(contentType);
            }

            istream = connection.getInputStream();

            // 现在已经取得输入流,开始输出。
            bufferedRequestContext.setBuffering(false);

            ostream = rundata.getResponse().getOutputStream();

            StreamUtil.io(istream, ostream, true, false);
        } catch (IOException e) {
            throw new PipelineException("Failed reading resource: " + resource);
        } finally {
View Full Code Here

            callback = new DefaultCallback();
        }
    }

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunData rundata = getTurbineRunData(request);

        @SuppressWarnings("unchecked")
        Callback<Object> cb = (Callback<Object>) callback;

        Object status = cb.onStart(rundata);

        String userName = cb.getUserName(status);
        String[] roleNames = cb.getRoleNames(status);

        String target = rundata.getTarget();
        String action = rundata.getAction();
        String event = capitalize(rundata.getActionEvent());

        // 取得当前请求的actions,包括三部分:
        // 1. screen
        // 2. action.*.event - 假如请求包含action参数的话
        // 3. callback返回的额外actions
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.turbine.TurbineRunData

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.