Commit bfabe1bd by Tuomas Riihimäki

Fix PMS required api returning ArrayList, which for some reason is not supported

anymore. Most likely this was broken when swagger was updated
1 parent 0e601340
......@@ -144,6 +144,7 @@ public class HostnameFilter implements Filter {
MDC.remove("req.remoteHost");
MDC.remove("req.eventhost");
}
private static final String[] NOAUTH_RESTPATHS = new String[]{"/reader/EventRole/", "/user/auth"};
/**
......@@ -166,8 +167,8 @@ public class HostnameFilter implements Filter {
insertServerLoggingContext(httpRequest, authtype);
parseHostname(httpRequest);
if (httpRequest.getUserPrincipal() == null) {
Principal principal = httpRequest.getUserPrincipal();
if (principal == null) {
// Check if we are logging in with rest
if (RestApplicationEntrypoint.REST_PATH.equals(httpRequest.getServletPath())) {
authtype = AuthType.REST;
......@@ -191,7 +192,9 @@ public class HostnameFilter implements Filter {
logger.warn("Error logging in as anonymous... ignoring.. ", t);
}
}
} else if (!httpRequest.getUserPrincipal().getName().equals(User.ANONYMOUS_LOGINNAME)) {
} else if (principal.getName() == null) {
logger.warn("Principal has a null name", principal.toString());
} else if (!principal.getName().equals(User.ANONYMOUS_LOGINNAME)) {
authtype = AuthType.USER;
sessionmgmt.updateSessionUser(httpRequest.getSession().getId(), httpRequest.getUserPrincipal().getName());
}
......
package fi.codecrew.moya.rest;
import fi.codecrew.moya.rest.placemap.v1.PlaceCodePojo;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.List;
@XmlRootElement
public class SimpleCodelistRoot {
public SimpleCodelistRoot() {
}
public SimpleCodelistRoot(ArrayList<PlaceCodePojo> ret) {
this.codes = ret;
}
private List<PlaceCodePojo> codes = new ArrayList<>();
public List<PlaceCodePojo> getCodes() {
return codes;
}
public void setCodes(List<PlaceCodePojo> codes) {
this.codes = codes;
}
}
......@@ -13,10 +13,13 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import fi.codecrew.moya.rest.ArrayListWrapper;
import fi.codecrew.moya.rest.SimpleCodelistRoot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -250,8 +253,10 @@ public class PlacemapRestViewV1 {
.entity("No enough permissions!")
.build();
}
List<PlaceCodePojo> ret = makePlaceCodePojos(placebean.findAllForEvent());
return Response.ok(ret).build();
ArrayList<PlaceCodePojo> ret = makePlaceCodePojos(placebean.findAllForEvent());
GenericEntity<ArrayList<PlaceCodePojo>> list = new GenericEntity<ArrayList<PlaceCodePojo>>(ret) {
};
return Response.ok(list).build();
}
......@@ -275,7 +280,7 @@ public class PlacemapRestViewV1 {
ArrayList<PlaceCodePojo> ret = makePlaceCodePojos(map.getPlaces());
return Response.ok(ret).build();
return Response.ok(new ArrayListWrapper<>(ret)).build();
}
......
......@@ -12,6 +12,7 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
......@@ -62,7 +63,10 @@ public class VipRestView {
sq.setPagesize(0);
SearchResult<Vip> result = vipbean.search(sq);
ArrayList<VipRestPojo> ret = VipRestPojo.create(result.getResults());
return Response.ok(ret).build();
GenericEntity<ArrayList<VipRestPojo>> list = new GenericEntity<ArrayList<VipRestPojo>>(ret) {
};
return Response.ok(list).build();
}
@DELETE
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!