Commit 46c2833f by 墨竹

feat:拦截器修改

parent a96f6e31
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-pom-base</artifactId> <artifactId>gic-pom-base</artifactId>
<version>3.0-SNAPSHOT</version> <version>3.0-SNAPSHOT</version>
<relativePath/> <relativePath/>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>haoban-manage3-wx</artifactId> <artifactId>haoban-manage3-wx</artifactId>
<version>${libraryVersion}</version> <version>${libraryVersion}</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>haoban-manage3-wx Maven Webapp</name> <name>haoban-manage3-wx Maven Webapp</name>
<!-- FIXME change it to the project's website --> <!-- FIXME change it to the project's website -->
<url>http://www.example.com</url> <url>http://www.example.com</url>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<commonVersion>3.0-SNAPSHOT</commonVersion> <commonVersion>3.0-SNAPSHOT</commonVersion>
<libraryVersion>3.0-SNAPSHOT</libraryVersion> <libraryVersion>3.0-SNAPSHOT</libraryVersion>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId> <artifactId>spring-framework-bom</artifactId>
<version>4.2.4.RELEASE</version> <version>4.2.4.RELEASE</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.47</version> <version>1.2.47</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.11</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-wechat-api</artifactId> <artifactId>gic-wechat-api</artifactId>
<version>${gic-wechat-api}</version> <version>${gic-wechat-api}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.session</groupId> <groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId> <artifactId>spring-session-data-redis</artifactId>
<version>1.2.1.RELEASE</version> <version>1.2.1.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>2.8.1</version> <version>2.8.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-dict-api</artifactId> <artifactId>gic-dict-api</artifactId>
<version>${gic-dict-api}</version> <version>${gic-dict-api}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-commons</artifactId> <artifactId>gic-commons</artifactId>
<version>${gic-commons}</version> <version>${gic-commons}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<artifactId>httpcore</artifactId> <artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<artifactId>spring-beans</artifactId> <artifactId>spring-beans</artifactId>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
</exclusion> </exclusion>
<exclusion>
<exclusion> <artifactId>slf4j-api</artifactId>
<artifactId>slf4j-api</artifactId> <groupId>org.slf4j</groupId>
<groupId>org.slf4j</groupId> </exclusion>
</exclusion> </exclusions>
</exclusions> </dependency>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-platform-config</artifactId>
<version>${gic-platform-config}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-data-api</artifactId>
<version>${haoban-data-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-api</artifactId>
<version>${haoban-contacts-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-manage3-api</artifactId>
<version>${haoban-manage3-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-manage-api</artifactId>
<version>${haoban-contacts-manage-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-common</artifactId>
<version>${haoban-common}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-auth-api</artifactId>
<version>${haoban-auth-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-operation-api</artifactId>
<version>${haoban-operation-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-config</artifactId>
<version>${haoban-config}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-api</artifactId>
<version>${gic-thirdparty-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-member-api</artifactId>
<version>${gic-member-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-message-api</artifactId>
<version>${haoban-message-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-announcement-api</artifactId>
<version>${haoban-app-announcement-api}</version>
</dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-platform-config</artifactId> <artifactId>haoban-communicate-api</artifactId>
<version>${gic-platform-config}</version> <version>${haoban-communicate-api}</version>
</dependency> </dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-data-api</artifactId>
<version>${haoban-data-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-contacts-api</artifactId>
<version>${haoban-contacts-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-manage3-api</artifactId>
<version>${haoban-manage3-api}</version>
</dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>haoban-contacts-manage-api</artifactId> <artifactId>haoban-mobile-app-api</artifactId>
<version>${haoban-contacts-manage-api}</version> <version>${haoban-mobile-app-api}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-common</artifactId>
<version>${haoban-common}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-auth-api</artifactId>
<version>${haoban-auth-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-operation-api</artifactId>
<version>${haoban-operation-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-config</artifactId>
<version>${haoban-config}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-thirdparty-api</artifactId>
<version>${gic-thirdparty-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-member-api</artifactId>
<version>${gic-member-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-message-api</artifactId>
<version>${haoban-message-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-app-announcement-api</artifactId>
<version>${haoban-app-announcement-api}</version>
</dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>haoban-communicate-api</artifactId> <artifactId>gic-thirdparty-sdk</artifactId>
<version>${haoban-communicate-api}</version> <version>${gic-thirdparty-sdk}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>haoban-mobile-app-api</artifactId>
<version>${haoban-mobile-app-api}</version>
</dependency>
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic.operation</groupId>
<artifactId>gic-thirdparty-sdk</artifactId> <artifactId>gic-operation-api</artifactId>
<version>${gic-thirdparty-sdk}</version> <version>${gic-operation-api}</version>
</dependency> </dependency>
<dependency>
<dependency>
<groupId>com.gic.operation</groupId>
<artifactId>gic-operation-api</artifactId>
<version>${gic-operation-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-enterprise-api</artifactId> <artifactId>gic-enterprise-api</artifactId>
<version>${gic-enterprise-api}</version> <version>${gic-enterprise-api}</version>
...@@ -219,65 +218,65 @@ ...@@ -219,65 +218,65 @@
<artifactId>gic-clerk-api</artifactId> <artifactId>gic-clerk-api</artifactId>
<version>${gic-clerk-api}</version> <version>${gic-clerk-api}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-quartz-api</artifactId>
<version>${gic-quartz-api}</version>
</dependency>
<dependency> <dependency>
<groupId>com.gic</groupId>
<artifactId>gic-quartz-api</artifactId>
<version>${gic-quartz-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>haoban-app-customer-api</artifactId> <artifactId>haoban-app-customer-api</artifactId>
<version>${haoban-app-customer-api}</version> <version>${haoban-app-customer-api}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>haoban-manage3-wx</finalName> <finalName>haoban-manage3-wx</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
<compilerArgs> <compilerArgs>
<arg>-parameters</arg> <arg>-parameters</arg>
</compilerArgs> </compilerArgs>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>copy-dependencies</id> <id>copy-dependencies</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>copy-dependencies</goal> <goal>copy-dependencies</goal>
</goals> </goals>
<configuration> <configuration>
<type>jar</type> <type>jar</type>
<includeTypes>jar</includeTypes> <includeTypes>jar</includeTypes>
<outputDirectory> <outputDirectory>
${project.build.directory}/lib ${project.build.directory}/lib
</outputDirectory> </outputDirectory>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.tomcat.maven</groupId> <groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId> <artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version> <version>2.2</version>
<configuration> <configuration>
<path>/haoban-manage3-wx</path> <path>/haoban-manage3-wx</path>
<port>9909</port> <port>9909</port>
<uriEncoding>UTF-8</uriEncoding> <uriEncoding>UTF-8</uriEncoding>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
...@@ -49,6 +49,7 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -49,6 +49,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -174,7 +175,7 @@ public class WxEnterpriseInfoController extends WebBaseController { ...@@ -174,7 +175,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
*/ */
@RequestMapping(value = "welldone-login", method = RequestMethod.POST) @RequestMapping(value = "welldone-login", method = RequestMethod.POST)
@IgnoreLogin @IgnoreLogin
public HaobanResponse welldoneLogin(@RequestBody StaffLoginQO staffLoginQO, HttpServletRequest request) { public HaobanResponse welldoneLogin(@RequestBody @Valid StaffLoginQO staffLoginQO, HttpServletRequest request) {
StaffDTO staffDTO = staffApiService.selectById(staffLoginQO.getStaffId()); StaffDTO staffDTO = staffApiService.selectById(staffLoginQO.getStaffId());
if (staffDTO == null) { if (staffDTO == null) {
return resultResponse(HaoBanErrCode.ERR_6); return resultResponse(HaoBanErrCode.ERR_6);
......
package com.gic.haoban.manage.web.exception; package com.gic.haoban.manage.web.exception;
import com.gic.haoban.base.api.common.ShowFrontMessageException;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.web.controller.WebBaseController; import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -13,8 +16,6 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -13,8 +16,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Created 2018/7/24. * Created 2018/7/24.
...@@ -23,44 +24,74 @@ import java.util.regex.Pattern; ...@@ -23,44 +24,74 @@ import java.util.regex.Pattern;
*/ */
@ControllerAdvice @ControllerAdvice
public class GlobalExceptionHandler extends WebBaseController { public class GlobalExceptionHandler extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class); private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
private static final Pattern pattern = Pattern.compile("(.*: )(.*)(\\n.*)"); /**
* RuntimeException 类型异常告警
*
// @ResponseBody * @param response
// @ExceptionHandler(ShowFrontMessageException.class) * @param ex
// public HaobanResponse ControllerException(HttpServletResponse response, ShowFrontMessageException ex) { * @return
// HaobanResponse res = new HaobanResponse(); */
// res.setErrorCode(HaoBanErrCode.ERR_0.getCode()); @ResponseBody
// res.setMessage(ex.getMessage()); @ExceptionHandler(RuntimeException.class)
// return res; public HaobanResponse controllerException(HttpServletResponse response, RuntimeException ex) {
// } logger.error("Exception:{}", ex.getMessage(), ex);
HaoBanErrCode errCode = HaoBanErrCode.ERR_3;
StringBuilder sb = new StringBuilder();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (PrintWriter printWriter = new PrintWriter(baos)) {
ex.printStackTrace(printWriter);
}
try {
sb.append(baos.toString());
} catch (Exception ignored) {
}
if (sb.length() == 0) {
sb.append(ex.getMessage());
}
// 输出详细错误信息,便于调试
return resultResponse(errCode, null, sb.toString());
}
/**
* valid 异常告警
*
* @param response
* @param ex
* @return
*/
@ResponseBody
@ExceptionHandler(BindException.class)
public HaobanResponse bindException(HttpServletResponse response, BindException ex) {
logger.error("Exception:{}", ex.getMessage(), ex);
HaoBanErrCode errCode = HaoBanErrCode.ERR_5;
BindingResult bindingResult = ex.getBindingResult();
FieldError fieldError = bindingResult.getFieldError();
return resultResponse(errCode, null, fieldError.getField() + fieldError.getDefaultMessage());
}
// @ResponseBody /**
// @ExceptionHandler(RuntimeException.class) * valid 异常告警 @ReuqestBody
// public HaobanResponse ControllerException(HttpServletResponse response, RuntimeException ex) { *
// HaobanResponse res = new HaobanResponse(); * @param response
// res.setErrorCode(HaoBanErrCode.ERR_3.getCode()); * @param ex
// String message = ex.getMessage(); * @return
// if (message != null && message.indexOf(ShowFrontMessageException.class.getName()) > -1) { */
// Matcher matcher = pattern.matcher(message); @ResponseBody
// while (matcher.find()) { @ExceptionHandler(MethodArgumentNotValidException.class)
// message = (matcher.group(2)); public HaobanResponse methodArgumentNotValidException(HttpServletResponse response, MethodArgumentNotValidException ex) {
// } logger.error("Exception:{}", ex.getMessage(), ex);
// } else { HaoBanErrCode errCode = HaoBanErrCode.ERR_5;
// message = HaoBanErrCode.ERR_3.getMsg(); BindingResult bindingResult = ex.getBindingResult();
// } FieldError fieldError = bindingResult.getFieldError();
// res.setMessage(message); return resultResponse(errCode, null, fieldError.getField() + fieldError.getDefaultMessage());
// return res; }
// }
@ResponseBody @ResponseBody
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
public HaobanResponse ControllerException(HttpServletResponse response, Exception ex) { public HaobanResponse globalException(HttpServletResponse response, Exception ex) {
logger.error("err:", ex.getMessage()); logger.error("Exception:{}", ex.getMessage(), ex);
ex.printStackTrace();
HaoBanErrCode errCode = HaoBanErrCode.ERR_3; HaoBanErrCode errCode = HaoBanErrCode.ERR_3;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
...@@ -74,17 +105,9 @@ public class GlobalExceptionHandler extends WebBaseController { ...@@ -74,17 +105,9 @@ public class GlobalExceptionHandler extends WebBaseController {
if (sb.length() == 0) { if (sb.length() == 0) {
sb.append(ex.getMessage()); sb.append(ex.getMessage());
} }
// 输出详细错误信息,便于调试 // 输出详细错误信息,便于调试
// return resultResponse(errCode, null, sb.toString()); return resultResponse(errCode, null, sb.toString());
return resultResponse(HaoBanErrCode.ERR_3);
} }
@ResponseBody
@ExceptionHandler(NoLoginException.class)
public HaobanResponse ControllerException(HttpServletResponse response, NoLoginException ex) {
return resultResponse(HaoBanErrCode.ERR_4);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment