@Test public void testGetDocumentViewFromUrlWithJSessionId() { DocumentIdCodec codec = new DocumentIdCodec(); String url = "nxdoc/demo/dbefd5a0-35ee-4ed2-a023-6817714f32cf/view_documents;jsessionid=7CD6F2222BB08134A57BD2098DA16B2C.nuxeo?tabId=TAB_CONTENT"; DocumentView docView = codec.getDocumentViewFromUrl(url); assertNotNull(docView); DocumentLocation docLoc = docView.getDocumentLocation(); assertEquals("demo", docLoc.getServerName()); assertEquals("view_documents", docView.getViewId()); Map<String, String> params = docView.getParameters(); assertEquals("TAB_CONTENT", params.get("tabId")); }
@Override public DocumentView getDocumentViewFromUrl(String url) { final Pattern pattern = Pattern.compile(getPrefix() + URLPattern); Matcher m = pattern.matcher(url); if (m.matches()) { if (m.groupCount() >= 4) { final String server = m.group(1); String uuid = m.group(2); final DocumentRef docRef = new IdRef(uuid); String viewId = m.group(4); if (viewId != null) { int jsessionidIndex = viewId.indexOf(";jsessionid"); if (jsessionidIndex != -1) { viewId = viewId.substring(0, jsessionidIndex); } } Map<String, String> params = null; if (m.groupCount() > 6) { String query = m.group(7); params = URIUtils.getRequestParameters(query); } final DocumentLocation docLoc = new DocumentLocationImpl(server, docRef); return new DocumentViewImpl(docLoc, viewId, params); } } return null; }
DocumentIdCodec extends AbstractDocumentViewCodec { @Override public DocumentView getDocumentViewFromUrl(String url) { final Pattern pattern = Pattern.compile(getPrefix() + URLPattern); Matcher m = pattern.matcher(url); if (m.matches()) { if (m.groupCount() >= 4) { final String server = m.group(1); String uuid = m.group(2); final DocumentRef docRef = new IdRef(uuid); String viewId = m.group(4); if (viewId != null) { int jsessionidIndex = viewId.indexOf(";jsessionid"); if (jsessionidIndex != -1) { viewId = viewId.substring(0, jsessionidIndex); } } Map<String, String> params = null; if (m.groupCount() > 6) { String query = m.group(7); params = URIUtils.getRequestParameters(query); } final DocumentLocation docLoc = new DocumentLocationImpl(server, docRef); return new DocumentViewImpl(docLoc, viewId, params); } } return null; } }
DocumentIdCodec extends AbstractDocumentViewCodec { @Override public DocumentView getDocumentViewFromUrl(String url) { final Pattern pattern = Pattern.compile(getPrefix() + URLPattern); Matcher m = pattern.matcher(url); if (m.matches()) { if (m.groupCount() >= 4) { final String server = m.group(1); String uuid = m.group(2); final DocumentRef docRef = new IdRef(uuid); String viewId = m.group(4); if (viewId != null) { int jsessionidIndex = viewId.indexOf(";jsessionid"); if (jsessionidIndex != -1) { viewId = viewId.substring(0, jsessionidIndex); } } Map<String, String> params = null; if (m.groupCount() > 6) { String query = m.group(7); params = URIUtils.getRequestParameters(query); } final DocumentLocation docLoc = new DocumentLocationImpl(server, docRef); return new DocumentViewImpl(docLoc, viewId, params); } } return null; } DocumentIdCodec();  DocumentIdCodec(String prefix); }
DocumentIdCodec extends AbstractDocumentViewCodec { @Override public DocumentView getDocumentViewFromUrl(String url) { final Pattern pattern = Pattern.compile(getPrefix() + URLPattern); Matcher m = pattern.matcher(url); if (m.matches()) { if (m.groupCount() >= 4) { final String server = m.group(1); String uuid = m.group(2); final DocumentRef docRef = new IdRef(uuid); String viewId = m.group(4); if (viewId != null) { int jsessionidIndex = viewId.indexOf(";jsessionid"); if (jsessionidIndex != -1) { viewId = viewId.substring(0, jsessionidIndex); } } Map<String, String> params = null; if (m.groupCount() > 6) { String query = m.group(7); params = URIUtils.getRequestParameters(query); } final DocumentLocation docLoc = new DocumentLocationImpl(server, docRef); return new DocumentViewImpl(docLoc, viewId, params); } } return null; } DocumentIdCodec();  DocumentIdCodec(String prefix); @Override String getPrefix(); @Override String getUrlFromDocumentView(DocumentView docView); @Override DocumentView getDocumentViewFromUrl(String url); }
DocumentIdCodec extends AbstractDocumentViewCodec { @Override public DocumentView getDocumentViewFromUrl(String url) { final Pattern pattern = Pattern.compile(getPrefix() + URLPattern); Matcher m = pattern.matcher(url); if (m.matches()) { if (m.groupCount() >= 4) { final String server = m.group(1); String uuid = m.group(2); final DocumentRef docRef = new IdRef(uuid); String viewId = m.group(4); if (viewId != null) { int jsessionidIndex = viewId.indexOf(";jsessionid"); if (jsessionidIndex != -1) { viewId = viewId.substring(0, jsessionidIndex); } } Map<String, String> params = null; if (m.groupCount() > 6) { String query = m.group(7); params = URIUtils.getRequestParameters(query); } final DocumentLocation docLoc = new DocumentLocationImpl(server, docRef); return new DocumentViewImpl(docLoc, viewId, params); } } return null; } DocumentIdCodec();  DocumentIdCodec(String prefix); @Override String getPrefix(); @Override String getUrlFromDocumentView(DocumentView docView); @Override DocumentView getDocumentViewFromUrl(String url); static final String PREFIX; static final String URLPattern; }