/* (non-Javadoc)
@see com.emc.ecs.nfsclient.nfs.Nfs#makeReaddirplusRequest(byte[], long, long, int, int)
503144
public NfsReaddirplusRequest makeReaddirplusRequest(byte[] directoryFileHandle, long cookie, long cookieverf,
            int dircount, int maxcount) throws FileNotFoundException {
        return new Nfs3ReaddirplusRequest(directoryFileHandle, cookie, cookieverf, dircount, maxcount, _credential);
    }
1107695
public Nfs3CreateResponse sendCreate(NfsCreateRequest request) throws IOException {
        Nfs3CreateResponse response = new Nfs3CreateResponse();
        _rpcWrapper.callRpcNaked(request, response);
        return response;
    }
478267
protected void doHandleUploadRequest(final Request request) {
		// Protect against client-side tampering of disabled/read-only fields.
		if (isDisabled() || isReadOnly()) {
			throw new SystemException("File widget cannot be updated.");
		}

		// Only process on a POST
		if (!"POST".equals(request.getMethod())) {
			throw new SystemException(
					"File widget cannot be updated by " + request.getMethod() + ".");
		}

		// Check only one file item in the request
		FileItem[] items = request.getFileItems(getId());
		if (items.length > 1) {
			throw new SystemException("More than one file item received on the request.");
		}

		// Check the client provided a fileID
		String fileId = request.getParameter(FILE_UPLOAD_MULTI_PART_ID_KEY);
		if (fileId == null) {
			throw new SystemException("No file id provided for file upload.");
		}

		// Wrap the file item
		FileItemWrap wrap = new FileItemWrap(items[0]);
		
		// if fileType is supplied then validate it
		if (hasFileTypes() && !FileUtil.validateFileType(wrap, getFileTypes())) {
			String invalidMessage = FileUtil.getInvalidFileTypeMessage(getFileTypes());
			throw new SystemException(invalidMessage);
		}

		// if fileSize is supplied then validate it
		if (hasMaxFileSize() && !FileUtil.validateFileSize(wrap, getMaxFileSize())) {
			String invalidMessage = FileUtil.getInvalidFileSizeMessage(getMaxFileSize());
			throw new SystemException(invalidMessage);
		}
		
		FileWidgetUpload file = new FileWidgetUpload(fileId, wrap);
		addFile(file);

		// Set the file id to be used ion the renderer
		setFileUploadRequestId(fileId);
		setNewUpload(true);
	}
652600
public Nfs3AccessResponse wrapped_getAccess(NfsAccessRequest request) throws IOException {
        NfsResponseHandler<Nfs3AccessResponse> responseHandler = new NfsResponseHandler<Nfs3AccessResponse>() {

            /* (non-Javadoc)
             * @see com.emc.ecs.nfsclient.rpc.RpcResponseHandler#makeNewResponse()
             */
            protected Nfs3AccessResponse makeNewResponse() {
                return new Nfs3AccessResponse();
            }

        };
        _rpcWrapper.callRpcWrapped(request, responseHandler);
        return responseHandler.getResponse();
    }
722715
public Nfs3LinkRequest makeLinkRequest(byte[] fileHandle, byte[] parentDirectoryFileHandle, String name) throws FileNotFoundException {
        return new Nfs3LinkRequest(fileHandle, parentDirectoryFileHandle, name, _credential);
    }
179162
private boolean isPayloadIndirectOrDirect(final HttpServletRequest request) {
        return Collections.list(request.getHeaders("Link")).stream().map(Link::valueOf).map(Link::getUri)
                .anyMatch(l -> directOrIndirect.contains(l));
    }
819274
public Nfs3PathconfResponse getPathconf(NfsPathconfRequest request) throws IOException {
        Nfs3PathconfResponse response = new Nfs3PathconfResponse();
        _rpcWrapper.callRpcNaked(request, response);
        return response;
    }
783053
public Request makeRequest(HttpMethod httpMethod, String urlPath) throws IOException
  {
    return makeRequest(httpMethod, urlPath, true);
  }
201668
public Nfs3LookupResponse getLookup(NfsLookupRequest request) throws IOException {
         Nfs3LookupResponse response = new Nfs3LookupResponse();
         _rpcWrapper.callRpcNaked(request, response);
         return response;
     }
1100416
public Nfs3WriteRequest makeWriteRequest(byte[] fileHandle, long offset, List<ByteBuffer> payload, int syncType) throws FileNotFoundException {
        return new Nfs3WriteRequest(fileHandle, offset, payload, syncType, _credential);
    }
707493
public NfsSetAttrRequest makeSetAttrRequest(byte[] fileHandle, NfsSetAttributes attributes, NfsTime guardTime) throws FileNotFoundException {
        return new Nfs3SetAttrRequest(fileHandle, attributes, guardTime, _credential);
    }
453426
@Override
    public PortletDelegationDispatcher createRequestDispatcher(
            PortletRequest portletRequest, IPortletDefinitionId delegatePortletDefinitionId) {
        final HttpServletRequest request =
                this.portalRequestUtils.getPortletHttpRequest(portletRequest);

        final String windowID = portletRequest.getWindowID();
        final IPortletWindowId parentPortletWindowId =
                this.portletWindowRegistry.getPortletWindowId(request, windowID);

        final IPortletEntity delegatePortletEntity =
                this.portletEntityRegistry.getOrCreateDelegatePortletEntity(
                        request, parentPortletWindowId, delegatePortletDefinitionId);
        final IPortletEntityId delegatePortletEntityId = delegatePortletEntity.getPortletEntityId();

        final IPortletWindow delegatePortletWindow =
                this.portletWindowRegistry.createDelegatePortletWindow(
                        request, delegatePortletEntityId, parentPortletWindowId);

        final IPerson person = this.personManager.getPerson(request);
        final int userId = person.getID();

        return new PortletDelegationDispatcherImpl(
                delegatePortletWindow,
                userId,
                portalRequestUtils,
                personManager,
                portletRenderer,
                portalUrlProvider,
                portletDelegationManager);
    }
1203091
private void sendDirectory(final YokeRequest request, final String dir, final Handler<Object> next) {
        final FileSystem fileSystem = vertx().fileSystem();

        fileSystem.readDir(dir, new AsyncResultHandler<List<String>>() {
            @Override
            public void handle(AsyncResult<List<String>> asyncResult) {
                if (asyncResult.failed()) {
                    next.handle(asyncResult.cause());
                } else {
                    String accept = request.getHeader("accept", "text/plain");

                    if (accept.contains("html")) {
                        String normalizedDir = dir.substring(root.length());
                        if (!normalizedDir.endsWith("/")) {
                            normalizedDir += "/";
                        }

                        String file;
                        StringBuilder files = new StringBuilder("<ul id=\"files\">");

                        for (String s : asyncResult.result()) {
                            file = s.substring(s.lastIndexOf('/') + 1);
                            // skip dot files
                            if (!includeHidden && file.charAt(0) == '.') {
                                continue;
                            }
                            files.append("<li><a href=\"");
                            files.append(normalizedDir);
                            files.append(file);
                            files.append("\" title=\"");
                            files.append(file);
                            files.append("\">");
                            files.append(file);
                            files.append("</a></li>");
                        }

                        files.append("</ul>");

                        StringBuilder directory = new StringBuilder();
                        // define access to root
                        directory.append("<a href=\"/\">/</a> ");

                        StringBuilder expandingPath = new StringBuilder();
                        String[] dirParts = normalizedDir.split("/");
                        for (int i = 1; i < dirParts.length; i++) {
                            // dynamic expansion
                            expandingPath.append("/");
                            expandingPath.append(dirParts[i]);
                            // anchor building
                            if (i > 1) {
                                directory.append(" / ");
                            }
                            directory.append("<a href=\"");
                            directory.append(expandingPath.toString());
                            directory.append("\">");
                            directory.append(dirParts[i]);
                            directory.append("</a>");
                        }

                        request.response().setContentType("text/html");
                        request.response().end(
                                directoryTemplate.replace("{title}", (String) request.get("title")).replace("{directory}", normalizedDir)
                                        .replace("{linked-path}", directory.toString())
                                        .replace("{files}", files.toString()));
                    } else if (accept.contains("json")) {
                        String file;
                        JsonArray json = new JsonArray();

                        for (String s : asyncResult.result()) {
                            file = s.substring(s.lastIndexOf('/') + 1);
                            // skip dot files
                            if (!includeHidden && file.charAt(0) == '.') {
                                continue;
                            }
                            json.add(file);
                        }

                        request.response().end(json);
                    } else {
                        String file;
                        StringBuilder buffer = new StringBuilder();

                        for (String s : asyncResult.result()) {
                            file = s.substring(s.lastIndexOf('/') + 1);
                            // skip dot files
                            if (!includeHidden && file.charAt(0) == '.') {
                                continue;
                            }
                            buffer.append(file);
                            buffer.append('\n');
                        }

                        request.response().setContentType("text/plain");
                        request.response().end(buffer.toString());
                    }
                }
            }
        });
    }
108782
public NfsSetAttrRequest makeSetAttrRequest(NfsSetAttributes attributes, NfsTime guardTime) throws IOException {
        return getNfs().makeSetAttrRequest(getFileHandle(), attributes, guardTime);
    }
657184
public Nfs3ReaddirResponse wrapped_getReaddir(NfsReaddirRequest request) throws IOException {
        NfsResponseHandler<Nfs3ReaddirResponse> responseHandler = new NfsResponseHandler<Nfs3ReaddirResponse>() {

            /* (non-Javadoc)
             * @see com.emc.ecs.nfsclient.rpc.RpcResponseHandler#makeNewResponse()
             */
            protected Nfs3ReaddirResponse makeNewResponse() {
                return new Nfs3ReaddirResponse();
            }

        };
        _rpcWrapper.callRpcWrapped(request, responseHandler);
        return responseHandler.getResponse();
    }
1198756
public Nfs3ReaddirplusResponse getReaddirplus(NfsReaddirplusRequest request) throws IOException {
        Nfs3ReaddirplusResponse response = new Nfs3ReaddirplusResponse();
        _rpcWrapper.callRpcNaked(request, response);
        return response;
    }
327617
public Nfs3ReadResponse getRead(NfsReadRequest request, byte[] bytes, int position) throws IOException {
        Nfs3ReadResponse response = new Nfs3ReadResponse(bytes, position);
        _rpcWrapper.callRpcNaked(request, response);
        return response;
    }