mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
fix problem with xml representation of collections
This commit is contained in:
@@ -60,6 +60,7 @@ import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.CacheControl;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.EntityTag;
|
||||
import javax.ws.rs.core.GenericEntity;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Request;
|
||||
import javax.ws.rs.core.Response;
|
||||
@@ -93,6 +94,19 @@ public abstract class AbstractManagerResource<T extends ModelObject,
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param items
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract GenericEntity<Collection<T>> createGenericEntity(
|
||||
Collection<T> items);
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -271,14 +285,15 @@ public abstract class AbstractManagerResource<T extends ModelObject,
|
||||
}
|
||||
|
||||
Response response = null;
|
||||
Object entity = createGenericEntity(items);
|
||||
|
||||
if (disableCache)
|
||||
{
|
||||
response = Response.ok(items).build();
|
||||
response = Response.ok(entity).build();
|
||||
}
|
||||
else
|
||||
{
|
||||
response = createCacheResponse(request, manager, items);
|
||||
response = createCacheResponse(request, manager, entity);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -44,7 +44,10 @@ import sonia.scm.group.GroupManager;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.GenericEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -73,6 +76,24 @@ public class GroupResource
|
||||
super(groupManager);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param items
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected GenericEntity<Collection<Group>> createGenericEntity(
|
||||
Collection<Group> items)
|
||||
{
|
||||
return new GenericEntity<Collection<Group>>(items) {}
|
||||
;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,6 +58,7 @@ import java.util.Collection;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.GenericEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -99,6 +100,22 @@ public class RepositoryResource
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param items
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected GenericEntity<Collection<Repository>> createGenericEntity(
|
||||
Collection<Repository> items)
|
||||
{
|
||||
return new GenericEntity<Collection<Repository>>(items) {}
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -50,6 +50,7 @@ import sonia.scm.util.Util;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.GenericEntity;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -85,6 +86,22 @@ public class UserResource extends AbstractManagerResource<User, UserException>
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param items
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected GenericEntity<Collection<User>> createGenericEntity(
|
||||
Collection<User> items)
|
||||
{
|
||||
return new GenericEntity<Collection<User>>(items) {}
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user