Package org.jspresso.framework.util.resources

Examples of org.jspresso.framework.util.resources.IResourceBase


   * @param id
   *          the identifier under which the resource has been registered.
   * @return the registsred resource or null.
   */
  public IResourceBase getRegistered(String id) {
    IResourceBase resource = resources.get(id);
    // Do not unregister resource once retrieved. There might be cases
    // when the resource must be retrieved multiple times.
    // unregister(id);
    return resource;
  }
View Full Code Here


      response.setContentType("text/xml");
      out = response.getOutputStream();
      for (FileItem item : items) {
        if (!item.isFormField()) {
          out.print("<resource");
          IResourceBase uploadResource = new UploadResourceAdapter(
              "application/octet-stream", item);
          String resourceId = ResourceManager.getInstance().register(
              uploadResource);
          out.print(" id=\"" + resourceId);
          out.print("\" name=\"" + HtmlHelper.escapeForHTML(item.getName()));
View Full Code Here

        throw new ServletException("No resource id nor local URL specified.");
      }

      BufferedInputStream inputStream = null;
      if (id != null) {
        IResourceBase resource = ResourceManager.getInstance()
            .getRegistered(id);
        if (resource == null) {
          throw new ServletException("Bad resource id : " + id);
        }

        response.setContentType(resource.getMimeType());
        completeFileName(response, resource.getName());
        long resourceLength = resource.getSize();
        if (resourceLength > 0) {
          response.setContentLength((int) resourceLength);
        }

        if (resource instanceof IResource) {
View Full Code Here

TOP

Related Classes of org.jspresso.framework.util.resources.IResourceBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.