Codota Logo
ResourceResponse.setContentLength
Code IndexAdd Codota to your IDE (free)

How to use
setContentLength
method
in
javax.portlet.ResourceResponse

Best Java code snippets using javax.portlet.ResourceResponse.setContentLength (Showing top 17 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: javax.portlet/portlet-api

@Override
public void setContentLength(int len) {
 ((ResourceResponse)response).setContentLength(len);
}
origin: com.vaadin/vaadin-server

@Override
public void setContentLength(int len) {
  if (response instanceof ResourceResponse) {
    ((ResourceResponse) response).setContentLength(len);
  }
}
origin: com.liferay.portal/com.liferay.portal.kernel

public static void write(
    MimeResponse mimeResponse, byte[] bytes, int offset,
    int contentLength)
  throws IOException {
  // LEP-3122
  if (!mimeResponse.isCommitted()) {
    // LEP-536
    if (contentLength == 0) {
      contentLength = bytes.length;
    }
    if (mimeResponse instanceof ResourceResponse) {
      ResourceResponse resourceResponse =
        (ResourceResponse)mimeResponse;
      resourceResponse.setContentLength(contentLength);
    }
    OutputStream outputStream = mimeResponse.getPortletOutputStream();
    outputStream.write(bytes, offset, contentLength);
  }
}
origin: com.liferay.portal/com.liferay.portal.kernel

public static void write(
    MimeResponse mimeResponse, InputStream inputStream,
    int contentLength)
  throws IOException {
  if (mimeResponse.isCommitted()) {
    if (inputStream != null) {
      try {
        inputStream.close();
      }
      catch (IOException ioe) {
        if (_log.isWarnEnabled()) {
          _log.warn(ioe, ioe);
        }
      }
    }
    return;
  }
  if (contentLength > 0) {
    if (mimeResponse instanceof ResourceResponse) {
      ResourceResponse resourceResponse =
        (ResourceResponse)mimeResponse;
      resourceResponse.setContentLength(contentLength);
    }
  }
  StreamUtil.transfer(inputStream, mimeResponse.getPortletOutputStream());
}
origin: org.onehippo.ecm.hst/hst-commons

protected void setResponseContentLength(int len) {
  if (isResourceResponse) {
    ((ResourceResponse) this.response).setContentLength(len);
  }
}
origin: org.apache.portals.pluto/pluto-container

@Override
public void setContentLength(int len) {
 if (!included && (portletResponse instanceof ResourceResponse)) {
   ((ResourceResponse) portletResponse).setContentLength(len);
 }
}
origin: org.apache.portals/portlet-api_2.1.0_spec

/**
 *  The default behavior of this method is to call 
 * <code>setContentLength()</code> on the wrapped response object.
 */
public void setContentLength(int len) {
  response.setContentLength(len);
}
origin: com.liferay.faces/liferay-faces-bridge-impl

@Override
public void setContentLength(int length) {
  wrappedResourceResponse.setContentLength(length);
}
origin: org.jasig.portal/uPortal-web

@Override
public void setContentLength(int len) {
  resourceResponse.setContentLength(len);
}
origin: liferay/liferay-faces

@Override
public void setContentLength(int length) {
  wrappedResourceResponse.setContentLength(length);
}
origin: com.liferay.faces/liferay-faces-bridge-impl

public void setContentLength(int len) {
  getResponse().setContentLength(len);
}
origin: liferay/liferay-faces

public void setContentLength(int len) {
  getResponse().setContentLength(len);
}
origin: com.liferay.faces/liferay-faces-bridge-impl

/**
 * @see    {@link ExternalContext#setResponseContentLength(int)}
 * @since  JSF 2.0
 */
@Override
public void setResponseContentLength(int length) {
  if (portletResponse instanceof ResourceResponse) {
    ResourceResponse resourceResponse = (ResourceResponse) portletResponse;
    resourceResponse.setContentLength(length);
  }
  else {
    if (manageIncongruities) {
      incongruityContext.setResponseContentLength(length);
    }
    else {
      throw new IllegalStateException();
    }
  }
}
origin: liferay/liferay-faces

/**
 * @see    {@link ExternalContext#setResponseContentLength(int)}
 * @since  JSF 2.0
 */
@Override
public void setResponseContentLength(int length) {
  if (portletResponse instanceof ResourceResponse) {
    ResourceResponse resourceResponse = (ResourceResponse) portletResponse;
    resourceResponse.setContentLength(length);
  }
  else {
    if (manageIncongruities) {
      incongruityContext.setResponseContentLength(length);
    }
    else {
      throw new IllegalStateException();
    }
  }
}
origin: stackoverflow.com

 public void descargarRecibo(ResourceRequest request,
    ResourceResponse response, PortletSession session,
    ModelMap modelMap) {
  FileInputStream fileInputStream = null;
  BufferedInputStream bufferedInputStream = null;

  String fileURL = "c:/intranetdoc/PDetalleLlamadas/file.pdf";

  try {
    fileInputStream = new java.io.FileInputStream(fileURL);
    OutputStream outputStream = response.getPortletOutputStream();
    response.setContentType("application/pdf");
    response.addProperty("Content-Disposition", "attachment; filename="
        + fileName);
    bufferedInputStream = new java.io.BufferedInputStream(
        fileInputStream);
    byte[] bytes = new byte[bufferedInputStream.available()];
    response.setContentLength(bytes.length);
    int aByte = 0;
    while ((aByte = bufferedInputStream.read()) != -1) {
      outputStream.write(aByte);
    }
    outputStream.flush();
    bufferedInputStream.close();
    response.flushBuffer();
  } catch (Exception e) {
    e.printStackTrace();
  }
}
origin: org.ops4j.pax.wicket/pax-wicket-service

resourceResponse.setContentLength(contentLength);
origin: org.wicketstuff/wicketstuff-portlet

resourceResponse.setContentLength(contentLength);
javax.portletResourceResponsesetContentLength

Javadoc

Sets the length of the content body in the response.

Popular methods of ResourceResponse

  • setContentType
  • getPortletOutputStream
  • setProperty
  • getWriter
  • setCharacterEncoding
    Sets the character encoding (MIME charset) of the response being sent to the client, for example, to
  • setLocale
    Sets the locale of the response, setting the headers (including the Content-Type's charset) as appro
  • addProperty
  • createResourceURL
  • createActionURL
  • createRenderURL
  • flushBuffer
  • getCharacterEncoding
  • flushBuffer,
  • getCharacterEncoding,
  • getContentType,
  • getLocale,
  • getBufferSize,
  • getCacheControl,
  • isCommitted,
  • reset,
  • resetBuffer

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • startActivity (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now