Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002385 [Resin] minor always 01-30-08 18:08 01-30-08 19:12
Reporter sam View Status public  
Assigned To sam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.5 Product Version 3.1.4
  Product Build
Summary 0002385: Allow extension of SSI with custom commands
Description Provide plugin mechanism to allow, for example

<!--#mycommand a="hello" -->
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0002701)
sam
01-30-08 19:12

server/198d, server/1961

Example usage:

---- WEB-INF/resin-web.xml --------------------------------------

<web-app xmlns="http://caucho.com/ns/resin"> [^]
  <filter filter-name='ssi' filter-class='com.caucho.servlets.ssi.SSIFilter'>
    <init>
      <factory resin:type="qa.MySSIFactory"/>
    </init>
  </filter>

  <filter-mapping url-pattern='*.php' filter-name='ssi'/>
</web-app>

---- WEB-INF/classes/qa/MySSIFactory.java --------------------------

package qa;

import com.caucho.servlets.ssi.SSIFactory;

import com.caucho.vfs.Path;
import com.caucho.servlets.ssi.Statement;

import java.util.HashMap;

public class MySSIFactory
  extends SSIFactory
{
  public Statement createStatement(String cmd,
                                   HashMap<String,String> attr,
                                   Path path)
  {
    if ("foo".equals(cmd))
      return new FooStatement(attr);
    else
      return super.createStatement(cmd, attr, path);
  }
}

---- WEB-INF/classes/qa/FooStatement.java -------------------------------

package qa;

import com.caucho.servlets.ssi.Statement;

import com.caucho.vfs.WriteStream;

import java.io.IOException;
import java.util.HashMap;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class FooStatement
  extends Statement
{
  private String _a;

  public FooStatement(HashMap<String, String> attr)
  {
    _a = attr.get("a");
  }

  public void apply(WriteStream out,
                    HttpServletRequest request,
                    HttpServletResponse response)
    throws IOException, ServletException
  {
    out.print("foo(" + _a + ")");
  }
}

---- test.php ----------------------------------

<h1>A little test</h1>

<!--#foo a="hello" -->

<h1>End of test</h1>
 

- Issue History
Date Modified Username Field Change
01-30-08 18:08 sam New Issue
01-30-08 19:06 sam Status new => assigned
01-30-08 19:06 sam Assigned To  => sam
01-30-08 19:12 sam Status assigned => closed
01-30-08 19:12 sam Note Added: 0002701
01-30-08 19:12 sam Resolution open => fixed
01-30-08 19:12 sam Fixed in Version  => 3.1.5


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker