Removed setting content length to header length in ContentResource

Header is always 1024 Bytes long
This commit is contained in:
Philipp Czora
2018-08-15 16:51:50 +02:00
parent 6e858ea305
commit 70039ad540
4 changed files with 5 additions and 25 deletions

View File

@@ -33,8 +33,6 @@
package sonia.scm.repository.api; package sonia.scm.repository.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -50,8 +48,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
//~--- JDK imports ------------------------------------------------------------
/** /**
* Shows the content of a file in the {@link Repository}.<br /> * Shows the content of a file in the {@link Repository}.<br />
* <br /> * <br />

View File

@@ -33,23 +33,18 @@
package sonia.scm.repository.spi; package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.RepositoryException; import sonia.scm.repository.RepositoryException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
//~--- JDK imports ------------------------------------------------------------
/** /**
* *
* @author Sebastian Sdorra * @author Sebastian Sdorra
* @since 1.17 * @since 1.17
*/ */
public interface CatCommand public interface CatCommand {
{
void getCatResult(CatCommandRequest request, OutputStream output) throws IOException, RepositoryException; void getCatResult(CatCommandRequest request, OutputStream output) throws IOException, RepositoryException;

View File

@@ -35,26 +35,20 @@ package sonia.scm.api.rest.resources;
//~--- non-JDK imports -------------------------------------------------------- //~--- non-JDK imports --------------------------------------------------------
import com.google.common.io.Closeables;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import sonia.scm.repository.PathNotFoundException; import sonia.scm.repository.PathNotFoundException;
import sonia.scm.repository.RepositoryException; import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.RevisionNotFoundException; import sonia.scm.repository.RevisionNotFoundException;
import sonia.scm.repository.api.CatCommandBuilder; import sonia.scm.repository.api.CatCommandBuilder;
import sonia.scm.repository.api.RepositoryService; import sonia.scm.repository.api.RepositoryService;
import sonia.scm.util.IOUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.io.OutputStream;
import javax.ws.rs.WebApplicationException; import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput; import javax.ws.rs.core.StreamingOutput;
import sonia.scm.util.IOUtil; import java.io.IOException;
import java.io.OutputStream;
/** /**
* *

View File

@@ -15,11 +15,7 @@ import sonia.scm.repository.api.RepositoryServiceFactory;
import sonia.scm.util.IOUtil; import sonia.scm.util.IOUtil;
import javax.inject.Inject; import javax.inject.Inject;
import javax.ws.rs.GET; import javax.ws.rs.*;
import javax.ws.rs.HEAD;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.StreamingOutput; import javax.ws.rs.core.StreamingOutput;
@@ -134,7 +130,6 @@ public class ContentResource {
ContentType contentType = ContentTypes.detect(path, head); ContentType contentType = ContentTypes.detect(path, head);
responseBuilder.header("Content-Type", contentType.getRaw()); responseBuilder.header("Content-Type", contentType.getRaw());
contentType.getLanguage().ifPresent(language -> responseBuilder.header("Language", language)); contentType.getLanguage().ifPresent(language -> responseBuilder.header("Language", language));
responseBuilder.header("Content-Length", head.length);
} }
private byte[] getHead(String revision, String path, RepositoryService repositoryService) throws IOException, RepositoryException { private byte[] getHead(String revision, String path, RepositoryService repositoryService) throws IOException, RepositoryException {