Package gov.nysenate.openleg.converter

Examples of gov.nysenate.openleg.converter.Api1JsonConverter


            SenateResponse sr = Application.getLucene().search(term, start, pageSize, sort, sortOrder);
            ApiHelper.buildSearchResultList(sr);

            if (format.equals("json")) {
                response.setContentType("application/json");
                new Api1JsonConverter().write(sr, response.getOutputStream());
            }
            else if (format.equals("jsonp")) {
                String callback = request.getParameter("callback");
                if (callback != null && callback != "") {
                    PrintWriter out = response.getWriter();
                    response.setContentType("application/javascript");
                    out.write(callback+"("+new Api1JsonConverter().toString(sr)+");");
                }
                else {
                    throw new ApiRequestException("callback parameter required for jsonp queries.");
                }
            }
View Full Code Here


            throw new ApiRequestException(TextFormatter.append("couldn't find id: ", id, " of type: ", type));
        }
        else {
            if (format.equals("json")) {
                response.setContentType("application/json");
                new Api1JsonConverter().write(object, response.getOutputStream());
            }
            else if (format.equals("jsonp")) {
                String callback = request.getParameter("callback");
                if (callback != null && callback != "") {
                    PrintWriter out = response.getWriter();
                    response.setContentType("application/javascript");
                    out.write(callback+"("+new Api1JsonConverter().toString(object)+");");
                }
                else {
                    throw new ApiRequestException("callback parameter required for jsonp queries.");
                }
            }
View Full Code Here

TOP

Related Classes of gov.nysenate.openleg.converter.Api1JsonConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.