Exemplo n.º 1
0
 @Override
 public void sendContent( OutputStream out, Range range, Map<String, String> params, String contentType ) throws IOException {
     ITemplate template = editee.getTemplate();
     if( template == null ) {
         log.debug( "-- no template. using default" );
         String sTemplate = FileUtils.readResource( this.getClass(), "defaultEdit.vel" );
         VelocityContext vc = new VelocityContext();
         vc.put( "editee", editee );
         vc.put( "targetPage", this );
         vc.put( "params", params );
         RenderContext rc = new RenderContext( template, editee, null, true );
         vc.put( "renderContext", rc );
         VelocityInterpreter.evalToStream( sTemplate, vc, out );
         out.flush();
     } else {
         log.trace("generate edit page with template: " + template.getName());            
         RenderContext rc = new RenderContext( template, editee, null, true );
         if( params != null && params.size() > 0 ) {
             editee.preProcess(rc, params, null);
         }            
         String s = editee.render( rc, params, template, true);
         //String s = template.render( rc, params, template);
         if( s == null ) {
             log.warn( "Got null content for editee: " + editee.getHref() );
             return;
         } else {
             out.write( s.getBytes() );
         }
     }
 }
Exemplo n.º 2
0
 @Override
 public String checkRedirect( Request request ) {
     //return null;
     if( editee instanceof ISubPage) {
         String s = editee.getParent().getHref();
         if( !s.endsWith("/")) s += "/";
         s =  s + ".edit";
         return s;
     } else {
         return null;
     }
 }
Exemplo n.º 3
0
 /** TODO: move editing logic to here from Page
  */
 @Override
 public String processForm( Map<String, String> parameters, Map<String, FileItem> files ) throws NotAuthorizedException {
     return editee.processForm( parameters, files );
 }
Exemplo n.º 4
0
 @Override
 public String getRealm() {
     return editee.getRealm();
 }
Exemplo n.º 5
0
 @Override
 public Object authenticate( DigestResponse digestRequest ) {
     return editee.authenticate( digestRequest );
 }
Exemplo n.º 6
0
 @Override
 public Object authenticate( String user, String password ) {
     return editee.authenticate( user, password );
 }
Exemplo n.º 7
0
 @Override
 public String getName() {
     return editee.getName() + ".edit";
 }