* @throws ServiceException when something went wrong.
* @throws URIParameterizerException when something went wrong.
*/
protected String getDocumentType(Map objectModel, PageEnvelope envelope) throws ServiceException, URIParameterizerException {
String documentType;
URIParameterizer parameterizer = null;
Map map = null;
try {
parameterizer = (URIParameterizer) manager.lookup(URIParameterizer.ROLE);
Parameters parameters = new Parameters();
parameters.setParameter(
URI_PARAMETER_DOCTYPE,
"cocoon://uri-parameter/"
+ envelope.getPublication().getId()
+ "/"
+ URI_PARAMETER_DOCTYPE);
String source = envelope.getDocument().getArea() + envelope.getDocument().getDocumentURL();
Request request = ObjectModelHelper.getRequest(objectModel);
map = parameterizer.parameterize(request.getRequestURI(), source, parameters);
documentType = (String) map.get(URI_PARAMETER_DOCTYPE);
} finally {
if (parameterizer != null) {
manager.release(parameterizer);
}