<commit_before>package net.caseydunham.pirate.stripes.action;

import net.caseydunham.pirate.model.Paste;
import net.sourceforge.stripes.action.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

@UrlBinding(BaseActionBean.HOME_ACTION)
public class HomeActionBean extends BaseActionBean {

	private static final Logger LOG = LoggerFactory.getLogger(HomeActionBean.class);

	private String title;
	private String username;
	private String content;

	@DontValidate
	@DefaultHandler
	public Resolution view() {
		LOG.info("forwarding to " + HOME_PAGE);
		return new ForwardResolution(HOME_PAGE);
	}

	@HandlesEvent("submit")
	public Resolution submit() {
		Paste p = new Paste();
		p.setTitle(getTitle());
		p.setUsername(getUsername());
		p.setContent(getContent());

		getPasteService().create(p);
		return new RedirectResolution(HOME_ACTION);
	}

	public List<Paste> getRecentPastes() {
		return getPasteService().getRecentPastes();
	}

	public String getTitle() { return title; }
	public void setTitle(String title) { this.title = title; }

	public String getUsername() { return username; }
	public void setUsername(String username) { this.username = username; }

	public String getContent() { return content; }
	public void setContent(String content) { this.content = content; }

}<commit_msg>using binding lifecycle to set recent pastes on home page<commit_after>package net.caseydunham.pirate.stripes.action;

import net.caseydunham.pirate.model.Paste;
import net.sourceforge.stripes.action.*;
import net.sourceforge.stripes.controller.LifecycleStage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

@UrlBinding(BaseActionBean.HOME_ACTION)
public class HomeActionBean extends BaseActionBean {

	private static final Logger LOG = LoggerFactory.getLogger(HomeActionBean.class);

	private String title;
	private String username;
	private String content;

	private List<Paste> recentPastes;

	@After(stages = {LifecycleStage.BindingAndValidation})
	public void bind() {
		setRecentPastes(getPasteService().getRecentPastes());
	}

	@DontValidate
	@DefaultHandler
	public Resolution view() {
		LOG.info("forwarding to " + HOME_PAGE);
		return new ForwardResolution(HOME_PAGE);
	}

	@HandlesEvent("submit")
	public Resolution submit() {
		Paste p = new Paste();
		p.setTitle(getTitle());
		p.setUsername(getUsername());
		p.setContent(getContent());

		getPasteService().create(p);
		return new RedirectResolution(HOME_ACTION);
	}

	public List<Paste> getRecentPastes() { return recentPastes; }
	public void setRecentPastes(List<Paste> recentPastes) { this.recentPastes = recentPastes; }

	public String getTitle() { return title; }
	public void setTitle(String title) { this.title = title; }

	public String getUsername() { return username; }
	public void setUsername(String username) { this.username = username; }

	public String getContent() { return content; }
	public void setContent(String content) { this.content = content; }

}
{'fraction_non_alphanumeric': 0.10836945648549516, 'fraction_numerical': 0.001333777925975325, 'mean_word_length': 5.651884700665189, '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': '1892050', 'n_tokens_mistral': 981, 'n_tokens_neox': 910, 'n_words': 220}