Project

General

Profile

« Previous | Next » 

Revision 56064

handle .json at the end of the url request

View differences:

modules/dnet-vocabulary-publisher/trunk/src/main/java/eu/dnetlib/vocabularies/publisher/controller/VocabularyPublisherController.java
9 9
import eu.dnetlib.vocabularies.publisher.VocabularyRetriever;
10 10
import eu.dnetlib.vocabularies.publisher.model.Vocabulary;
11 11
import eu.dnetlib.vocabularies.publisher.model.VocabularyTerm;
12
import org.apache.commons.lang3.StringUtils;
12 13
import org.apache.commons.logging.Log;
13 14
import org.apache.commons.logging.LogFactory;
14 15
import org.dom4j.DocumentException;
......
65 66
		String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); // /elements/CATEGORY1/CATEGORY1_1/ID
66 67
		String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); // /elements/**
67 68

  
68
		return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path); // CATEGORY1/CATEGORY1_1/ID
69
		return StringUtils.substringBeforeLast(new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path), ".json"); // CATEGORY1/CATEGORY1_1/ID
69 70
	}
70 71

  
71 72
	// View-based methods for html responses

Also available in: Unified diff