Project

General

Profile

« Previous | Next » 

Revision 8764

redirect "short form" metacat read URIs to the the new Metacat UI using the configured UI context. This translates the docid -> pid to use the correct identifier for the correct service. https://projects.ecoinformatics.org/ecoinfo/issues/6546

View differences:

MetaCatServlet.java
735 735
						skins[0] = skin;
736 736
						params.put("qformat", skins);
737 737
					}
738
					
739
					// attempt to redirect to metacatui (#view/{pid}) if not getting the raw XML
740
					// see: https://projects.ecoinformatics.org/ecoinfo/issues/6546
741
					if (!skin.equals("xml")) {
742
						String uiContext = PropertyService.getProperty("ui.context");
743
						String docidNoRev = DocumentUtil.getDocIdFromAccessionNumber(docidToRead);
744
						int rev = DocumentUtil.getRevisionFromAccessionNumber(docidToRead);
745
						String pid = null;
746
						try {
747
							pid = IdentifierManager.getInstance().getGUID(docidNoRev, rev);
748
							response.sendRedirect(SystemUtil.getServerURL() + "/" + uiContext + "/#view/" + pid );
749
							return;
750
						} catch (McdbDocNotFoundException nfe) {
751
							logMetacat.warn("Could not locate PID for docid: " + docidToRead, nfe);
752
						}
753
					}
754
					
755
					// otherwise carry on as usual
738 756
					handler.handleReadAction(params, request, response, "public", null, null);
739 757
					return;
740 758
				}

Also available in: Unified diff