// Path: src/java/org/onesocialweb/openfire/exception/AuthenticationException.java
// @SuppressWarnings("serial")
// public class AuthenticationException extends Exception {
// 
// }
// 
// Path: src/java/org/onesocialweb/openfire/exception/InvalidParameterValueException.java
// @SuppressWarnings("serial")
// public class InvalidParameterValueException extends Exception {
// 
// 	private final String parameter;
// 	
// 	private final String value;
// 
// 	public InvalidParameterValueException(String parameter, String value) {
// 		this.parameter = parameter;
// 		this.value = value;
// 	}
// 	
// 	public String getParameter() {
// 		return parameter;
// 	}
// 
// 	public String getValue() {
// 		return value;
// 	}
// 	
// }
// 
// Path: src/java/org/onesocialweb/openfire/exception/MissingParameterException.java
// @SuppressWarnings("serial")
// public class MissingParameterException extends Exception {
// 
// 	private final String parameter;
// 	
// 	public MissingParameterException(String parameter) {
// 		this.parameter = parameter;
// 	}
// 	
// 	public String getParameter() {
// 		return parameter;
// 	}
// 	
// }
// 
// Path: src/java/org/onesocialweb/openfire/model/FileEntry.java
// public interface FileEntry {
// 
// 	public String getId();
// 
// 	public void setId(String id);
// 
// 	public String getName();
// 
// 	public void setName(String name);
// 
// 	public String getType();
// 
// 	public void setType(String type);
// 
// 	public String getOwner();
// 
// 	public void setOwner(String owner);
// 
// 	public long getSize();
// 
// 	public void setSize(long size);
// 
// }


import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.UUID;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.ProgressListener;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.jivesoftware.admin.AuthCheckFilter;
import org.jivesoftware.util.JiveGlobals;
import org.onesocialweb.openfire.exception.AuthenticationException;
import org.onesocialweb.openfire.exception.InvalidParameterValueException;
import org.onesocialweb.openfire.exception.MissingParameterException;
import org.onesocialweb.openfire.model.FileEntry;
import org.xmpp.packet.JID;
/*
 *  Copyright 2010 Vodafone Group Services Ltd.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *    
 */
package org.onesocialweb.openfire.web;




@SuppressWarnings("serial")
public class FileServlet extends HttpServlet {

	private static final long NOTIFICATION_THRESHOLD = 256000;

	private static int BUFFSIZE = 64000;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		final PrintWriter out = response.getWriter();
		
		try {
			processGet(request, response);
// Path: src/java/org/onesocialweb/openfire/exception/AuthenticationException.java
// @SuppressWarnings("serial")
// public class AuthenticationException extends Exception {
// 
// }
// 
// Path: src/java/org/onesocialweb/openfire/exception/InvalidParameterValueException.java
// @SuppressWarnings("serial")
// public class InvalidParameterValueException extends Exception {
// 
// 	private final String parameter;
// 	
// 	private final String value;
// 
// 	public InvalidParameterValueException(String parameter, String value) {
// 		this.parameter = parameter;
// 		this.value = value;
// 	}
// 	
// 	public String getParameter() {
// 		return parameter;
// 	}
// 
// 	public String getValue() {
// 		return value;
// 	}
// 	
// }
// 
// Path: src/java/org/onesocialweb/openfire/exception/MissingParameterException.java
// @SuppressWarnings("serial")
// public class MissingParameterException extends Exception {
// 
// 	private final String parameter;
// 	
// 	public MissingParameterException(String parameter) {
// 		this.parameter = parameter;
// 	}
// 	
// 	public String getParameter() {
// 		return parameter;
// 	}
// 	
// }
// 
// Path: src/java/org/onesocialweb/openfire/model/FileEntry.java
// public interface FileEntry {
// 
// 	public String getId();
// 
// 	public void setId(String id);
// 
// 	public String getName();
// 
// 	public void setName(String name);
// 
// 	public String getType();
// 
// 	public void setType(String type);
// 
// 	public String getOwner();
// 
// 	public void setOwner(String owner);
// 
// 	public long getSize();
// 
// 	public void setSize(long size);
// 
// }


// Path: src/java/org/onesocialweb/openfire/web/FileServlet.java
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.UUID;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.ProgressListener;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.jivesoftware.admin.AuthCheckFilter;
import org.jivesoftware.util.JiveGlobals;
import org.onesocialweb.openfire.exception.AuthenticationException;
import org.onesocialweb.openfire.exception.InvalidParameterValueException;
import org.onesocialweb.openfire.exception.MissingParameterException;
import org.onesocialweb.openfire.model.FileEntry;
import org.xmpp.packet.JID;

/*
 *  Copyright 2010 Vodafone Group Services Ltd.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *    
 */
package org.onesocialweb.openfire.web;




@SuppressWarnings("serial")
public class FileServlet extends HttpServlet {

	private static final long NOTIFICATION_THRESHOLD = 256000;

	private static int BUFFSIZE = 64000;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		final PrintWriter out = response.getWriter();
		
		try {
			processGet(request, response);
		} catch (MissingParameterException e) {