Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
*
* Copyright 2016 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
*
* 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 com.netflix.genie.web.resources.writers;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.Lists;
import com.netflix.genie.common.external.util.GenieObjectMapper;
import com.netflix.genie.common.util.JsonUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.catalina.util.ServerInfo;
import org.apache.catalina.util.TomcatCSS;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.URL;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.File;
import java.io.IOException;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Comparator;
import java.util.List;
/**
* A default directory writer implementation.
*
* @author tgianos
* @since 3.0.0
*/
public class DefaultDirectoryWriter implements DirectoryWriter {
/**
* Given the provided information render as an HTML string.
*
* @param directoryName The name of the directory
* @param directory The directory information to serialize
* @return A string of valid HTML
* @see org.apache.catalina.servlets.DefaultServlet
*/
public static String directoryToHTML(final String directoryName, final Directory directory) {
final StringBuilder builder = new StringBuilder();
// Render the page header
builder.append("");
builder.append("");
builder.append("");
builder.append("");
builder.append(directoryName);
builder.append("");
builder.append(" ");
builder.append("");
// Body
builder.append("");
builder.append("
").append(directoryName).append("
");
builder.append("");
builder.append("
");
// Render the column headings
builder.append("