@@ -0,0 +1,2755 @@
+/**%0A * Licensed to the Apache Software Foundation (ASF) under one%0A * or more contributor license agreements.  See the NOTICE file%0A * distributed with this work for additional information%0A * regarding copyright ownership.  The ASF licenses this file%0A * to you under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance%0A * with the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.apache.jena.web;%0A%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0Aimport java.net.HttpURLConnection;%0Aimport java.net.URL;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.UUID;%0A%0Aimport org.apache.jena.atlas.io.IO;%0A%0A/** Multipart HTTP PUT/POST. */%0Apublic class FileSender %7B%0A%0A    class Entry %7B%0A        String fileName;%0A        String content;%0A        String contentType;%0A    %7D%0A%0A    private List%3CEntry%3E items = new ArrayList%3C%3E();%0A%0A    private String url;%0A%0A    public FileSender(String url ) %7B this.url = url; %7D%0A%0A    public void add(String filename, String content, String type) %7B%0A        Entry e = new Entry();%0A        e.fileName = filename;%0A        e.content = content;%0A        e.contentType = type;%0A        items.add(e);%0A    %7D%0A%0A    public void send(String method) %7B%0A        try %7B%0A            String WNL = %22%5Cr%5Cn%22;   // Web newline%0A            String boundary = UUID.randomUUID().toString();%0A%0A            HttpURLConnection connection = (HttpURLConnection)new URL(url).openConnection();%0A            connection.setRequestMethod(method);%0A            connection.setDoOutput(true);%0A            connection.setRequestProperty(%22Content-Type%22, %22multipart/form-data; boundary=%22 + boundary);%0A            try ( PrintStream ps = new PrintStream(connection.getOutputStream()); ) %7B%0A                for ( Entry e : items ) %7B%0A                    ps.print(%22--%22 + boundary+WNL);%0A                    ps.print(%22Content-Disposition: form-data; name=%5C%22FILE%5C%22; filename=%5C%22%22+e.fileName+%22%5C%22%22+WNL);%0A                    ps.print(%22Content-Type: %22+e.contentType+%22;charset=UTF-8%22+WNL);%0A                    ps.print(WNL);%0A                    ps.print(e.content);%0A                    ps.print(WNL);%0A                %7D%0A                ps.print(%22--%22 + boundary + %22--%22+WNL);%0A            %7D%0A            connection.connect();%0A            int responseCode = connection.getResponseCode();%0A        %7D catch (IOException ex) %7B IO.exception(ex); %7D%0A    %7D%0A%7D%0A%0A

Move FileSender into oaj.web