Code: Alles auswählen.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("Request-Type: "+request.getQueryString());
try {
} catch(Exception e) {
System.out.println("Falscher Part-Name");
}
if(ServletFileUpload.isMultipartContent(request)) {
System.out.println("IF_1");
try {
List<FileItem> multiparts = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
System.out.println("TRY");
for(FileItem item : multiparts) {
System.out.println("FOR");
if(!item.isFormField()) {
String name = new File(item.getName()).getName();
System.out.println("IF_2");
item.write(new File(UPLOAD_DIRECTORY + File.separator + name));
}
}
request.setAttribute("message", "File upload successfully");
System.out.println("Uploaded");
} catch (Exception ex) {
request.setAttribute("message", "File failed to upload due to"+ex);
System.out.println("Failed");
}
} else {
request.setAttribute("message", "Sorry this Servlet inly handles file upload request");
System.out.println("Wrong Request");
}
request.getRequestDispatcher("/result.jsp").forward(request, response);
}
Code: Alles auswählen.
Request-Type: create&pVersion=0046&contRep=ZZ&docId=0332B5541ED0447AE1000000C19B4309&docProt=rcud&accessMode=c&authId=CN%3DVE0,OU%3DI0110005664,OU%3DSAPWebAS,O%3DSAPTrustCommunity,C%3DDE&expiration=20150114123542&secKey=MIIBUQYJKoZIhvcNAQcCoIIBQjCCAT4CAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHATGCAR0wggEZAgEBMG8wZDELMAkGA1UEBhMCREUxHDAaBgNVBAoTE1NBUCBUcnVzdCBDb21tdW5pdHkxEzARBgNVBAsTClNBUCBXZWIgQVMxFDASBgNVBAsTC0kwMTEwMDA1NjY0MQwwCgYDVQQDEwNWRTACByAQEgIQNDMwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTE1MDExNDEwMzU0MlowIwYJKoZIhvcNAQkEMRYEFHlcrHUf1ii6yzek2hUpeoZSL%2BbJMAkGByqGSM44BAMELjAsAhRYrV2MWK64hmYJuBs5YrauiOBhSAIURhn8sDs56%2FOCN%2FzqqmoqcI2NVDM%3D
Falscher Part-Name
IF_1
TRY
Uploaded
doGet-Aufruf