コード例 #1
0
 protected void addLink(String rel, Pagination p, ContainerRequest req, ContainerResponse res) {
   URI uri =
       req.getRequestUriBuilder()
           .replaceQueryParam(RESTConstants.LIMIT, p.getLimit())
           .replaceQueryParam(RESTConstants.PAGE, p.getPage())
           .build();
   MediaType type = res.getMediaType();
   LinkHeader header = LinkHeader.uri(uri).type(type).rel(rel).build();
   res.getHttpHeaders().add(LINK_HEADER, header.toString());
 }
コード例 #2
0
  /*
   * (non-Javadoc)
   *
   * @see
   * com.sun.jersey.spi.container.ContainerResponseFilter#filter(com.sun.jersey
   * .spi.container.ContainerRequest,
   * com.sun.jersey.spi.container.ContainerResponse)
   */
  @Override
  public ContainerResponse filter(ContainerRequest request, ContainerResponse response) {
    if (logStdOut) {
      // If it is image, then don't call super
      if (response.getMediaType() != null) {
        // logger.info("DELETE ME: Response= mediaType="
        // + response.getMediaType() + ", getType()"
        // + response.getMediaType().getType() + ", getSubType()="
        // + response.getMediaType().getSubtype());
      } else {
        logger.info("DELETE ME: Response= mediaType is null");
      }
      if (response.getMediaType() == null || !response.getMediaType().getType().equals("image")) {

        response = super.filter(request, response);
      }
    }

    return response;
  }