[MRM-773]

-update feed link url from the request url
-set query import in ArtifactsByRepositoryConstraint


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@653999 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2008-05-07 06:09:51 +00:00
parent 584bd356c2
commit 94799fd790
3 changed files with 29 additions and 29 deletions

View File

@ -44,11 +44,12 @@ public class ArtifactsByRepositoryConstraint
params = new Object[] { repoId };
}
public ArtifactsByRepositoryConstraint( String repoId, Date whenGathered, String sortColumn )
public ArtifactsByRepositoryConstraint( String repoId, Date targetWhenGathered, String sortColumn )
{
whereClause = "repositoryId == repoId && whenGathered >= whenGathered";
declParams = new String[] { "String repoId", "Date whenGathered" };
params = new Object[] { repoId, whenGathered };
declImports = new String[] { "import java.util.Date" };
whereClause = "this.repositoryId == repoId && this.whenGathered >= targetWhenGathered";
declParams = new String[] { "String repoId", "Date targetWhenGathered" };
params = new Object[] { repoId, targetWhenGathered };
this.sortColumn = sortColumn;
}

View File

@ -99,7 +99,6 @@ public class RssFeedServlet
public void doGet( HttpServletRequest req, HttpServletResponse res )
throws ServletException, IOException
{
log.info( "Request URL: " + req.getRequestURL() );
try
{
Map<String, String> map = new HashMap<String, String>();
@ -108,10 +107,9 @@ public class RssFeedServlet
String groupId = req.getParameter( "groupId" );
String artifactId = req.getParameter( "artifactId" );
if ( repoId != null )
if ( isAuthorized( req ) )
{
if ( isAuthorized( req ) )
if ( repoId != null )
{
// new artifacts in repo feed request
processor =
@ -120,15 +118,7 @@ public class RssFeedServlet
"new-artifacts" ) );
map.put( RssFeedProcessor.KEY_REPO_ID, repoId );
}
else
{
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, "Request is not authorized." );
return;
}
}
else if ( ( groupId != null ) && ( artifactId != null ) )
{
if ( isAuthorized( req ) )
else if ( ( groupId != null ) && ( artifactId != null ) )
{
// new versions of artifact feed request
processor =
@ -140,19 +130,28 @@ public class RssFeedServlet
}
else
{
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, "Request is not authorized." );
res.sendError( HttpServletResponse.SC_BAD_REQUEST, "Required fields not found in request." );
return;
}
}
else
{
res.sendError( HttpServletResponse.SC_BAD_REQUEST, "Required fields not found in request." );
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, "Request is not authorized." );
return;
}
feed = processor.process( map );
res.setContentType( MIME_TYPE );
if ( repoId != null )
{
feed.setLink( req.getRequestURL() + "?repoId=" + repoId );
}
else if ( ( groupId != null ) && ( artifactId != null ) )
{
feed.setLink( req.getRequestURL() + "?groupId=" + groupId + "&artifactId=" + artifactId );
}
SyndFeedOutput output = new SyndFeedOutput();
output.output( feed, res.getWriter() );
}

View File

@ -93,7 +93,7 @@
<servlet-mapping>
<servlet-name>RssFeedServlet</servlet-name>
<url-pattern>/rss/*</url-pattern>
<url-pattern>/rss/rss_feeds</url-pattern>
</servlet-mapping>
<servlet-mapping>