FileUpload.jsp revision e8721886dbfd32e88cc7077cbee4b6bb1b44b443
200N/A $Id: FileUpload.jsp,v 1.4 2009/08/07 23:39:08 asyhuang Exp $
200N/A<%@page import="com.iplanet.sso.SSOException"%>
200N/A<%@page import="com.iplanet.sso.SSOToken"%>
200N/A<%@page import="com.iplanet.sso.SSOTokenManager"%>
200N/A<%@page import="java.util.*" %>
200N/A request.setCharacterEncoding("UTF-8");
200N/A Locale resLocale = request.getLocale();
200N/A SSOTokenManager manager = SSOTokenManager.getInstance();
200N/A SSOToken ssoToken = manager.createSSOToken(request);
200N/A if (!manager.isValidToken(ssoToken)) {
200N/A String redirectUrl = request.getScheme() + "://" +
200N/A request.getServerName() + ":" +
response.sendRedirect(redirectUrl);
is = request.getInputStream();
String line = bos.readLine();
buff.append(line).append("\n");
line = bos.readLine();
if (buff.length() > (1024 * 50)) {
com.sun.identity.shared.debug.Debug.getInstance("workflowMessages");
rb = ResourceBundle.getBundle(RB_NAME, resLocale);
String data = com.sun.identity.shared.locale.Locale.getString(
rb, "file.upload.size.limit.exceeded", debug);
out.println("<div id=\"data\">" + "Error: " + data + "</div>");
String contentType = request.getContentType();
contentType = request.getHeader("Content-Type");
if (contentType != null && contentType.lastIndexOf("boundary=") != -1) {
if (boundary.endsWith("\n")) {
String data = buff.toString();
int idx = data.indexOf("filename=\"");
idx = data.indexOf("\n\n", idx);
data = data.substring(idx + 2);
idx = data.lastIndexOf("\n--" + boundary);
data = data.substring(0, idx);
data = data.replace("<", "<");
data = data.replace(">", ">");
out.println("<div id=\"data\">" + data + "</div>");
bos.close();
is.close();