@Override public FileObject get() throws FileSystemException { final FileSystemManager fileSystem = fileSystemManagerProvider.get(); final FileObject folder = getTemporaryFolder(fileSystem); final String childName = System.currentTimeMillis() + "-"; return getChildFolder(fileSystem, folder, childName); }
public WebCustomRequest map(FilterableRequestSpecification requestSpec, FilterContext ctx) { try { URL url = new URL(ctx.getCompleteRequestPath()); String method = String.valueOf(ctx.getRequestMethod()); WebCustomRequest request = new WebCustomRequest(); request.setName(method + " to " + url.toString()); request.setUrl(url.toString()); request.setMethod(method); request.setResource("0"); request.setSnapshot( String.format("t%d.inf", (long) (System.currentTimeMillis() % Math.pow(10, 10)))); request.setMode(url.getProtocol()); request.setBody((String) requestSpec.getBody()); request.getBeforeFunctions().add(new WebRequestSaveParam()); for (Header header : requestSpec.getHeaders()) { request.getBeforeFunctions().add(headerMapper.map(header)); } return request; } catch (MalformedURLException e) { throw new RuntimeException(e); } }
private FileObject getTemporaryFolder(final FileSystemManager fileSystem) throws FileSystemException { return fileSystem.resolveFile(System.getProperty("java.io.tmpdir")); }