You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.2 KiB
68 lines
2.2 KiB
package com.fr.plugin.xx.theme.sky.web; |
|
|
|
import com.fr.cert.token.lang.Collections; |
|
import com.fr.decision.fun.impl.BaseHttpHandler; |
|
import com.fr.decision.webservice.Response; |
|
import com.fr.decision.webservice.bean.config.StyleConfigBean; |
|
import com.fr.decision.webservice.bean.entry.EntryBean; |
|
import com.fr.decision.webservice.v10.config.ConfigService; |
|
import com.fr.decision.webservice.v10.entry.EntryService; |
|
import com.fr.decision.webservice.v10.login.LoginService; |
|
import com.fr.decision.webservice.v10.user.UserService; |
|
import com.fr.log.FineLoggerFactory; |
|
import com.fr.plugin.xx.theme.sky.config.SkyThemeConfig; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.third.fasterxml.jackson.databind.ObjectMapper; |
|
import com.fr.third.springframework.beans.BeanUtils; |
|
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
|
import com.fr.web.utils.WebUtils; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
import javax.servlet.http.HttpServletResponse; |
|
import java.util.*; |
|
import java.util.stream.Collectors; |
|
|
|
/** |
|
* @author k |
|
* @Project name finereport10 |
|
* @description: |
|
* @created on 2019/10/27 16:45. |
|
* @email xx.xx@qq.com |
|
* @Modified By |
|
*/ |
|
public class ConfigHttpHandler extends BaseHttpHandler { |
|
public ConfigHttpHandler() { |
|
} |
|
|
|
private static final ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
@Override |
|
public RequestMethod getMethod() { |
|
return RequestMethod.GET; |
|
} |
|
|
|
@Override |
|
public String getPath() { |
|
return "/sky/getConfig"; |
|
} |
|
|
|
@Override |
|
public boolean isPublic() { |
|
return true; |
|
} |
|
|
|
@Override |
|
public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { |
|
|
|
String type = WebUtils.getHTTPRequestParameter(request, "type"); |
|
if (StringUtils.isNotEmpty(type) && "style".equals(type)) { |
|
StyleConfigBean bean = ConfigService.getInstance().getStyleConfig(); |
|
String valueAsString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(Response.ok(bean)); |
|
WebUtils.printAsString(response, valueAsString); |
|
return; |
|
} |
|
SkyThemeConfig config = SkyThemeConfig.getInstance(); |
|
WebUtils.printAsString(response, objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(Response.ok(config))); |
|
} |
|
|
|
} |