added download button
This commit is contained in:
@@ -8,6 +8,7 @@ import javax.inject.Inject;
|
||||
import javax.ws.rs.container.ContainerRequestContext;
|
||||
import javax.ws.rs.container.ContainerResponseContext;
|
||||
import javax.ws.rs.container.ContainerResponseFilter;
|
||||
import javax.ws.rs.core.MultivaluedMap;
|
||||
import javax.ws.rs.ext.Provider;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
@@ -28,7 +29,9 @@ public class CORSFilter implements ContainerResponseFilter
|
||||
{
|
||||
if (!ctx.cors_enabled)
|
||||
{
|
||||
containerResponseContext.getHeaders().add("Access-Control-Allow-Origin", "*");
|
||||
MultivaluedMap<String, Object> headers = containerResponseContext.getHeaders();
|
||||
headers.add("Access-Control-Allow-Origin", "*");
|
||||
headers.add("Access-Control-Allow-Headers", "Accept, Accept-Language, Content-Language, Content-Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -293,7 +293,6 @@ public class PacmanWebService
|
||||
}
|
||||
|
||||
@GET
|
||||
@CORSManaged
|
||||
@Path("/search")
|
||||
public List<PkgData> searchPackage(
|
||||
@QueryParam("name") String name,
|
||||
@@ -354,6 +353,13 @@ public class PacmanWebService
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
@OPTIONS
|
||||
@Path("/downloadTar")
|
||||
@Produces("text/plain; charset=UTF-8")
|
||||
public Response options() {
|
||||
return Response.ok("POST, OPTIONS").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/downloadTar")
|
||||
@Produces("application/x-tar")
|
||||
@@ -389,7 +395,6 @@ public class PacmanWebService
|
||||
taos.closeArchiveEntry();
|
||||
}
|
||||
taos.close();
|
||||
output.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -398,7 +403,6 @@ public class PacmanWebService
|
||||
finally
|
||||
{
|
||||
taos.close();
|
||||
output.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user