Examples of IIIFRequest


Examples of info.freelibrary.djatoka.iiif.IIIFRequest

    @Override
    protected void doGet(final HttpServletRequest aRequest, final HttpServletResponse aResponse)
            throws ServletException, IOException {
        String level = getServletConfig().getInitParameter("level");
        final IIIFRequest iiif = (IIIFRequest) aRequest.getAttribute(IIIFRequest.KEY);
        final String reqURI = aRequest.getRequestURI();
        final String servletPath = aRequest.getServletPath();
        final String path = reqURI.substring(servletPath.length());
        final String id = getID(path);

        if (reqURI.endsWith("/info.xml") || reqURI.endsWith("/info.json")) {
            try {
                final int[] config = getHeightWidthAndLevels(aRequest, aResponse);
                final ImageInfo info = new ImageInfo(id, config[0], config[1], config[2]);
                final ServletOutputStream outStream = aResponse.getOutputStream();

                if (reqURI.endsWith("/info.xml")) {
                    info.toStream(outStream);
                } else {
                    final StringBuilder serviceSb = new StringBuilder();

                    serviceSb.append(aRequest.getScheme()).append("://");
                    serviceSb.append(aRequest.getServerName()).append(":");
                    serviceSb.append(aRequest.getServerPort());

                    final String service = serviceSb.toString();
                    final String prefix = iiif.getServicePrefix();

                    info.addFormat("jpg"); // FIXME: Configurable options

                    outStream.print(info.toJSON(service, prefix));
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.