<commit_before><commit_msg>Submit missing Aspect source code<commit_after>package cfvbaibai.cardfantasy.web.aspects;

import javax.servlet.http.HttpServletResponse;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;

import cfvbaibai.cardfantasy.web.beans.Logger;

@Aspect
public class EncodingAspect {

    @Autowired
    private Logger logger;
    
    @Pointcut("execution(public * cfvbaibai.cardfantasy.web.controller.AutoBattleController.*(" +
            "*, javax.servlet.http.HttpServletResponse, ..))")
    public void outputWebResponse() {}
    
    @Around("cfvbaibai.cardfantasy.web.aspects.EncodingAspect.outputWebResponse()")
    public void setEncoding(ProceedingJoinPoint pjp) throws Throwable {
        logger.info("setEncoding advice activated on: " + pjp.getSignature().toShortString());
        Object[] args = pjp.getArgs();
        HttpServletResponse response = (HttpServletResponse)args[1];
        response.setCharacterEncoding("UTF-8");
        
        pjp.proceed();
    }
}

{'fraction_non_alphanumeric': 0.10947712418300654, 'fraction_numerical': 0.0016339869281045752, 'mean_word_length': 3.78515625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4941919', 'n_tokens_mistral': 378, 'n_tokens_neox': 365, 'n_words': 54}