use of com.gitblit.models.UserModel in project gitblit by gitblit.
the class TicketNotifier method formatLastChange.
protected String formatLastChange(TicketModel ticket) {
Change lastChange = ticket.changes.get(ticket.changes.size() - 1);
UserModel user = getUserModel(lastChange.author);
// define the fields we do NOT want to see in an email notification
Set<TicketModel.Field> fieldExclusions = new HashSet<TicketModel.Field>();
fieldExclusions.addAll(Arrays.asList(Field.watchers, Field.voters));
StringBuilder sb = new StringBuilder();
boolean newTicket = lastChange.isStatusChange() && Status.New == lastChange.getStatus();
boolean isFastForward = true;
List<RevCommit> commits = null;
DiffStat diffstat = null;
String pattern;
if (lastChange.hasPatchset()) {
// patchset uploaded
Patchset patchset = lastChange.patchset;
String base = "";
// determine the changed paths
Repository repo = null;
try {
repo = repositoryManager.getRepository(ticket.repository);
if (patchset.isFF() && (patchset.rev > 1)) {
// fast-forward update, just show the new data
isFastForward = true;
Patchset prev = ticket.getPatchset(patchset.number, patchset.rev - 1);
base = prev.tip;
} else {
// proposal OR non-fast-forward update
isFastForward = false;
base = patchset.base;
}
diffstat = DiffUtils.getDiffStat(repo, base, patchset.tip);
commits = JGitUtils.getRevLog(repo, base, patchset.tip);
} catch (Exception e) {
Logger.getLogger(getClass()).error("failed to get changed paths", e);
} finally {
if (repo != null) {
repo.close();
}
}
String compareUrl = ticketService.getCompareUrl(ticket, base, patchset.tip);
if (newTicket) {
// new proposal
pattern = "**{0}** is proposing a change.";
sb.append(MessageFormat.format(pattern, user.getDisplayName()));
fieldExclusions.add(Field.status);
fieldExclusions.add(Field.title);
fieldExclusions.add(Field.body);
} else {
// describe the patchset
if (patchset.isFF()) {
pattern = "**{0}** added {1} {2} to patchset {3}.";
sb.append(MessageFormat.format(pattern, user.getDisplayName(), patchset.added, patchset.added == 1 ? "commit" : "commits", patchset.number));
} else {
pattern = "**{0}** uploaded patchset {1}. *({2})*";
sb.append(MessageFormat.format(pattern, user.getDisplayName(), patchset.number, patchset.type.toString().toUpperCase()));
}
}
sb.append(HARD_BRK);
sb.append(MessageFormat.format("{0} {1}, {2} {3}, <span style=\"color:darkgreen;\">+{4} insertions</span>, <span style=\"color:darkred;\">-{5} deletions</span> from {6}. [compare]({7})", commits.size(), commits.size() == 1 ? "commit" : "commits", diffstat.paths.size(), diffstat.paths.size() == 1 ? "file" : "files", diffstat.getInsertions(), diffstat.getDeletions(), isFastForward ? "previous revision" : "merge base", compareUrl));
// note commit additions on a rebase,if any
switch(lastChange.patchset.type) {
case Rebase:
if (lastChange.patchset.added > 0) {
sb.append(SOFT_BRK);
sb.append(MessageFormat.format("{0} {1} added.", lastChange.patchset.added, lastChange.patchset.added == 1 ? "commit" : "commits"));
}
break;
default:
break;
}
sb.append(HARD_BRK);
} else if (lastChange.isStatusChange()) {
if (newTicket) {
fieldExclusions.add(Field.status);
fieldExclusions.add(Field.title);
fieldExclusions.add(Field.body);
pattern = "**{0}** created this ticket.";
sb.append(MessageFormat.format(pattern, user.getDisplayName()));
} else if (lastChange.hasField(Field.mergeSha)) {
// closed by merged
pattern = "**{0}** closed this ticket by merging {1} to {2}.";
// identify patchset that closed the ticket
String merged = ticket.mergeSha;
for (Patchset patchset : ticket.getPatchsets()) {
if (patchset.tip.equals(ticket.mergeSha)) {
merged = patchset.toString();
break;
}
}
sb.append(MessageFormat.format(pattern, user.getDisplayName(), merged, ticket.mergeTo));
} else {
// workflow status change by user
pattern = "**{0}** changed the status of this ticket to **{1}**.";
sb.append(MessageFormat.format(pattern, user.getDisplayName(), lastChange.getStatus().toString().toUpperCase()));
}
sb.append(HARD_BRK);
} else if (lastChange.hasReview()) {
// review
Review review = lastChange.review;
pattern = "**{0}** has reviewed patchset {1,number,0} revision {2,number,0}.";
sb.append(MessageFormat.format(pattern, user.getDisplayName(), review.patchset, review.rev));
sb.append(HARD_BRK);
String d = settings.getString(Keys.web.datestampShortFormat, "yyyy-MM-dd");
String t = settings.getString(Keys.web.timeFormat, "HH:mm");
DateFormat df = new SimpleDateFormat(d + " " + t);
List<Change> reviews = ticket.getReviews(ticket.getPatchset(review.patchset, review.rev));
sb.append("| Date | Reviewer | Score | Description |\n");
sb.append("| :--- | :------------ | :---: | :----------- |\n");
for (Change change : reviews) {
String name = change.author;
UserModel u = userManager.getUserModel(change.author);
if (u != null) {
name = u.getDisplayName();
}
String score;
switch(change.review.score) {
case approved:
score = MessageFormat.format(addPattern, change.review.score.getValue());
break;
case vetoed:
score = MessageFormat.format(delPattern, Math.abs(change.review.score.getValue()));
break;
default:
score = "" + change.review.score.getValue();
}
String date = df.format(change.date);
sb.append(String.format("| %1$s | %2$s | %3$s | %4$s |\n", date, name, score, change.review.score.toString()));
}
sb.append(HARD_BRK);
} else if (lastChange.hasComment()) {
// comment update
sb.append(MessageFormat.format("**{0}** commented on this ticket.", user.getDisplayName()));
sb.append(HARD_BRK);
} else if (lastChange.hasReference()) {
// reference update
String type = "?";
switch(lastChange.reference.getSourceType()) {
case Commit:
{
type = "commit";
}
break;
case Ticket:
{
type = "ticket";
}
break;
default:
{
}
break;
}
sb.append(MessageFormat.format("**{0}** referenced this ticket in {1} {2}", type, lastChange.toString()));
sb.append(HARD_BRK);
} else {
// general update
pattern = "**{0}** has updated this ticket.";
sb.append(MessageFormat.format(pattern, user.getDisplayName()));
sb.append(HARD_BRK);
}
// ticket link
sb.append(MessageFormat.format("[view ticket {0,number,0}]({1})", ticket.number, ticketService.getTicketUrl(ticket)));
sb.append(HARD_BRK);
if (newTicket) {
// ticket title
sb.append(MessageFormat.format("### {0}", ticket.title));
sb.append(HARD_BRK);
// ticket description, on state change
if (StringUtils.isEmpty(ticket.body)) {
sb.append("<span style=\"color: #888;\">no description entered</span>");
} else {
sb.append(ticket.body);
}
sb.append(HARD_BRK);
sb.append(HR);
}
// field changes
if (lastChange.hasFieldChanges()) {
Map<Field, String> filtered = new HashMap<Field, String>();
for (Map.Entry<Field, String> fc : lastChange.fields.entrySet()) {
if (!fieldExclusions.contains(fc.getKey())) {
// field is included
filtered.put(fc.getKey(), fc.getValue());
}
}
// sort by field ordinal
List<Field> fields = new ArrayList<Field>(filtered.keySet());
Collections.sort(fields);
if (filtered.size() > 0) {
sb.append(HARD_BRK);
sb.append("| Field Changes ||\n");
sb.append("| ------------: | :----------- |\n");
for (Field field : fields) {
String value;
if (filtered.get(field) == null) {
value = "";
} else {
value = filtered.get(field).replace("\r\n", "<br/>").replace("\n", "<br/>").replace("|", "|");
}
sb.append(String.format("| **%1$s:** | %2$s |\n", field.name(), value));
}
sb.append(HARD_BRK);
}
}
// new comment
if (lastChange.hasComment()) {
sb.append(HR);
sb.append(lastChange.comment.text);
sb.append(HARD_BRK);
}
// insert the patchset details and review instructions
if (lastChange.hasPatchset() && ticket.isOpen()) {
if (commits != null && commits.size() > 0) {
// append the commit list
String title = isFastForward ? "Commits added to previous patchset revision" : "All commits in patchset";
sb.append(MessageFormat.format("| {0} |||\n", title));
sb.append("| SHA | Author | Title |\n");
sb.append("| :-- | :----- | :---- |\n");
for (RevCommit commit : commits) {
sb.append(MessageFormat.format("| {0} | {1} | {2} |\n", commit.getName(), commit.getAuthorIdent().getName(), StringUtils.trimString(commit.getShortMessage(), Constants.LEN_SHORTLOG).replace("|", "|")));
}
sb.append(HARD_BRK);
}
if (diffstat != null) {
// append the changed path list
String title = isFastForward ? "Files changed since previous patchset revision" : "All files changed in patchset";
sb.append(MessageFormat.format("| {0} |||\n", title));
sb.append("| :-- | :----------- | :-: |\n");
for (PathChangeModel path : diffstat.paths) {
String add = MessageFormat.format(addPattern, path.insertions);
String del = MessageFormat.format(delPattern, path.deletions);
String diff = null;
switch(path.changeType) {
case ADD:
diff = add;
break;
case DELETE:
diff = del;
break;
case MODIFY:
if (path.insertions > 0 && path.deletions > 0) {
// insertions & deletions
diff = add + "/" + del;
} else if (path.insertions > 0) {
// just insertions
diff = add;
} else {
// just deletions
diff = del;
}
break;
default:
diff = path.changeType.name();
break;
}
sb.append(MessageFormat.format("| {0} | {1} | {2} |\n", getChangeType(path.changeType), path.name, diff));
}
sb.append(HARD_BRK);
}
sb.append(formatPatchsetInstructions(ticket, lastChange.patchset));
}
return sb.toString();
}
use of com.gitblit.models.UserModel in project gitblit by gitblit.
the class EnforceAuthenticationFilter method doFilter.
/*
* This does the actual filtering: is the user authenticated? If not, enforce HTTP authentication (401)
*
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
*/
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
Boolean mustForceAuth = settings.getBoolean(Keys.web.authenticateViewPages, false) && settings.getBoolean(Keys.web.enforceHttpBasicAuthentication, false);
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
UserModel user = authenticationManager.authenticate(httpRequest);
if (mustForceAuth && (user == null)) {
// not authenticated, enforce now:
logger.debug(MessageFormat.format("EnforceAuthFilter: user not authenticated for URL {0}!", request.toString()));
String challenge = MessageFormat.format("Basic realm=\"{0}\"", settings.getString(Keys.web.siteName, ""));
httpResponse.setHeader("WWW-Authenticate", challenge);
httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED);
return;
} else {
// user is authenticated, or don't care, continue handling
chain.doFilter(request, response);
}
}
use of com.gitblit.models.UserModel in project gitblit by gitblit.
the class SparkleShareInviteServlet method processRequest.
protected void processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
int sshPort = settings.getInteger(Keys.git.sshPort, 0);
if (sshPort == 0) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
response.getWriter().append("SSH is not active on this server!");
return;
}
int sshDisplayPort = settings.getInteger(Keys.git.sshAdvertisedPort, sshPort);
// extract repo name from request
String repoUrl = request.getPathInfo().substring(1);
// trim trailing .xml
if (repoUrl.endsWith(".xml")) {
repoUrl = repoUrl.substring(0, repoUrl.length() - 4);
}
String username = null;
String path;
int fetchIndex = repoUrl.indexOf('@');
if (fetchIndex > -1) {
username = repoUrl.substring(0, fetchIndex);
path = repoUrl.substring(fetchIndex + 1);
} else {
path = repoUrl;
}
String host = request.getServerName();
String url = settings.getString(Keys.web.canonicalUrl, "https://localhost:8443");
if (!StringUtils.isEmpty(url) && url.indexOf("localhost") == -1) {
host = new URL(url).getHost();
}
String sshDisplayHost = settings.getString(Keys.git.sshAdvertisedHost, "");
if (sshDisplayHost.isEmpty()) {
sshDisplayHost = host;
}
UserModel user;
if (StringUtils.isEmpty(username)) {
user = authenticationManager.authenticate(request);
} else {
user = userManager.getUserModel(username);
}
if (user == null || user.disabled) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
response.getWriter().append("Access is not permitted!");
return;
}
// ensure that the requested repository exists
RepositoryModel model = repositoryManager.getRepositoryModel(path);
if (model == null) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
response.getWriter().append(MessageFormat.format("Repository \"{0}\" not found!", path));
return;
}
if (!user.canRewindRef(model)) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
response.getWriter().append(MessageFormat.format("{0} does not have RW+ permissions to \"{1}\"!", user.username, model.name));
}
StringBuilder sb = new StringBuilder();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
sb.append("<sparkleshare><invite>\n");
sb.append(MessageFormat.format("<address>ssh://{0}@{1}:{2,number,0}/</address>\n", user.username, sshDisplayHost, sshDisplayPort));
sb.append(MessageFormat.format("<remote_path>/{0}</remote_path>\n", model.name));
int fanoutPort = settings.getInteger(Keys.fanout.port, 0);
if (fanoutPort > 0) {
// Gitblit is running it's own fanout service for pubsub notifications
sb.append(MessageFormat.format("<announcements_url>tcp://{0}:{1,number,0}</announcements_url>\n", request.getServerName(), fanoutPort));
}
sb.append("</invite></sparkleshare>\n");
// write invite to client
response.setContentType("application/xml");
response.setContentLength(sb.length());
response.getWriter().append(sb.toString());
}
use of com.gitblit.models.UserModel in project gitblit by gitblit.
the class SyndicationFilter method doFilter.
/**
* doFilter does the actual work of preprocessing the request to ensure that
* the user may proceed.
*
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
* javax.servlet.ServletResponse, javax.servlet.FilterChain)
*/
@Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
String fullUrl = getFullUrl(httpRequest);
String name = extractRequestedName(fullUrl);
ProjectModel project = projectManager.getProjectModel(name);
RepositoryModel model = null;
if (project == null) {
// try loading a repository model
model = repositoryManager.getRepositoryModel(name);
if (model == null) {
// repository not found. send 404.
logger.info(MessageFormat.format("ARF: {0} ({1})", fullUrl, HttpServletResponse.SC_NOT_FOUND));
httpResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
}
// Wrap the HttpServletRequest with the AccessRestrictionRequest which
// overrides the servlet container user principal methods.
// JGit requires either:
//
// 1. servlet container authenticated user
// 2. http.receivepack = true in each repository's config
//
// Gitblit must conditionally authenticate users per-repository so just
// enabling http.receivepack is insufficient.
AuthenticatedRequest authenticatedRequest = new AuthenticatedRequest(httpRequest);
UserModel user = getUser(httpRequest);
if (user != null) {
authenticatedRequest.setUser(user);
}
// BASIC authentication challenge and response processing
if (model != null) {
if (model.accessRestriction.atLeast(AccessRestrictionType.VIEW)) {
if (user == null) {
// challenge client to provide credentials. send 401.
if (runtimeManager.isDebugMode()) {
logger.info(MessageFormat.format("ARF: CHALLENGE {0}", fullUrl));
}
httpResponse.setHeader("WWW-Authenticate", CHALLENGE);
httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED);
return;
} else {
// check user access for request
if (user.canView(model)) {
// authenticated request permitted.
// pass processing to the restricted servlet.
newSession(authenticatedRequest, httpResponse);
logger.info(MessageFormat.format("ARF: {0} ({1}) authenticated", fullUrl, HttpServletResponse.SC_CONTINUE));
chain.doFilter(authenticatedRequest, httpResponse);
return;
}
// valid user, but not for requested access. send 403.
if (runtimeManager.isDebugMode()) {
logger.info(MessageFormat.format("ARF: {0} forbidden to access {1}", user.username, fullUrl));
}
httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN);
return;
}
}
}
if (runtimeManager.isDebugMode()) {
logger.info(MessageFormat.format("ARF: {0} ({1}) unauthenticated", fullUrl, HttpServletResponse.SC_CONTINUE));
}
// unauthenticated request permitted.
// pass processing to the restricted servlet.
chain.doFilter(authenticatedRequest, httpResponse);
}
use of com.gitblit.models.UserModel in project gitblit by gitblit.
the class SyndicationServlet method processRequest.
/**
* Generates the feed content.
*
* @param request
* @param response
* @throws javax.servlet.ServletException
* @throws java.io.IOException
*/
private void processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
String servletUrl = request.getContextPath() + request.getServletPath();
String url = request.getRequestURI().substring(servletUrl.length());
if (url.length() > 1 && url.charAt(0) == '/') {
url = url.substring(1);
}
String repositoryName = url;
String objectId = request.getParameter("h");
String l = request.getParameter("l");
String page = request.getParameter("pg");
String searchString = request.getParameter("s");
Constants.SearchType searchType = Constants.SearchType.COMMIT;
if (!StringUtils.isEmpty(request.getParameter("st"))) {
Constants.SearchType type = Constants.SearchType.forName(request.getParameter("st"));
if (type != null) {
searchType = type;
}
}
Constants.FeedObjectType objectType = Constants.FeedObjectType.COMMIT;
if (!StringUtils.isEmpty(request.getParameter("ot"))) {
Constants.FeedObjectType type = Constants.FeedObjectType.forName(request.getParameter("ot"));
if (type != null) {
objectType = type;
}
}
int length = settings.getInteger(Keys.web.syndicationEntries, 25);
if (StringUtils.isEmpty(objectId)) {
objectId = org.eclipse.jgit.lib.Constants.HEAD;
}
if (!StringUtils.isEmpty(l)) {
try {
length = Integer.parseInt(l);
} catch (NumberFormatException x) {
}
}
int offset = 0;
if (!StringUtils.isEmpty(page)) {
try {
offset = length * Integer.parseInt(page);
} catch (NumberFormatException x) {
}
}
response.setContentType("application/rss+xml; charset=UTF-8");
boolean isProjectFeed = false;
String feedName = "Gitblit";
String feedTitle = null;
String feedDescription = null;
List<String> repositories = null;
if (repositoryName.indexOf('/') == -1 && !repositoryName.toLowerCase().endsWith(".git")) {
// try to find a project
UserModel user = null;
if (request instanceof AuthenticatedRequest) {
user = ((AuthenticatedRequest) request).getUser();
}
ProjectModel project = projectManager.getProjectModel(repositoryName, user);
if (project != null) {
isProjectFeed = true;
repositories = new ArrayList<String>(project.repositories);
// project feed
feedName = project.name;
feedTitle = project.title;
feedDescription = project.description;
}
}
if (repositories == null) {
// could not find project, assume this is a repository
repositories = Arrays.asList(repositoryName);
}
boolean mountParameters = settings.getBoolean(Keys.web.mountParameters, true);
String gitblitUrl = settings.getString(Keys.web.canonicalUrl, null);
if (StringUtils.isEmpty(gitblitUrl)) {
gitblitUrl = HttpUtils.getGitblitURL(request);
}
char fsc = settings.getChar(Keys.web.forwardSlashCharacter, '/');
List<FeedEntryModel> entries = new ArrayList<FeedEntryModel>();
for (String name : repositories) {
Repository repository = repositoryManager.getRepository(name);
RepositoryModel model = repositoryManager.getRepositoryModel(name);
if (repository == null) {
if (model != null && model.isCollectingGarbage) {
logger.warn(MessageFormat.format("Temporarily excluding {0} from feed, busy collecting garbage", name));
}
continue;
}
if (!isProjectFeed) {
// single-repository feed
feedName = model.name;
feedTitle = model.name;
feedDescription = model.description;
}
if (objectType == Constants.FeedObjectType.TAG) {
String urlPattern;
if (mountParameters) {
// mounted parameters
urlPattern = "{0}/tag/{1}/{2}";
} else {
// parameterized parameters
urlPattern = "{0}/tag/?r={1}&h={2}";
}
List<RefModel> tags = JGitUtils.getTags(repository, false, length, offset);
for (RefModel tag : tags) {
FeedEntryModel entry = new FeedEntryModel();
entry.title = tag.getName();
entry.author = tag.getAuthorIdent().getName();
entry.link = MessageFormat.format(urlPattern, gitblitUrl, StringUtils.encodeURL(model.name.replace('/', fsc)), tag.getObjectId().getName());
entry.published = tag.getDate();
entry.contentType = "text/html";
entry.content = tag.getFullMessage();
entry.repository = model.name;
entry.branch = objectId;
entry.tags = new ArrayList<String>();
// add tag id and referenced commit id
entry.tags.add("tag:" + tag.getObjectId().getName());
entry.tags.add("commit:" + tag.getReferencedObjectId().getName());
entries.add(entry);
}
} else {
String urlPattern;
if (mountParameters) {
// mounted parameters
urlPattern = "{0}/commit/{1}/{2}";
} else {
// parameterized parameters
urlPattern = "{0}/commit/?r={1}&h={2}";
}
List<RevCommit> commits;
if (StringUtils.isEmpty(searchString)) {
// standard log/history lookup
commits = JGitUtils.getRevLog(repository, objectId, offset, length);
} else {
// repository search
commits = JGitUtils.searchRevlogs(repository, objectId, searchString, searchType, offset, length);
}
Map<ObjectId, List<RefModel>> allRefs = JGitUtils.getAllRefs(repository, model.showRemoteBranches);
BugtraqProcessor processor = new BugtraqProcessor(settings);
// convert RevCommit to SyndicatedEntryModel
for (RevCommit commit : commits) {
FeedEntryModel entry = new FeedEntryModel();
entry.title = commit.getShortMessage();
entry.author = commit.getAuthorIdent().getName();
entry.link = MessageFormat.format(urlPattern, gitblitUrl, StringUtils.encodeURL(model.name.replace('/', fsc)), commit.getName());
entry.published = commit.getCommitterIdent().getWhen();
entry.contentType = "text/html";
String message = processor.processCommitMessage(repository, model, commit.getFullMessage());
entry.content = message;
entry.repository = model.name;
entry.branch = objectId;
entry.tags = new ArrayList<String>();
// add commit id and parent commit ids
entry.tags.add("commit:" + commit.getName());
for (RevCommit parent : commit.getParents()) {
entry.tags.add("parent:" + parent.getName());
}
// add refs to tabs list
List<RefModel> refs = allRefs.get(commit.getId());
if (refs != null && refs.size() > 0) {
for (RefModel ref : refs) {
entry.tags.add("ref:" + ref.getName());
}
}
entries.add(entry);
}
}
}
// sort & truncate the feed
Collections.sort(entries);
if (entries.size() > length) {
// clip the list
entries = entries.subList(0, length);
}
String feedLink;
if (isProjectFeed) {
// project feed
if (mountParameters) {
// mounted url
feedLink = MessageFormat.format("{0}/project/{1}", gitblitUrl, StringUtils.encodeURL(feedName));
} else {
// parameterized url
feedLink = MessageFormat.format("{0}/project/?p={1}", gitblitUrl, StringUtils.encodeURL(feedName));
}
} else {
// repository feed
if (mountParameters) {
// mounted url
feedLink = MessageFormat.format("{0}/summary/{1}", gitblitUrl, StringUtils.encodeURL(feedName.replace('/', fsc)));
} else {
// parameterized url
feedLink = MessageFormat.format("{0}/summary/?r={1}", gitblitUrl, StringUtils.encodeURL(feedName));
}
}
try {
SyndicationUtils.toRSS(gitblitUrl, feedLink, getTitle(feedTitle, objectId), feedDescription, entries, response.getOutputStream());
} catch (Exception e) {
logger.error("An error occurred during feed generation", e);
}
}
Aggregations