Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.clustermate.jaxrs;
  
  
  
  public class JaxrsHttpResponse extends ServiceResponse
 {
     protected ResponseBuilder _builder;
 
     protected int _statusCode;
 
     /*
     /**********************************************************************
     /* Life-cycle
     /**********************************************************************
      */
     
     public JaxrsHttpResponse() {
          = 200;
     }
 
     public Response buildResponse()
     {
         if ( == null) {
              = Response.status();
         }
         // And what kind of content are we to return, if anything?
         if ( != null) {
             long len = .getLength();
             if (len >= 0L) {
                 this.setContentLength(len);
             }
         } else if ( != null) {
              = .entity();
         }
         return .build();
     }
     
     /*
     /**********************************************************************
     /* Basic VHttpResponse impl
     /**********************************************************************
      */
 
     @Override
     public long getBytesWritten() {
         // TODO: implement... how?
         return 0L;
     }
     
     @Override
     public int getStatus() {
         return ;
     }
     
     @SuppressWarnings("unchecked")
     @Override
     public JaxrsHttpResponse set(int codeObject entity)
     {
          = code;
         return setEntity(entity);
     }
     
     @SuppressWarnings("unchecked")
     @Override
     public JaxrsHttpResponse setStatus(int code)
     {
          = code;
         return this;
     }
 
     @Override
     public JaxrsHttpResponse addHeader(String keyString value)
     {
         if ( == null) {
              = Response.status();
         }
          = .header(keyvalue);
         return this;
     }
 
     @Override
     public JaxrsHttpResponse addHeader(String keyint value)
     {
         if ( == null) {
              = Response.status();
         }
          = .header(keyvalue);
         return this;
     }
 
     @Override
     public JaxrsHttpResponse addHeader(String keylong value)
     {
         if ( == null) {
             = Response.status();
        }
         = .header(keyvalue);
        return this;
    }
    
    @Override
    public JaxrsHttpResponse setContentType(String contentType) {
        if ( == null) {
             = Response.status();
        }
         = .type(contentType);
        return this;
    }
    @Override
    public JaxrsHttpResponse setContentLength(long length) {
    }
New to GrepCode? Check out our FAQ X