FileUpload.jsp revision 422f9c44458dca571ce35115d5173ce5702a1560
509N/A $Id: FileUpload.jsp,v 1.4 2009/08/07 23:39:08 asyhuang Exp $
1466N/A<%@page import="com.iplanet.am.util.SystemProperties"%>
851N/A<%@page import="com.iplanet.sso.SSOException"%>
851N/A<%@page import="com.iplanet.sso.SSOToken"%>
851N/A<%@page import="com.iplanet.sso.SSOTokenManager"%>
851N/A<%@page import="com.sun.identity.shared.Constants"%>
<%@page import="java.io.*" %>
<%@page import="java.util.*" %>
<%@ page import="org.owasp.esapi.ESAPI" %>
request.setCharacterEncoding("UTF-8");
Locale resLocale = request.getLocale();
resLocale = Locale.US;
SSOTokenManager manager = SSOTokenManager.getInstance();
SSOToken ssoToken = manager.createSSOToken(request);
if (!manager.isValidToken(ssoToken)) {
String redirectUrl = request.getScheme() + "://" +
request.getServerName() + ":" +
response.sendRedirect(redirectUrl);
is = request.getInputStream();
String line = bos.readLine();
sb.append(line).append("\n");
line = bos.readLine();
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);
String contentType = request.getContentType();
contentType = request.getHeader("Content-Type");
if (contentType != null && contentType.lastIndexOf("boundary=") != -1) {
if (boundary.endsWith("\n")) {
String data = sb.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(">", ">");
bos.close();
is.close();