Package org.vfny.geoserver

Examples of org.vfny.geoserver.Response


    }

    public String getMimeType(Object value, Operation operation)
        throws ServiceException {
        //get the delegate
        Response delegate = (Response) value;

        //get the requst object from the operation
        Request request = (Request) OwsUtils.parameter(operation.getParameters(), Request.class);

        //the old contract specifies that execute must be called before
        // get content type
        delegate.execute(request);

        //return the content type
        return delegate.getContentType(gs);
    }
View Full Code Here


    }

    public void write(Object value, OutputStream output, Operation operation)
        throws IOException, ServiceException {
        //get the delegate
        Response delegate = (Response) value;

        //write the response
        delegate.writeTo(output);
    }
View Full Code Here

        //write the response
        delegate.writeTo(output);
    }
   
    public String[][] getHeaders(Object value, Operation operation) throws ServiceException {
        Response delegate = (Response) value;
        HashMap map = new HashMap();
        if ( delegate.getContentDisposition() != null ) {
            map.put( "Content-Disposition", delegate.getContentDisposition() );
        }
       
        HashMap m = delegate.getResponseHeaders();
        if ( m != null && !m.isEmpty() ) {
            map.putAll( m );
        }
       
        if(map == null || map.isEmpty())
View Full Code Here

    }

    public String getMimeType(Object value, Operation operation)
        throws ServiceException {
        //get the delegate
        Response delegate = (Response) value;

        //get the requst object from the operation
        Request request = (Request) OwsUtils.parameter(operation.getParameters(), Request.class);

        //the old contract specifies that execute must be called before
        // get content type
        delegate.execute(request);

        //return the content type
        return delegate.getContentType(gs);
    }
View Full Code Here

    }

    public void write(Object value, OutputStream output, Operation operation)
        throws IOException, ServiceException {
        //get the delegate
        Response delegate = (Response) value;

        //write the response
        delegate.writeTo(output);
    }
View Full Code Here

        //write the response
        delegate.writeTo(output);
    }
   
    public String[][] getHeaders(Object value, Operation operation) throws ServiceException {
        Response delegate = (Response) value;
        HashMap map = new HashMap();
        if ( delegate.getContentDisposition() != null ) {
            map.put( "Content-Disposition", delegate.getContentDisposition() );
        }
       
        HashMap m = delegate.getResponseHeaders();
        if ( m != null && !m.isEmpty() ) {
            map.putAll( m );
        }
       
        if(map == null || map.isEmpty())
View Full Code Here

            return;
        }

        ServiceStrategy strategy = null;
        Response serviceResponse = null;

        try {
            strategy = getServiceStrategy();
            LOGGER.fine("strategy is: " + strategy);
            serviceResponse = getResponseHandler();
        } catch (Throwable t) {
            sendError(response, t);

            return;
        }

        Service s = null;

        if ("WFS".equals(serviceRequest.getService())) {
            s = serviceRequest.getWFS();
        } else {
            s = serviceRequest.getWMS();
        }

        try {
            // execute request
            LOGGER.finer("executing request");
            serviceResponse.execute(serviceRequest);
            LOGGER.finer("execution succeed");
        } catch (ServiceException serviceException) {
            LOGGER.warning("service exception while executing request: "
                + serviceRequest + "\ncause: " + serviceException.getMessage());
            serviceResponse.abort(s);
            sendError(response, serviceException);

            return;
        } catch (Throwable t) {
            //we can safelly send errors here, since we have not touched response yet
            serviceResponse.abort(s);
            sendError(response, t);

            return;
        }

        OutputStream strategyOuput = null;

        //obtain the strategy output stream
        try {
            LOGGER.finest("getting strategy output");
            strategyOuput = strategy.getDestination(response);
            LOGGER.finer("strategy output is: "
                + strategyOuput.getClass().getName());

            String mimeType = serviceResponse.getContentType(s.getGeoServer());
            LOGGER.fine("mime type is: " + mimeType);
            response.setContentType(mimeType);

            String encoding = serviceResponse.getContentEncoding();

            if (encoding != null) {
                LOGGER.fine("content encoding is: " + encoding);
                response.setHeader("content-encoding", encoding);
            }
        } catch (SocketException socketException) {
            LOGGER.fine(
                "it seems that the user has closed the request stream: "
                + socketException.getMessage());

            // It seems the user has closed the request stream
            // Apparently this is a "cancel" and will quietly go away
            //
            // I will still give strategy and serviceResponse
            // a chance to clean up
            //
            serviceResponse.abort(s);
            strategy.abort();

            return;
        } catch (IOException ex) {
            serviceResponse.abort(s);
            strategy.abort();
            sendError(response, ex);

            return;
        }

        try {
            // gather response
            serviceResponse.writeTo(strategyOuput);
            strategyOuput.flush();
            strategy.flush();
        } catch (java.net.SocketException sockEx) { // user cancel
            serviceResponse.abort(s);
            strategy.abort();

            return;
        } catch (IOException ioException) { // strategyOutput error
            serviceResponse.abort(s);
            strategy.abort();
            sendError(response, ioException);

            return;
        } catch (ServiceException writeToFailure) { // writeTo Failure
            serviceResponse.abort(s);
            strategy.abort();
            sendError(response, writeToFailure);

            return;
        } catch (Throwable help) { // This is an unexpected error(!)
          help.printStackTrace();
            serviceResponse.abort(s);
            strategy.abort();
            sendError(response, help);

            return;
        }
View Full Code Here

    }

    public String getMimeType(Object value, Operation operation)
        throws ServiceException {
        //get the delegate
        Response delegate = (Response) value;

        //get the requst object from the operation
        Request request = (Request) OwsUtils.parameter(operation.getParameters(), Request.class);

        //the old contract specifies that execute must be called before
        // get content type
        delegate.execute(request);

        //return the content type
        return delegate.getContentType(gs);
    }
View Full Code Here

    }

    public void write(Object value, OutputStream output, Operation operation)
        throws IOException, ServiceException {
        //get the delegate
        Response delegate = (Response) value;

        //write the response
        delegate.writeTo(output);
    }
View Full Code Here

        //write the response
        delegate.writeTo(output);
    }
   
    public String[][] getHeaders(Object value, Operation operation) throws ServiceException {
        Response delegate = (Response) value;
        HashMap map = new HashMap();
        if ( delegate.getContentDisposition() != null ) {
            map.put( "Content-Disposition", delegate.getContentDisposition() );
        }
       
        HashMap m = delegate.getResponseHeaders();
        if ( m != null && !m.isEmpty() ) {
            map.putAll( m );
        }
       
        if(map == null || map.isEmpty())
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.Response

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.