@Test @ConditionalRun(RepositoryInstalled.GitInstalled.class) public void testGetRevisionLocation() { DummyHttpServletRequest req1 = new DummyHttpServletRequest() { @Override public String getPathInfo() { return "/git/main.c"; } @Override public String getContextPath() { return "source"; } @Override public String getQueryString() { return "a=true"; } }; PageConfig cfg = PageConfig.get(req1); String location = cfg.getRevisionLocation(cfg.getLatestRevision()); assertNotNull(location); assertEquals("source/xref/git/main.c?r=aa35c258&a=true", location); }
public String getRevisionLocation(String revStr) { StringBuilder sb = new StringBuilder(); sb.append(req.getContextPath()); sb.append(Prefix.XREF_P); sb.append(Util.URIEncodePath(getPath())); sb.append("?"); sb.append(QueryParameters.REVISION_PARAM_EQ); sb.append(Util.URIEncode(revStr)); if (req.getQueryString() != null) { sb.append("&"); sb.append(req.getQueryString()); } if (fragmentIdentifier != null) { String anchor = Util.URIEncode(fragmentIdentifier); String reqFrag = req.getParameter(QueryParameters.FRAGMENT_IDENTIFIER_PARAM); if (reqFrag == null || reqFrag.isEmpty()) { sb.append("&"); sb.append(QueryParameters.FRAGMENT_IDENTIFIER_PARAM_EQ); sb.append(anchor); } sb.append("#"); sb.append(anchor); } return sb.toString(); }
PageConfig { public String getRevisionLocation(String revStr) { StringBuilder sb = new StringBuilder(); sb.append(req.getContextPath()); sb.append(Prefix.XREF_P); sb.append(Util.URIEncodePath(getPath())); sb.append("?"); sb.append(QueryParameters.REVISION_PARAM_EQ); sb.append(Util.URIEncode(revStr)); if (req.getQueryString() != null) { sb.append("&"); sb.append(req.getQueryString()); } if (fragmentIdentifier != null) { String anchor = Util.URIEncode(fragmentIdentifier); String reqFrag = req.getParameter(QueryParameters.FRAGMENT_IDENTIFIER_PARAM); if (reqFrag == null || reqFrag.isEmpty()) { sb.append("&"); sb.append(QueryParameters.FRAGMENT_IDENTIFIER_PARAM_EQ); sb.append(anchor); } sb.append("#"); sb.append(anchor); } return sb.toString(); } }
PageConfig { public String getRevisionLocation(String revStr) { StringBuilder sb = new StringBuilder(); sb.append(req.getContextPath()); sb.append(Prefix.XREF_P); sb.append(Util.URIEncodePath(getPath())); sb.append("?"); sb.append(QueryParameters.REVISION_PARAM_EQ); sb.append(Util.URIEncode(revStr)); if (req.getQueryString() != null) { sb.append("&"); sb.append(req.getQueryString()); } if (fragmentIdentifier != null) { String anchor = Util.URIEncode(fragmentIdentifier); String reqFrag = req.getParameter(QueryParameters.FRAGMENT_IDENTIFIER_PARAM); if (reqFrag == null || reqFrag.isEmpty()) { sb.append("&"); sb.append(QueryParameters.FRAGMENT_IDENTIFIER_PARAM_EQ); sb.append(anchor); } sb.append("#"); sb.append(anchor); } return sb.toString(); } private  PageConfig(HttpServletRequest req); }
PageConfig { public String getRevisionLocation(String revStr) { StringBuilder sb = new StringBuilder(); sb.append(req.getContextPath()); sb.append(Prefix.XREF_P); sb.append(Util.URIEncodePath(getPath())); sb.append("?"); sb.append(QueryParameters.REVISION_PARAM_EQ); sb.append(Util.URIEncode(revStr)); if (req.getQueryString() != null) { sb.append("&"); sb.append(req.getQueryString()); } if (fragmentIdentifier != null) { String anchor = Util.URIEncode(fragmentIdentifier); String reqFrag = req.getParameter(QueryParameters.FRAGMENT_IDENTIFIER_PARAM); if (reqFrag == null || reqFrag.isEmpty()) { sb.append("&"); sb.append(QueryParameters.FRAGMENT_IDENTIFIER_PARAM_EQ); sb.append(anchor); } sb.append("#"); sb.append(anchor); } return sb.toString(); } private  PageConfig(HttpServletRequest req); void setRequestAttribute(String attr, Object val); Object getRequestAttribute(String attr); void removeAttribute(String string); void addHeaderData(String data); String getHeaderData(); DiffData getDiffData(); DiffType getDiffType(); boolean fullDiff(); String canProcess(); List<String> getResourceFileList(); long getLastModified(); String getHistoryDirs(); int getIntParam(String name, int defaultValue); int getSearchStart(); int getSearchMaxItems(); int getRevisionMessageCollapseThreshold(); int getCurrentIndexedCollapseThreshold(); int getGroupsCollapseThreshold(); List<SortOrder> getSortOrder(); QueryBuilder getQueryBuilder(); EftarFileReader getEftarReader(); String getDefineTagsIndex(); String getRequestedRevision(); boolean hasHistory(); boolean hasAnnotations(); boolean annotate(); Annotation getAnnotation(); String[] getSearchOnlyIn(); Project getProject(); String getRequestedProjectsAsString(); SortedSet<String> getRequestedProjects(); List<String> getCookieVals(String cookieName); ProjectHelper getProjectHelper(); void setTitle(String title); String getTitle(); String getCssDir(); RuntimeEnvironment getEnv(); IgnoredNames getIgnoredNames(); String getSourceRootPath(); Prefix getPrefix(); String getPath(); File getResourceFile(String path); File getResourceFile(); String getResourcePath(); boolean resourceNotAvailable(); boolean isDir(); File[] findDataFiles(List<String> filenames); File findDataFile(); String getLatestRevision(); boolean isLatestRevision(String rev); String getRevisionLocation(String revStr); String getDirectoryRedirect(); String getUriEncodedPath(); PageConfig addScript(String name); Scripts getScripts(); File getDataRoot(); SearchHelper prepareSearch(); SearchHelper prepareInternalSearch(); static PageConfig get(HttpServletRequest request); static void cleanup(ServletRequest sr); boolean isAllowed(Project t); boolean isAllowed(Group g); SortedSet<AcceptedMessage> getMessages(); SortedSet<AcceptedMessage> getMessages(String tag); String getShortPath(String path); String getSearchTitle(); String getHistoryTitle(); String getPathTitle(); void checkSourceRootExistence(); boolean isNotModified(HttpServletRequest request, HttpServletResponse response); static String getRelativePath(String root, String path); boolean evaluateMatchOffset(); }
PageConfig { public String getRevisionLocation(String revStr) { StringBuilder sb = new StringBuilder(); sb.append(req.getContextPath()); sb.append(Prefix.XREF_P); sb.append(Util.URIEncodePath(getPath())); sb.append("?"); sb.append(QueryParameters.REVISION_PARAM_EQ); sb.append(Util.URIEncode(revStr)); if (req.getQueryString() != null) { sb.append("&"); sb.append(req.getQueryString()); } if (fragmentIdentifier != null) { String anchor = Util.URIEncode(fragmentIdentifier); String reqFrag = req.getParameter(QueryParameters.FRAGMENT_IDENTIFIER_PARAM); if (reqFrag == null || reqFrag.isEmpty()) { sb.append("&"); sb.append(QueryParameters.FRAGMENT_IDENTIFIER_PARAM_EQ); sb.append(anchor); } sb.append("#"); sb.append(anchor); } return sb.toString(); } private  PageConfig(HttpServletRequest req); void setRequestAttribute(String attr, Object val); Object getRequestAttribute(String attr); void removeAttribute(String string); void addHeaderData(String data); String getHeaderData(); DiffData getDiffData(); DiffType getDiffType(); boolean fullDiff(); String canProcess(); List<String> getResourceFileList(); long getLastModified(); String getHistoryDirs(); int getIntParam(String name, int defaultValue); int getSearchStart(); int getSearchMaxItems(); int getRevisionMessageCollapseThreshold(); int getCurrentIndexedCollapseThreshold(); int getGroupsCollapseThreshold(); List<SortOrder> getSortOrder(); QueryBuilder getQueryBuilder(); EftarFileReader getEftarReader(); String getDefineTagsIndex(); String getRequestedRevision(); boolean hasHistory(); boolean hasAnnotations(); boolean annotate(); Annotation getAnnotation(); String[] getSearchOnlyIn(); Project getProject(); String getRequestedProjectsAsString(); SortedSet<String> getRequestedProjects(); List<String> getCookieVals(String cookieName); ProjectHelper getProjectHelper(); void setTitle(String title); String getTitle(); String getCssDir(); RuntimeEnvironment getEnv(); IgnoredNames getIgnoredNames(); String getSourceRootPath(); Prefix getPrefix(); String getPath(); File getResourceFile(String path); File getResourceFile(); String getResourcePath(); boolean resourceNotAvailable(); boolean isDir(); File[] findDataFiles(List<String> filenames); File findDataFile(); String getLatestRevision(); boolean isLatestRevision(String rev); String getRevisionLocation(String revStr); String getDirectoryRedirect(); String getUriEncodedPath(); PageConfig addScript(String name); Scripts getScripts(); File getDataRoot(); SearchHelper prepareSearch(); SearchHelper prepareInternalSearch(); static PageConfig get(HttpServletRequest request); static void cleanup(ServletRequest sr); boolean isAllowed(Project t); boolean isAllowed(Group g); SortedSet<AcceptedMessage> getMessages(); SortedSet<AcceptedMessage> getMessages(String tag); String getShortPath(String path); String getSearchTitle(); String getHistoryTitle(); String getPathTitle(); void checkSourceRootExistence(); boolean isNotModified(HttpServletRequest request, HttpServletResponse response); static String getRelativePath(String root, String path); boolean evaluateMatchOffset(); static final String OPEN_GROK_PROJECT; }