1 40 package org.dspace.app.webui.servlet.admin; 41 42 import java.io.IOException ; 43 import java.sql.SQLException ; 44 45 import javax.servlet.ServletException ; 46 import javax.servlet.http.HttpServletRequest ; 47 import javax.servlet.http.HttpServletResponse ; 48 49 import org.apache.log4j.Logger; 50 import org.dspace.app.webui.servlet.DSpaceServlet; 51 import org.dspace.app.webui.util.JSPManager; 52 import org.dspace.app.webui.util.UIUtil; 53 import org.dspace.authorize.AuthorizeException; 54 import org.dspace.core.ConfigurationManager; 55 import org.dspace.core.Context; 56 57 62 public class LicenseEditServlet extends DSpaceServlet 63 { 64 65 private static Logger log = Logger.getLogger(LicenseEditServlet.class); 66 67 71 protected void doDSGet(Context c, HttpServletRequest request, 72 HttpServletResponse response) throws ServletException , IOException , 73 SQLException , AuthorizeException 74 { 75 this.doDSPost(c, request, response); 77 } 78 79 82 protected void doDSPost(Context c, HttpServletRequest request, 83 HttpServletResponse response) throws ServletException , IOException , 84 SQLException , AuthorizeException 85 { 86 String button = UIUtil.getSubmitButton(request, "submit"); 88 89 if (button.equals("submit_cancel")) 90 { 91 JSPManager.showJSP(request, response, "/dspace-admin/index.jsp"); 93 } 94 else if (!button.equals("submit_save")) 95 { 96 String license = ConfigurationManager.getDefaultSubmissionLicense(); 98 99 request.setAttribute("license", license); 101 102 JSPManager.showJSP(request, response, "/dspace-admin/license-edit.jsp"); 104 } 105 else 106 { 107 String license = (String )request.getParameter("license"); 109 110 if (license.trim().equals("")) 112 { 113 license = ConfigurationManager.getDefaultSubmissionLicense(); 115 116 request.setAttribute("license", license); 118 119 request.setAttribute("empty", "true"); 121 122 JSPManager.showJSP(request, response, "/dspace-admin/license-edit.jsp"); 124 } 125 else 126 { 127 ConfigurationManager.writeLicenseFile(license); 129 130 request.setAttribute("license", license); 132 133 request.setAttribute("edited", "true"); 135 136 JSPManager.showJSP(request, response, "/dspace-admin/license-edit.jsp"); 138 } 139 } 140 } 141 } 142 | Popular Tags |