protected void add(String key, String value) { webContext.put(key, value); } };
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; WebContext context = new WebContextImpl(); context.put("springUtil", SpringUtil.class); context.put("context", context); context.putSubContext("applicationproperties", new ContextImpl(ConfigurationUtil.getConfigurationManager().getApplicationPropertiesMap())); putRequstInfo(request, context); context.init(request, response, ServletContextHolder.getServletContext()); String servletPath = request.getServletPath(); if (servletPath == null || servletPath.length() == 0) { servletPath = request.getPathInfo(); } if (isExcluded(servletPath)) { logger.logMessage(LogLevel.DEBUG, "请求路径:<{}>,被拒绝", servletPath); filterChain.doFilter(request, response); return; } TinyFilterHandler hander = new TinyFilterHandler(servletPath, filterChain, context, tinyFilterManager, tinyProcessorManager); if (wrapper != null) { wrapper.filterWrapper(context, hander); } else { hander.tinyFilterProcessor(request,response); } }
context.put("modelDefine", model); Object operationDeclare = modelManager.getOperationDeclare( modelManager.getModelDefine(modelRequestInfo .getModelTypeName()), model, modelRequestInfo .getProcessorId()); context.put("operationDefine", operationDeclare); ModelProcessorStage stage = modelManager .getModelProcessorStage(modelRequestInfo); modelRequestInfo.setStageName(stage.getName()); context.put("modelManager", modelManager); context.put("jsonConverter", jsonConverter); context.put("modelRequestInfo", modelRequestInfo); CustomizeStageConfig customizeConfig = modelManager .getCustomizeStageConfig(modelManager validateMap, context); if (results.getValidateResultMap().size() > 0) { context.put("validateResults", results); String path = modelManager.getModelDefine( modelRequestInfo.getModelTypeName()) context.put("exception", e); ByteArrayOutputStream buf = new ByteArrayOutputStream(); e.printStackTrace(new PrintWriter(buf, true)); context.put("exceptionStackTrace", buf.toString());
private void putRequestInfo(HttpServletRequest request, WebContext context) { String path = request.getContextPath(); if (path == null) { path = ""; } context.put(WebContextUtil.TINY_CONTEXT_PATH, path); context.put(WebContextUtil.TINY_REQUEST_URI, request.getRequestURI()); String servletPath = request.getServletPath(); if (servletPath == null || servletPath.length() == 0) { servletPath = request.getPathInfo(); } context.put(WebContextUtil.TINY_SERVLET_PATH, servletPath); }
context.put("springUtil", BeanContainerFactory .getBeanContainer(getClass().getClassLoader())); postDataProcess(servletPath, request, context);
private void postDataProcess(String servletPath, HttpServletRequest request, WebContext context) throws IOException { if (isPostMethod(request)) { String remoteHost = request.getRemoteHost(); String remoteAddr = request.getRemoteAddr(); for (String nodeName : hostPatternMapping.keySet()) { String hostPattern = hostPatternMapping.get(nodeName); String urlPattern = postDataUrlPattern.get(nodeName); if ((Pattern.matches(hostPattern, remoteHost) || Pattern .matches(hostPattern, remoteAddr)) && Pattern.matches(urlPattern, servletPath)) { context.put(postDataKey, StreamUtil .readBytes(request.getInputStream(), true) .toByteArray()); break; } } } }
if (fileObject != null&&fileObject.isExist()) { webContent .put("uiengine", SpringUtil.getBean("uiComponentManager"));
webContent.put("uiengine", SpringUtil.getBean("uiComponentManager")); webContent.init(request, response,ServletContextHolder.getServletContext());
context.put("uiengine", SpringUtil.getBean("uiComponentManager")); if (isPagelet) {
args[i]=ValueUtil.getValue(args[i].toString(), type.getName()); context.put(parameterNames[i], args[i]);
isPagelet = true; context.put( "uiengine", BeanContainerFactory.getBeanContainer(