| | |
| | | package com.java110.core.base.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.common.constant.CommonConstant; |
| | | import com.java110.common.constant.ResponseConstant; |
| | | import com.java110.common.exception.NoAuthorityException; |
| | | import com.java110.common.factory.PageDataFactory; |
| | | import com.java110.common.log.LoggerEngine; |
| | | |
| | | import com.java110.common.util.SequenceUtil; |
| | | import com.java110.common.util.StringUtil; |
| | | import com.java110.core.base.AppBase; |
| | | import com.java110.entity.service.PageData; |
| | | import com.java110.core.context.BusinessServiceDataFlow; |
| | | import com.java110.core.factory.DataFlowFactory; |
| | | import com.java110.core.context.PageData; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | } |
| | | |
| | | public static Map<String, String> getParameterStringMap(HttpServletRequest request) { |
| | | Map<String, String[]> properties = request.getParameterMap();//把请求参数封装到Map<String, String[]>中 |
| | | Map<String, String> returnMap = new HashMap<String, String>(); |
| | | String name = ""; |
| | | String value = ""; |
| | | for (Map.Entry<String, String[]> entry : properties.entrySet()) { |
| | | name = entry.getKey(); |
| | | String[] values = entry.getValue(); |
| | | if (null == values) { |
| | | value = ""; |
| | | } else if (values.length>1) { |
| | | for (int i = 0; i < values.length; i++) { //用于请求参数中有多个相同名称 |
| | | value = values[i] + ","; |
| | | } |
| | | value = value.substring(0, value.length() - 1); |
| | | } else { |
| | | value = values[0];//用于请求参数中请求参数名唯一 |
| | | } |
| | | returnMap.put(name, value); |
| | | |
| | | } |
| | | return returnMap; |
| | | } |
| | | |
| | | protected void initHeadParam(HttpServletRequest request,Map headers) { |
| | | |
| | | Enumeration reqHeaderEnum = request.getHeaderNames(); |
| | | |
| | | while( reqHeaderEnum.hasMoreElements() ) { |
| | | String headerName = (String)reqHeaderEnum.nextElement(); |
| | | headers.put(headerName, request.getHeader(headerName)); |
| | | headers.put(headerName.toLowerCase(), request.getHeader(headerName)); |
| | | } |
| | | |
| | | headers.put("IP",getIpAddr(request)); |
| | | |
| | | headers.put("hostName",request.getLocalName()); |
| | | headers.put("port",request.getLocalPort()+""); |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 封装数据 |
| | | * @param reqJson |
| | | * @param headers |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | protected BusinessServiceDataFlow writeDataToDataFlowContext(String reqJson, Map<String,String> headers) throws Exception { |
| | | BusinessServiceDataFlow businessServiceDataFlow = DataFlowFactory.newInstance(BusinessServiceDataFlow.class).builder(reqJson,headers); |
| | | return businessServiceDataFlow; |
| | | } |
| | | |
| | | |
| | | } |