GET
and POST
+ * methods.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ String persistentId = request.getParameter("persistentId");
+ if (persistentId != null) {
+ Dataset ds = datasetService.findByGlobalId(persistentId);
+ if (ds != null) {
+ if (StringUtil.isEmpty(ds.getOwner().getCitationRedirectURL())) {
+ response.sendRedirect("dataset.xhtml?persistentId=" + persistentId);
+ return;
+ } else {
+ response.sendRedirect("citation-frame.xhtml?persistentId=" + persistentId);
+ return;
+ }
+ }
+ }
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ // GET
method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Handles the HTTP POST
method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Returns a short description of the servlet.
+ *
+ * @return a String containing servlet description
+ */
+ @Override
+ public String getServletInfo() {
+ return "Servlet for redirecting requests from persistent identifier references.";
+ }//