<commit_before>package com.github.dynamicextensionsalfresco.web

import com.github.dynamicextensionsalfresco.webscripts.DummyStore
import com.github.dynamicextensionsalfresco.webscripts.support.AbstractBundleResourceHandler
import org.osgi.framework.BundleContext
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.extensions.webscripts.*
import java.util.*
import javax.servlet.http.HttpServletResponse

/**
 * Webscript to serve static web resources found in an extension
 * When requests are prefixed with symbolic-name/web, no cache headers are set,
 * with the /web-cached/$version prefix, cache is set to expire now + 1 year
 *
 * @author <NAME>
 */
public class ResourceWebscript(private val bundleContext: BundleContext) : WebScript, AbstractBundleResourceHandler() {
    private val module = bundleContext.getBundle().getSymbolicName().toLowerCase()

    init {
        initContentTypes()
    }

    private val descriptionImpl = run {
        val uris = arrayOf("/$module/web/{path}", "/$module/web-cached/{version}/{path}")
        val id = "${module}-web"
        val descriptionImpl = DescriptionImpl(
                id,
                "staticWebResource$module",
                "static web resources for extension $module",
                uris.first()
        )
        descriptionImpl.setMethod("GET")
        descriptionImpl.setDefaultFormat("html")
        descriptionImpl.setFormatStyle(Description.FormatStyle.argument)
        descriptionImpl.setUris(uris)
        descriptionImpl.setFamilys(setOf("static-web"))
        descriptionImpl.setStore(DummyStore())
        descriptionImpl.setRequiredAuthentication(Description.RequiredAuthentication.none)
        descriptionImpl.setRequiredTransactionParameters(with(TransactionParameters()) {
            setRequired(Description.RequiredTransaction.none)
            this
        })

        descriptionImpl
    }

    override fun getBundleContext(): BundleContext? {
        return bundleContext<commit_msg>escape resource url<commit_after>package com.github.dynamicextensionsalfresco.web

import com.github.dynamicextensionsalfresco.webscripts.DummyStore
import com.github.dynamicextensionsalfresco.webscripts.support.AbstractBundleResourceHandler
import org.osgi.framework.BundleContext
import org.springframework.extensions.webscripts.*
import java.util.ResourceBundle
import javax.servlet.http.HttpServletResponse

/**
 * Webscript to serve static web resources found in an extension
 * When requests are prefixed with symbolic-name/web, no cache headers are set,
 * with the /web-cached/$version prefix, cache is set to expire now + 1 year
 *
 * @author <NAME>
 */
public class ResourceWebscript(private val bundleContext: BundleContext) : WebScript, AbstractBundleResourceHandler() {
    private val module = bundleContext.getBundle().getSymbolicName().replace(".", "-").toLowerCase()

    init {
        initContentTypes()
    }

    private val descriptionImpl = run {
        val uris = arrayOf("/$module/web/{path}", "/$module/web-cached/{version}/{path}")
        val id = "${module}-web"
        val descriptionImpl = DescriptionImpl(
                id,
                "staticWebResource$module",
                "static web resources for extension $module",
                uris.first()
        )
        descriptionImpl.setMethod("GET")
        descriptionImpl.setFormatStyle(Description.FormatStyle.argument)
        descriptionImpl.setUris(uris)
        descriptionImpl.setFamilys(setOf("static-web"))
        descriptionImpl.setStore(DummyStore())
        descriptionImpl.setRequiredAuthentication(Description.RequiredAuthentication.none)
        descriptionImpl.setRequiredTransactionParameters(with(TransactionParameters()) {
            setRequired(Description.RequiredTransaction.none)
            this
        })

        descriptionImpl
    }

    override fun getBundleContext(): BundleContext? {
        return bundleContext
{'fraction_non_alphanumeric': 0.09152970922882428, 'fraction_numerical': 0.001011378002528445, 'mean_word_length': 3.510832383124287, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '381857', 'n_tokens_mistral': 996, 'n_tokens_neox': 979, 'n_words': 211}