Package org.restlet.ext.fileupload

Examples of org.restlet.ext.fileupload.RestletFileUpload


    protected void doPost(Request req, Response resp) throws IOException {
        if (req.getEntity().getMediaType() != null &&
                req.getEntity().getMediaType().equals(MediaType.MULTIPART_FORM_DATA, true)) {
            try {
                FileItemFactory factory = new DiskFileItemFactory();
                RestletFileUpload upload = new RestletFileUpload(factory);
                List items = upload.parseRequest(req);
                FileItem file = null;

                Iterator it = items.iterator();
                while (it.hasNext()) {
                    FileItem temp = (FileItem)it.next();
View Full Code Here


        HashMap<String,String> nsBindings = new HashMap<String,String> ();

        DiskFileItemFactory factory = new DiskFileItemFactory();
        factory.setSizeThreshold(100240);

        RestletFileUpload upload = new RestletFileUpload(factory);
        List<FileItem> items;
        try {
            items = upload.parseRequest(getRequest());

            File file = null;
            String filename = null;

            for (final Iterator<FileItem> it = items.iterator(); it.hasNext(); ) {
View Full Code Here

    Object result = null;

    List<FileItem> files = null;

    try {
      RestletFileUpload uploadRequest = new RestletFileUpload(getFileItemFactory());

      files = uploadRequest.parseRepresentation(representation);

      result = delegate.upload(getContext(), getRequest(), getResponse(), files);
    }
    catch (FileUploadException e) {
      // try to take simply the body as stream
View Full Code Here

    if(authenticate() == false) return null;
   
    String taskId = (String) getRequest().getAttributes().get("taskId");
   
    try {
      RestletFileUpload upload = new RestletFileUpload(new DiskFileItemFactory());
      List<FileItem> items = upload.parseRepresentation(entity);
     
      FileItem uploadItem = null;
      for (FileItem fileItem : items) {
        if(fileItem.getName() != null) {
          uploadItem = fileItem;
View Full Code Here

  @Post
  public DeploymentResponse uploadDeployment(Representation entity) {
    try {
      if(authenticate(SecuredResource.ADMIN) == false) return null;
     
      RestletFileUpload upload = new RestletFileUpload(new DiskFileItemFactory());
      List<FileItem> items = upload.parseRepresentation(entity);
     
      FileItem uploadItem = null;
      for (FileItem fileItem : items) {
        if(fileItem.getName() != null) {
          uploadItem = fileItem;
View Full Code Here

    private ImportData handleMultiPartFormUpload(ImportContext context) {
        DiskFileItemFactory factory = new DiskFileItemFactory();
        // @revisit - this appears to be causing OOME
        //factory.setSizeThreshold(102400000);

        RestletFileUpload upload = new RestletFileUpload(factory);
        List<FileItem> items = null;
        try {
            items = upload.parseRequest(getRequest());
        } catch (FileUploadException e) {
            throw new RestletException("File upload failed", Status.SERVER_ERROR_INTERNAL, e);
        }

        //look for a directory to hold the files
View Full Code Here

TOP

Related Classes of org.restlet.ext.fileupload.RestletFileUpload

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.