String queryString = ""; if (restInvocation.getParamsMap().get(QueryParam.class) != null && !restInvocation.getParamsMap().get(QueryParam.class).isEmpty()) { queryString = String.valueOf(restInvocation.getParamsMap().get(QueryParam.class)); } else if (restInvocation.getRequestBody() != null
public String writeBody(RestInvocation invocation) { //just safety checks if (!invocation.getParamsMap().get(FormParam.class).isEmpty() || invocation.getUnannanotatedParams().isEmpty()) { throw new IllegalArgumentException("No media type specified; don't know how to create request body. Please specify the body media type using @javax.ws.rs.Consumes."); } return null; } }
public String writeBody(RestInvocation invocation) { //just safety checks if (!invocation.getParamsMap().get(FormParam.class).isEmpty() || invocation.getUnannanotatedParams().isEmpty()) { throw new IllegalArgumentException("No media type specified; don't know how to create request body. Please specify the body media type using @javax.ws.rs.Consumes."); } return null; } }
public String writeBody(RestInvocation invocation) { if (!TEXT_PLAIN.equals(invocation.getMethodMetadata().getReqContentType())) { throw new IllegalArgumentException("ToStringRequestWriter supports " + TEXT_PLAIN + " content type only!"); } if (invocation.getParamsMap().get(FormParam.class) != null && !invocation.getParamsMap().get(FormParam.class).isEmpty()) { throw new IllegalArgumentException("@FormParams are not allowed with " + TEXT_PLAIN); } else if (invocation.getUnannanotatedParams().size() > 1) { throw new IllegalArgumentException("Can only have a single unannotated parameter with " + TEXT_PLAIN); } if (invocation.getUnannanotatedParams().isEmpty()) { return null; } return invocation.getUnannanotatedParams().get(0).toString(); } }
public String writeBody(RestInvocation invocation) { if (!TEXT_PLAIN.equals(invocation.getMethodMetadata().getReqContentType())) { throw new IllegalArgumentException("ToStringRequestWriter supports " + TEXT_PLAIN + " content type only!"); } if (invocation.getParamsMap().get(FormParam.class) != null && !invocation.getParamsMap().get(FormParam.class).isEmpty()) { throw new IllegalArgumentException("@FormParams are not allowed with " + TEXT_PLAIN); } else if (invocation.getUnannanotatedParams().size() > 1) { throw new IllegalArgumentException("Can only have a single unannotated parameter with " + TEXT_PLAIN); } if (invocation.getUnannanotatedParams().isEmpty()) { return null; } return invocation.getUnannanotatedParams().get(0).toString(); } }
public String writeBody(RestInvocation invocation) { if (!MediaType.APPLICATION_JSON.equals(invocation.getMethodMetadata().getReqContentType())) { throw new IllegalArgumentException("JsonRequestWriter supports application/json content type only!"); } if (invocation.getParamsMap().get(FormParam.class) != null && !invocation.getParamsMap().get(FormParam.class).isEmpty()) { throw new IllegalArgumentException("@FormParams are not allowed with " + MediaType.APPLICATION_JSON); } else if (invocation.getUnannanotatedParams().size() > 1) { throw new IllegalArgumentException("Can only have a single unannotated parameter with " + MediaType.APPLICATION_JSON); } if (invocation.getUnannanotatedParams().isEmpty()) { return null; } try { return objectMapper.writeValueAsString(invocation.getUnannanotatedParams().get(0)); } catch (JsonProcessingException e) { throw new RuntimeException("Error writing json. This could be due to an error in your Jackson mapping, or a bug in rescu.", e); } }
public String writeBody(RestInvocation invocation) { if (!MediaType.APPLICATION_JSON.equals(invocation.getMethodMetadata().getReqContentType())) { throw new IllegalArgumentException("JsonRequestWriter supports application/json content type only!"); } if (invocation.getParamsMap().get(FormParam.class) != null && !invocation.getParamsMap().get(FormParam.class).isEmpty()) { throw new IllegalArgumentException("@FormParams are not allowed with " + MediaType.APPLICATION_JSON); } else if (invocation.getUnannanotatedParams().size() > 1) { throw new IllegalArgumentException("Can only have a single unannotated parameter with " + MediaType.APPLICATION_JSON); } if (invocation.getUnannanotatedParams().isEmpty()) { return null; } try { return objectMapper.writeValueAsString(invocation.getUnannanotatedParams().get(0)); } catch (JsonProcessingException e) { throw new RuntimeException("Error writing json. This could be due to an error in your Jackson mapping, or a bug in rescu.", e); } }