Skip to content

Commit

Permalink
view descriptor handling improved
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Mar 29, 2012
1 parent b061c0e commit d3f6d9a
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -169,6 +169,8 @@ public ViewDescriptor[] getViewDescriptors() {
}
return this.viewDescriptors.values().toArray(new ViewDescriptor[this.viewDescriptors.size()]);
}

log.warn("No custom view descriptors set within resource configuration (Resource path: " + getPath() + "), hence use default ones: " + DEFAULT_VIEW_ID + ", " + SOURCE_VIEW_ID);
// no custom config
ConfigurableViewDescriptor[] vd = new ConfigurableViewDescriptor[2];
vd[0] = new ConfigurableViewDescriptor(DEFAULT_VIEW_ID);
Expand Down Expand Up @@ -260,7 +262,6 @@ public View getXMLView(String viewId, InputStream xmlInputStream) throws Excepti
log.info("View already set (probably via query string or session attribute): " + viewId);
}

ConfigurableViewDescriptor viewDescriptor = (ConfigurableViewDescriptor)getViewDescriptor(viewId);
String mimeType = getMimeType(viewId);
view.setMimeType(mimeType);

Expand All @@ -273,6 +274,7 @@ public View getXMLView(String viewId, InputStream xmlInputStream) throws Excepti
}

// write result into view:
ConfigurableViewDescriptor viewDescriptor = (ConfigurableViewDescriptor)getViewDescriptor(viewId);
view.setInputStream(getTransformedInputStream(xmlInputStream, viewDescriptor, errorWriter));
return view;
} catch(Exception e) {
Expand Down Expand Up @@ -311,7 +313,7 @@ private InputStream getTransformedInputStream(InputStream xmlInputStream, Config
tf.setURIResolver(uriResolver);
tf.setErrorListener(errorListener);

String[] xsltPaths = viewDescriptor.getXSLTPaths();
String[] xsltPaths = null;
if (viewDescriptor != null) {
xsltPaths = viewDescriptor.getXSLTPaths();
} else {
Expand Down Expand Up @@ -386,8 +388,8 @@ private InputStream getTransformedInputStream(InputStream xmlInputStream, Config
}

/**
* Creates an html or xml serializer for the given view id.
* @param viewId
* Creates an html or xml serializer for the given view descriptor
* @param viewdDescriptor
* @return serializer
* @throws Exception
*/
Expand Down

0 comments on commit d3f6d9a

Please sign in to comment.