<commit_before>/**********************************************************************************
 * $URL$
 * $Id$
 ***********************************************************************************
 *
 * Copyright (c) 2006 The Sakai Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at
 * 
 *      http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 *
 **********************************************************************************/

package org.sakaiproject.content.impl;

import java.io.PrintWriter;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.content.api.ContentCollection;
import org.sakaiproject.content.api.ContentResource;
import org.sakaiproject.entity.api.Entity;
import org.sakaiproject.entity.api.Reference;
import org.sakaiproject.entity.api.ResourceProperties;
import org.sakaiproject.time.api.Time;
import org.sakaiproject.user.api.User;
import org.sakaiproject.user.api.UserNotDefinedException;
import org.sakaiproject.user.cover.UserDirectoryService;
import org.sakaiproject.util.Validator;

/**
 * <p>
 * CollectionAccessFormatter is formatter for collection access.
 * </p>
 */
public class CollectionAccessFormatter
{
	/**
	 * Format the collection as an HTML display.
	 */
	public static void format(ContentCollection x, Reference ref, HttpServletRequest req, HttpServletResponse res,
			String accessPointTrue, String accessPointFalse)
	{
		PrintWriter out = null;
		// don't set the writer until we verify that
		// getallresources is going to work.
		boolean printedHeader = false;
		boolean printedDiv = false;

		String path = ref.getId();
		String basedir = req.getParameter("sbasedir");
		// path may have been transformed by an alias
		// we need origpath to check whether there was as trailing /
		String origpath = req.getPathInfo();
		String querystring = req.getQueryString();
		// set access to /access/content, must skip http://host<commit_msg>SAK-7288 Apply patch to trunk.  See JIRA ticket for details.<commit_after>/**********************************************************************************
 * $URL$
 * $Id$
 ***********************************************************************************
 *
 * Copyright (c) 2006 The Sakai Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at
 * 
 *      http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 *
 **********************************************************************************/

package org.sakaiproject.content.impl;

import java.io.PrintWriter;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.content.api.ContentCollection;
import org.sakaiproject.content.api.ContentResource;
import org.sakaiproject.content.cover.ContentHostingService;
import org.sakaiproject.entity.api.Entity;
import org.sakaiproject.entity.api.Reference;
import org.sakaiproject.entity.api.ResourceProperties;
import org.sakaiproject.time.api.Time;
import org.sakaiproject.user.api.User;
import org.sakaiproject.user.api.UserNotDefinedException;
import org.sakaiproject.user.cover.UserDirectoryService;
import org.sakaiproject.util.Validator;

/**
 * <p>
 * CollectionAccessFormatter is formatter for collection access.
 * </p>
 */
public class CollectionAccessFormatter
{
	/**
	 * Format the collection as an HTML display.
	 */
	public static void format(ContentCollection x, Reference ref, HttpServletRequest req, HttpServletResponse res,
			String accessPointTrue, String accessPointFalse)
	{
		// do not allow directory listings for /attachments and its subfolders  
		if(ContentHostingService.isAttachmentResource(x.getId()))
		{
			try
			{
				res.sendError(HttpServletResponse.SC_NOT_FOUND);
				return;
			} 
			catch ( java.io.IOException e ) 
			{
				return;
			}
		}
		
		PrintWriter out = null;
		// don't set the writer until we verify that
		// getallresources is going to work.
		boolean printedHeader = false;
		boolean printedDiv = false;

		String path = ref.getId();
		String basedir = req.getParameter("sbasedir");
		// path may have been transformed by an alias
		// we need origpath to check whether there was as trailing /
		String origpath = req.getPathInfo();
		String querystring = req.getQueryString();
		// set access to /access/content, must skip http://host
{'fraction_non_alphanumeric': 0.16944893196912583, 'fraction_numerical': 0.0032310177705977385, 'mean_word_length': 4.738414006179196, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5111862', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1442, 'n_words': 460}