| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
package net.sourceforge.pebble.web.action; |
| 33 |
|
|
| 34 |
|
import net.sourceforge.pebble.Constants; |
| 35 |
|
import net.sourceforge.pebble.PebbleContext; |
| 36 |
|
import net.sourceforge.pebble.domain.Blog; |
| 37 |
|
import net.sourceforge.pebble.security.PebbleUserDetails; |
| 38 |
|
import net.sourceforge.pebble.security.SecurityRealm; |
| 39 |
|
import net.sourceforge.pebble.security.SecurityRealmException; |
| 40 |
|
import net.sourceforge.pebble.web.view.NotFoundView; |
| 41 |
|
import net.sourceforge.pebble.web.view.View; |
| 42 |
|
import net.sourceforge.pebble.web.view.impl.AboutAuthorView; |
| 43 |
|
import org.apache.commons.logging.Log; |
| 44 |
|
import org.apache.commons.logging.LogFactory; |
| 45 |
|
|
| 46 |
|
import javax.servlet.ServletException; |
| 47 |
|
import javax.servlet.http.HttpServletRequest; |
| 48 |
|
import javax.servlet.http.HttpServletResponse; |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
@author |
| 54 |
|
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0,27 |
|
| 55 |
|
public class AboutAuthorAction extends Action { |
| 56 |
|
|
| 57 |
|
private static final Log log = LogFactory.getLog(AboutAuthorAction.class); |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
@param |
| 63 |
|
@param |
| 64 |
|
@return |
| 65 |
|
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0,27 |
|
| 66 |
0
|
public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {... |
| 67 |
0
|
Blog blog = (Blog)getModel().get(Constants.BLOG_KEY); |
| 68 |
0
|
String username = request.getParameter("user"); |
| 69 |
0
|
SecurityRealm realm = PebbleContext.getInstance().getConfiguration().getSecurityRealm(); |
| 70 |
0
|
try { |
| 71 |
0
|
PebbleUserDetails user = realm.getUser(username); |
| 72 |
0
|
if (user != null) { |
| 73 |
0
|
getModel().put(Constants.USER_KEY, user); |
| 74 |
0
|
getModel().put(Constants.BLOG_ENTRIES, blog.getRecentPublishedBlogEntries(username)); |
| 75 |
0
|
return new AboutAuthorView(); |
| 76 |
|
} |
| 77 |
|
} catch (SecurityRealmException e) { |
| 78 |
0
|
log.error(e); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
0
|
return new NotFoundView(); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
} |