Package org.w3c.jigsaw.html

Examples of org.w3c.jigsaw.html.HtmlGenerator


     * @return a HtmlGenerator instance.
     */
    public static HtmlGenerator getHtmlGenerator(CvsFrame cvsframe,
             String title)
    {
  HtmlGenerator g = new HtmlGenerator(title);
  cvsframe.addStyleSheet(g);
  addStyle(g);
  return g;
    }
View Full Code Here


    protected static Reply error(Request request,
         String msg,
         String details)
    {
  Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR);
  HtmlGenerator g = getHtmlGenerator(msg);
  g.append ("<center>");
  g.append ("[ <A HREF=\"./CVS\">Back</A> ]<hr noshade width=\"80%\">");
  g.append ("</center>");
  g.append ("<div class=\"error\"> <center><p class=\"error\">", msg,
      "</center><p>\n");
  g.append ("Details : <p><em>",details,"</em><p></div>\n");
  g.append ("<hr noshade width=\"80%\">");
  error.setStream(g);
  return error;
    }
View Full Code Here

      } catch (MalformedURLException ex) {
    return null;
      }
      Reply reply = req.makeReply(HTTP.FOUND);
      reply.setLocation(loc);
      HtmlGenerator g = new HtmlGenerator("Moved");
      g.append("<P>This resource has moved, click  if your browser"
         + " doesn't support automatic redirection<BR>"+
         "<A HREF=\""+loc.toExternalForm()+"\">"+
         loc.toExternalForm()+"</A>");
      reply.setStream(g);
      return reply ;
View Full Code Here

    e.setProxyAuthenticate(challenge);
      } else {
    e = request.makeReply(HTTP.UNAUTHORIZED);
    e.setWWWAuthenticate(challenge);
      }
      HtmlGenerator g = new HtmlGenerator("Unauthorized");
      g.append ("<h1>Unauthorized access</h1>"+
          "<p>You are denied access to this resource.");
      e.setStream(g);
      request.skipBody();
      throw new HTTPException (e);
  } else {
View Full Code Here

  return false;
    }

    protected HtmlGenerator generateForm(String msg) {
  // Create the HTML and set title:
  HtmlGenerator g = new HtmlGenerator("Password editor for "+getRealm());
  // Add style link
  addStyleSheet(g);
  g.append("<h1>Password editor for "
     , getRealm()
     , "</h1>");
  // If some message is available, dump it:
  if ( msg != null )
      g.append("<hr>", msg, "</hr>");
  // And then display the form:
  g.append("<form method=\"POST\" action=\"",
     getURLPath(),
     "\">");
  g.append("<table width=\"100%\">");
  g.append("<tr><th align=right>username");
  g.append("<th align=left><input type=\"text\" name=\"username\">");
  g.append("<tr><th align=right>old password");
  g.append("<th align=left><input type=\"password\" name=\"opasswd\">");
  g.append("<tr><th align=right>new password");
  g.append("<th align=left><input type=\"password\" name=\"npasswd\">");
  g.append("<tr><th align=right>confirm");
  g.append("<th align=left><input type=\"password\" name=\"cpasswd\">");
  g.append("</table>");
  g.append("<input type=\"submit\" value=\"Change\">");
  g.append("</form>");
  return g;
    }
View Full Code Here

    return null;
  }
  // failed, restrict access
  Reply r = request.makeReply(HTTP.USE_PROXY);
  if (r != null) {
      HtmlGenerator g = new HtmlGenerator("Use Proxy");
      g.append("You should use the following proxy to access" +
         " this resource: " + getString(ATTR_PROXY, "localhost"));
      r.setStream(g);
  }
  r.setLocation(proxy_url);
  return r;
View Full Code Here

    {
  String username = data.getValue("username");
  String opasswd  = data.getValue("opasswd");
  String npasswd  = data.getValue("npasswd");
  String cpasswd  = data.getValue("cpasswd");
  HtmlGenerator g = null;
  if ((username == null)
      || (opasswd == null)
      || (npasswd == null)
      || (cpasswd == null)) {
      // Check that all values are available:
      if (username == null)
    g = generateForm("Fill in <em>all</em> the fields.");
      else
    g = generateForm("Hey, "+username+", could you feel in "
         + "<em>all</em> the fields please.");
  } else   if ( ! npasswd.equals(cpasswd) ) {
      // Check that new and confirmed password are the same:
      g = generateForm("New and confirmed password don't "
           + " match, try again "
           + ((username == null) ? "." : (username+".")));
  } else if ( changePassword(username, opasswd, npasswd) ) {
      // Run the change:
      g = new HtmlGenerator("Password now changed.");
      // Add style link
      addStyleSheet(g);
      g.append("<h1>Your password has been changed</h1>");
      g.append("<p>Operation succeeded, have fun !");
  } else {
      // Changing the password failed, don't provide explanations:
      g = new HtmlGenerator("Password change failed");
      // Add style link
      addStyleSheet(g);
      g.append("<h1>Changing the password failed</h1>");
      g.append("You were not allowed to change the password for user \""
         , username
         , "\".");
  }
  // We always succeed, that's cool:
  Reply reply = createDefaultReply(request, HTTP.OK);
View Full Code Here

  throws ProtocolException, ResourceException
    {
  // get our associated FileResource
  FileResource fres = getFileResource();
  // Create the HTML generator, and set titles:
  HtmlGenerator g = new HtmlGenerator("FancyFrame");
  g.append("<h1>FancyFrame output</h1>");
  // emit the message
  g.append("<p>",getMessage(),"</p>");
  // display information about our FileResource
  g.append("<h2> FileResource associated : </h2>");
  g.append("<ul><li>Identifier : ",fres.getIdentifier());
  g.append("<li>File : "+fres.getFile());
  g.append("<li>Last Modified Time : ",
     new Date(fres.getLastModified()).toString(),
     "</ul>");
  // now emit the reply
  Reply reply = createDefaultReply(request, HTTP.OK) ;
  reply.setStream(g) ;
View Full Code Here

  throws ProtocolException, ResourceException
    {
  // get our associated DirectoryResource
  DirectoryResource dres = getDirectoryResource();
  // Create the HTML generator, and set titles:
  HtmlGenerator g = new HtmlGenerator("FancyFrame");
  g.append("<h1>FancyFrame output</h1>");
  // emit the message
  g.append("<p>",getMessage(),"</p>");
  // display information about our DirectoryResource
  g.append("<h2> DirectoryResource associated : </h2>");
  g.append("<ul><li>Identifier : ",dres.getIdentifier());
  g.append("<li>Directory : "+dres.getDirectory());
  g.append("<li>Last Modified Time : ",
     new Date(dres.getLastModified()).toString(),
     "</ul>");
  // now emit the reply
  Reply reply = createDefaultReply(request, HTTP.OK) ;
  reply.setStream(g) ;
View Full Code Here

      String log = null;
      try {
    log = getCvsManager().log(name);
      } catch (CvsException cvs_ex) {
    Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR) ;
    HtmlGenerator g = getHtmlGenerator("CVS log command failed") ;
    g.append ("<p>The CVS <strong>log</strong> command failed "
        + " on " + name
        + " with the following error message: "
        + "<em>" + cvs_ex.getMessage() + "</em>"
        + "<hr> from class: " + this.getClass().getName()) ;
    error.setStream (g) ;
    throw new HTTPException (error) ;
      } catch (InvalidResourceException ex) {
    Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR) ;
    HtmlGenerator g = getHtmlGenerator("CVS log command failed") ;
    g.append ("<p>The CVS <strong>log</strong> command failed "
        + " on " + name
        + " with the following error message: "
        + "<em>" + ex.getMessage() + "</em>"
        + "<hr> from class: " + this.getClass().getName()) ;
    error.setStream (g) ;
View Full Code Here

TOP

Related Classes of org.w3c.jigsaw.html.HtmlGenerator

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.