<commit_before>package org.pac4j.play.http;

import org.pac4j.core.context.HttpConstants;
import org.pac4j.core.exception.TechnicalException;
import org.pac4j.core.http.adapter.HttpActionAdapter;
import org.pac4j.play.PlayWebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import play.mvc.Result;

import static play.mvc.Results.*;

/**
 * Default implementation.
 *
 * @author <NAME>
 * @since 2.0.0
 */
public class DefaultHttpActionAdapter implements HttpActionAdapter<Result, PlayWebContext> {

    protected final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public Result adapt(final int code, final PlayWebContext context) {
        logger.debug("requires HTTP action: {}", code);
        if (code == HttpConstants.UNAUTHORIZED) {
            return unauthorized("authentication required");
        } else if (code == HttpConstants.FORBIDDEN) {
            return forbidden("forbidden");
        } else if (code == HttpConstants.TEMP_REDIRECT) {
            return redirect(context.getLocation());
        } else if (code == HttpConstants.BAD_REQUEST) {
            return badRequest("bad request");
        } else if (code == HttpConstants.OK) {
            final String content = context.getResponseContent();
            logger.debug("render: {}", content);
            return ok(content).as(HttpConstants.HTML_CONTENT_TYPE);
        }
        final String message = "Unsupported HTTP action: " + code;
        logger.error(message);
        throw new TechnicalException(message);
    }
}<commit_msg>handle 204 no content<commit_after>package org.pac4j.play.http;

import org.pac4j.core.context.HttpConstants;
import org.pac4j.core.exception.TechnicalException;
import org.pac4j.core.http.adapter.HttpActionAdapter;
import org.pac4j.play.PlayWebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import play.mvc.Result;

import static play.mvc.Results.*;

/**
 * Default implementation.
 *
 * @author <NAME>
 * @since 2.0.0
 */
public class DefaultHttpActionAdapter implements HttpActionAdapter<Result, PlayWebContext> {

    protected final Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public Result adapt(final int code, final PlayWebContext context) {
        logger.debug("requires HTTP action: {}", code);
        if (code == HttpConstants.UNAUTHORIZED) {
            return unauthorized("authentication required");
        } else if (code == HttpConstants.FORBIDDEN) {
            return forbidden("forbidden");
        } else if (code == HttpConstants.TEMP_REDIRECT) {
            return redirect(context.getLocation());
        } else if (code == HttpConstants.BAD_REQUEST) {
            return badRequest("bad request");
        } else if (code == HttpConstants.OK) {
            final String content = context.getResponseContent();
            logger.debug("render: {}", content);
            return ok(content).as(HttpConstants.HTML_CONTENT_TYPE);
        } else if (code == HttpConstants.NO_CONTENT) {
            return noContent();
        }
        final String message = "Unsupported HTTP action: " + code;
        logger.error(message);
        throw new TechnicalException(message);
    }
}
{'fraction_non_alphanumeric': 0.11294851794071763, 'fraction_numerical': 0.007176287051482059, 'mean_word_length': 3.2073490813648293, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6890518', 'n_tokens_mistral': 898, 'n_tokens_neox': 883, 'n_words': 203}