Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.AbstractBlog


   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    AbstractBlog blog = (AbstractBlog)getModel().get(Constants.BLOG_KEY);
    BlogManager blogManager = BlogManager.getInstance();
    String blogId = request.getParameter("id");

    if (blogId != null && blogId.length() > 0 && blogId.matches("[\\w-~]*") && blogManager.getBlog(blogId) == null) {
      blogManager.addBlog(blogId);
    }

    return new RedirectView(blog.getUrl() + "viewBlogs.secureaction");
  }
View Full Code Here


   */
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
      throws ServletException, IOException {

    HttpServletRequest httpRequest = (HttpServletRequest)request;
    AbstractBlog blog = (AbstractBlog)request.getAttribute(Constants.BLOG_KEY);

    // get URI and strip off the context (e.g. /blog)
    String uri = httpRequest.getRequestURI();
    uri = uri.substring(httpRequest.getContextPath().length(), uri.length());

View Full Code Here

  public void decorateFooter(JspWriter out, PageDecoratorContext pageDecoratorContext) throws IOException {
    Boolean renderFacebookSupport = (Boolean) pageDecoratorContext.getRequest().getAttribute(RENDER_FACEBOOK_SUPPORT_KEY);
    if (renderFacebookSupport != null && renderFacebookSupport) {
      // Find out the app ID
      AbstractBlog abstractBlog = (AbstractBlog) pageDecoratorContext.getRequest().getAttribute(Constants.BLOG_KEY);
      if (abstractBlog instanceof Blog) {
        String appId = ((Blog) abstractBlog).getPluginProperties().getProperty(FACEBOOK_APP_ID_KEY);
        if (appId != null) {
          out.append("<div id=\"fb-root\"></div>\n" +
                  "<script src=\"http://connect.facebook.net/en_US/all.js\"></script>\n" +
                  "<script>\n" +
                  "FB.init({appId: '").append(appId).append("', status: false, cookie: true, xfbml: true, channelUrl: '")
                  .append(abstractBlog.getUrl()).append("facebook_channel.html'});\n" +
                  "</script>");
        } else {
          // Probably should warn that you need an APP id....
        }
      }
View Full Code Here

   * Gets the title of this view.
   *
   * @return  the title as a String
   */
  public String getContentType() {
    AbstractBlog blog = (AbstractBlog)getModel().get(Constants.BLOG_KEY);
    return "text/html; charset=" + blog.getCharacterEncoding();
  }
View Full Code Here

   * Gets the name of the theme to use.
   *
   * @return  the theme name as a String
   */
  protected String getTheme() {
    AbstractBlog blog = (AbstractBlog)getModel().get(Constants.BLOG_KEY);
    String theme = blog.getTheme();

    if (!PebbleContext.getInstance().getConfiguration().isUserThemesEnabled()) {
      if (theme != null && !theme.equals(DEFAULT_THEME) && !theme.equals(SYSTEM_THEME)) {
        return DEFAULT_THEME;
      }
View Full Code Here

      dispatcher.forward(request, response);
    } catch (IOException ioe) {
      ioe.printStackTrace();
      throw new ServletException(ioe);
    } finally {
      AbstractBlog blog = (AbstractBlog)getModel().get(Constants.BLOG_KEY);
      blog.log(request, getStatus());
    }
  }
View Full Code Here

   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    try {
      AbstractBlog blog = (AbstractBlog)getModel().get(Constants.BLOG_KEY);

      String name = request.getParameter("name");
      String emailAddress = request.getParameter("emailAddress");
      String website = request.getParameter("website");
      String profile = request.getParameter("profile");

      PebbleUserDetails currentUserDetails = SecurityUtils.getUserDetails();

      // can the user change their user details?
      if (!currentUserDetails.isDetailsUpdateable()) {
        return new FourZeroThreeView();
      }

      SecurityRealm realm = PebbleContext.getInstance().getConfiguration().getSecurityRealm();
      PebbleUserDetails newUserDetails;

      ValidationContext validationContext = new ValidationContext();

      if (!validationContext.hasErrors()) {
      newUserDetails = new PebbleUserDetails(
          currentUserDetails.getUsername(),
          name,
          emailAddress,
          website,
          profile,
          currentUserDetails.getRoles(),
          currentUserDetails.getPreferences(),
          currentUserDetails.isDetailsUpdateable());

          realm.updateUser(newUserDetails);

          return new RedirectView(blog.getUrl() + "editUserDetails.secureaction");
      }

      getModel().put("validationContext", validationContext);
      return new ForwardView("/editUserDetails.secureaction");
    } catch (SecurityRealmException e) {
View Full Code Here

    try {
      response.sendError(HttpServletResponse.SC_FORBIDDEN);
    } catch (IOException ioe) {
      throw new ServletException(ioe);
    } finally {
      AbstractBlog blog = (AbstractBlog)getModel().get(Constants.BLOG_KEY);
      blog.log(request, HttpServletResponse.SC_FORBIDDEN);
    }
  }
View Full Code Here

  private String plugin;

  @Override
  public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    AbstractBlog abstractBlog = (AbstractBlog) request.getAttribute(Constants.BLOG_KEY);

    try {
      if (abstractBlog instanceof Blog) {
        PageDecoratorContext context = new PageDecoratorContext(request);
        Blog blog = (Blog) abstractBlog;
View Full Code Here

   * @return  an integer specifying what to do afterwards
   * @throws  JspException    if something goes wrong
   */
  public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
    AbstractBlog abstractBlog = (AbstractBlog)request.getAttribute(Constants.BLOG_KEY);

    if (abstractBlog instanceof Blog) {
      Blog blog = (Blog)abstractBlog;
      if (SecurityUtils.isUserAuthorisedForBlogAsBlogOwner(blog)) {
        return EVAL_BODY_INCLUDE;
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.domain.AbstractBlog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.