RequestInterface req,
String name,
Hashtable defs)
{
ResourceReference rr = null;
FramedResource template = null;
//try with content type in request.
if (req instanceof Request) {
Request request = (Request) req;
MimeType type = request.getContentType();
if (type != null)
rr = loadContentType(type.toString());
if (rr != null) {
String s_dir = "directory".intern();
String s_ide = "identifier".intern();
String s_fil = "filename".intern();
String s_con = "context".intern();
if ( defs == null )
defs = new Hashtable(5) ;
if ( defs.get(s_dir) == null )
defs.put(s_dir, directory) ;
if ( defs.get(s_ide) == null )
defs.put(s_ide, name) ;
if ( defs.get(s_con) == null )
defs.put(s_con, getContext());
//read attribute from request
try {
template = (FramedResource) rr.lock();
// Create, initialize and return the new resouce
try {
FramedResource resource = null;
resource = (FramedResource) template.getClone(defs);
// Now update HTTPFrame from request
String contentLanguage[] =
request.getContentLanguage();
String contentEncoding[] =
request.getContentEncoding();
//get the HTTPFrame.
Class httpFrameClass =
Class.forName("org.w3c.jigsaw.frames.HTTPFrame");
HTTPFrame hframe = (HTTPFrame)
resource.getFrame(httpFrameClass);
if (hframe != null) {
if ((contentLanguage != null) &&
(contentLanguage.length > 0))
hframe.setValue("content-language",
contentLanguage[0]);