@@ -0,0 +1,2722 @@
+package org.intermine.webservice.server;%0A%0A/*%0A * Copyright (C) 2002-2011 FlyMine%0A *%0A * This code may be freely distributed and modified under the%0A * terms of the GNU Lesser General Public Licence.  This should%0A * be distributed with the code.  See the LICENSE file for more%0A * information or http://www.gnu.org/copyleft/lesser.html.%0A *%0A */%0A%0Aimport java.util.Collections;%0Aimport java.util.Map;%0Aimport java.util.Properties;%0A%0Aimport org.intermine.api.InterMineAPI;%0Aimport org.intermine.util.StringUtil;%0Aimport org.intermine.web.logic.Constants;%0Aimport org.intermine.web.logic.session.SessionMethods;%0Aimport org.intermine.webservice.server.core.JSONService;%0Aimport org.intermine.webservice.server.output.JSONFormatter;%0A%0A/**%0A * Service for returning the version of this service.%0A * @author Alex Kalderimis%0A *%0A */%0Apublic class VersionService extends JSONService%0A%7B%0A%0A    /**%0A     * Constructor%0A     * @param im The InterMine configuration object.%0A     */%0A    public VersionService(InterMineAPI im) %7B%0A        super(im);%0A    %7D%0A%0A    @Override%0A    protected void execute() throws Exception %7B%0A        String version = getVersion(request.getPathInfo());%0A        output.addResultItem(Collections.singletonList(version));%0A    %7D%0A%0A    @Override%0A    protected int getDefaultFormat() %7B%0A        if (hasCallback()) %7B%0A            return WebService.JSONP_FORMAT;%0A        %7D else %7B%0A            return WebService.TEXT_FORMAT;%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected Map%3CString, Object%3E getHeaderAttributes() %7B%0A        Map%3CString, Object%3E attr = super.getHeaderAttributes();%0A        if (formatIsJSON()) %7B%0A            attr.put(JSONFormatter.KEY_INTRO, %22%5C%22version%5C%22:%22);%0A            attr.put(JSONFormatter.KEY_QUOTE, true);%0A        %7D%0A%0A        return attr;%0A    %7D%0A%0A    private String getVersion(String versionType) %7B%0A        if (versionType != null) %7B%0A            versionType = StringUtil.trimSlashes(versionType).toLowerCase();%0A%0A            if (versionType.startsWith(%22release%22)) %7B%0A                Properties webProperties = SessionMethods.getWebProperties(request);%0A                return webProperties.getProperty(%22project.releaseVersion%22);%0A            %7D else if (versionType.startsWith(%22ws%22)) %7B%0A                return %22%22 + Constants.WEB_SERVICE_VERSION;%0A            %7D%0A        %7D%0A        // for backwards compatibility default is the web service version%0A        return %22%22 + Constants.WEB_SERVICE_VERSION;%0A    %7D%0A%0A    @Override%0A    protected String parseFormatFromPathInfo() %7B%0A        String pi = request.getPathInfo();%0A        if (pi.endsWith(%22json%22)) %7B%0A            return %22json%22;%0A        %7D else if (pi.endsWith(%22jsonp%22)) %7B%0A            return %22jsonp%22;%0A        %7D%0A        return request.getParameter(WebServiceRequestParser.OUTPUT_PARAMETER);%0A    %7D%0A%0A%7D%0A

Upgrade version requests to full service to get access to json processing