jersey

How can I coax Spring Data to show me mongo's query plan (a.k.a cursor.explain())

ぃ、小莉子 提交于 2021-02-18 15:34:33
问题 I am writing an API with Spring/Mongo/Jersey to do CRUD on a POJO that has a generic map of properties like this: public class Thing { private String id; @Indexed private Map<String,String> properties; ... This is working great to return items. My resource code looks like this: BasicDBObject query = new BasicDBObject("properties.name", "vlad the impaler"); return Response.ok(myService.queryThings(query)).build(); And my abstract DAO looks like this: public List<T> find(Query query) { return

What is the equivalent of @Context UriInfo in Spring Rest

五迷三道 提交于 2021-02-18 10:40:07
问题 I have worked in Jersey and RESTEasy framework earlier and now we will be using Spring Rest for a new project , I don't want to pass all the query params and matrix params as parameters in the method , and usually I would annotate the method with @Context UriInfo and would get all the parameters inside my method in Jersey or RESTEasy Framework for complex parameters. I would like to know if there is any @Context UriInfo in Spring REST, which is similar to RESTEasy or Jersey Framework. I would

One domain model, multiple json views

冷暖自知 提交于 2021-02-18 00:14:07
问题 We have a set of domain classes which are serialized to json via jackson using jersey services. We are currently annotating the classes with JAXB (although we're not tied to that). This works fine. But we want to offer different serializations of the classes for different use cases. Web site Mobile apps Admin tool Public API In each of these cases there are different fields which we may or may not want included in the json view. For example, the admin tool might need some parameters for

【译】索引进阶(八):SQL SERVER唯一索引

陌路散爱 提交于 2021-02-13 16:42:01
【译注:此文为翻译,由于本人水平所限,疏漏在所难免,欢迎探讨指正】 原文链接: 传送门 。 在本章节我们检查唯一索引。唯一索引的特别之处在于它不仅提供了性能益处,而且提供了数据完整性益处。在SQL SERVER中,唯一索引是保证主键约束和候选键约束的唯一合理的方式。 唯一索引和约束 唯一索引与其他任何索引并没有什么不同,唯一不同之处在于它不允许多个条目具有相同的索引键值。既然索引中的一个条目映射到了交互表的一行,那么阻止条目被加入到索引中便是阻止了数据行被加到表中。这便是为什么唯一索引是主键约束和候选键约束的保证。 声明一个主键或者唯一性索引都会导致SQL SERVER自动创建索引。你可以具有一个唯一索引而没有与之匹配的约束,但是没有唯一索引的话,你不能具有任何唯一约束。定义一个约束会导致与约束同名的一个索引被创建。不首先删除约束,你是不能删除索引的,因为约束是不能离开索引而存在的。删除约束也会导致与之关联的索引被删除。 每张表包含超过一个唯一索引是可能的。举个例子,AdventureWork库的 Product 表具有四个唯一索引,ProductID, ProductNumber, rowguid, ProductName这四个列各有一个唯一索引。AdventureWorks 数据库的设计者选择ProductID 作表的主键,其他三个作替换键,有时候 称为候选键。

How to retrieve client certificate from rest request in Java

为君一笑 提交于 2021-02-11 14:44:14
问题 I'm using Jersey for REST server in Java and Jetty as web server. I have self signed certificates. I want to fetch client certificate details from received HTTP Request. How to obtain the information from HttpServletRequest ? One method: X509Certificate certs[] = (X509Certificate[])httpRequest.getAttribute("javax.servlet.request.X509Certificate"); Is this right? This results in exception, Error [Ljava.lang.Object; cannot be cast to [Ljava.security.cert.X509Certificate Should I include any

StreamCorruptedException: invalid stream header:

风流意气都作罢 提交于 2021-02-11 12:41:01
问题 I am getting a StreamCorruptedException and I have no idea why or how it's happening. Any help would be awesome! Here is the Client: ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource service = client.resource(getBaseURI()); Map params = new HashMap<String, Object>(); Order[] orders = odao.getOpenOrdersByTenant(tenantID); JSONObject jObj = new JSONObject(); jObj.put("params", params); jObj.put("sourcePath", System.getProperty("user.dir") + "

Runtime exception with jersey - java.lang.AbstractMethodError

泪湿孤枕 提交于 2021-02-10 18:09:04
问题 I am trying to execute a RESTful web service deployed on tomcat using Jersey implementation. Following is the resource class @Path("/rest") public class PatientResource { PatientService patientService; @GET @Path("/patient/{patientId}") @Produces(MediaType.APPLICATION_JSON) public Patient getPatientDetails(@PathParam("patientId") String patientId) { //return patientService.getPatientDetails(patientId); return new PatientService().getPatientDetails(patientId); } @GET @Path("/patients")

Date format changed in Payara 5 (Long does not work anymore ) — org.eclipse.yasson.YassonProperties#ZERO_TIME_PARSE_DEFAULTING

有些话、适合烂在心里 提交于 2021-02-09 02:45:30
问题 Using Payara 4.174 and receive in backend the date as a long, for example 1540545780000. Now, I upgraded to Payara version 5. public User { String name; Date birthdate; } @POST @Path("/user/) public void createUser(User user) { ... } json call { name: "name", birthdate: 1540545780000 } Now The call brakes with the following error: Caused by: javax.json.bind.JsonbException: Error parsing class java.util.Date from value: 1540545780000. Check your @JsonbDateFormat has all time units for class

Jersey Client: Logging HTTP Redirects

微笑、不失礼 提交于 2021-02-08 08:51:14
问题 I'm using JAX-RS with Jersey. When sending a POST request to an API, I receive a 302 and Jersey follows automatically which results in a 403. In my logging, however, I can only see the failed responses: INFO Rest-Request: POST http://[Jenkins-IP]/job/RestTestingArea/job/testJob/doDelete INFO Rest-Response: POST 403 http://[Jenkins-IP]/job/RestTestingArea/job/testJob/doDelete I have determined that in between request and response there is a redirect because when I turn off redirects, the

Jersey Client: Logging HTTP Redirects

江枫思渺然 提交于 2021-02-08 08:51:11
问题 I'm using JAX-RS with Jersey. When sending a POST request to an API, I receive a 302 and Jersey follows automatically which results in a 403. In my logging, however, I can only see the failed responses: INFO Rest-Request: POST http://[Jenkins-IP]/job/RestTestingArea/job/testJob/doDelete INFO Rest-Response: POST 403 http://[Jenkins-IP]/job/RestTestingArea/job/testJob/doDelete I have determined that in between request and response there is a redirect because when I turn off redirects, the