@ RequestMapping ( "**" ) public void httpHandler ( HttpServletRequest hsreq , HttpServletResponse hsres ) { try { PrintWriter wr = hsres . getWriter ( ) ; List < String > paramNames = new LinkedList < String > ( ) ; Enumeration < String > paramNamesE = hsreq . getParameterNames ( ) ; while ( paramNamesE . hasMoreElements ( ) ) paramNames . add ( paramNamesE . nextElement ( ) ) ; // Prepare parameters String request = null ; String version = null ; String service = null ; String typeNames = null ; String datasetReqPath = null ; String actualPath = null ; String actualFTName = null ; NetcdfDataset dataset = null ; if ( hsreq . getServletPath ( ) . length ( ) > 4 ) { datasetReqPath = hsreq . getServletPath ( ) . substring ( 4 , hsreq . getServletPath ( ) . length ( ) ) ; } actualPath = TdsRequestedDataset . getLocationFromRequestPath ( datasetReqPath ) ; if ( actualPath != null ) dataset = NetcdfDataset . openDataset ( actualPath ) ; else return ; List < CoordinateSystem > csList = dataset . getCoordinateSystems ( ) ; SimpleGeometryCSBuilder cs = new SimpleGeometryCSBuilder ( dataset , csList . get ( 0 ) , null ) ; /* Look for parameter names to assign values * in order to avoid casing issues with parameter names (such as a mismatch between reQUEST and request and REQUEST). */ for ( String paramName : paramNames ) { if ( paramName . equalsIgnoreCase ( "REQUEST" ) ) { request = hsreq . getParameter ( paramName ) ; } if ( paramName . equalsIgnoreCase ( "VERSION" ) ) { version = hsreq . getParameter ( paramName ) ; } if ( paramName . equalsIgnoreCase ( "SERVICE" ) ) { service = hsreq . getParameter ( paramName ) ; } if ( paramName . equalsIgnoreCase ( "TYPENAMES" ) || paramName . equalsIgnoreCase ( "TYPENAME" ) ) { typeNames = hsreq . getParameter ( paramName ) ; // Remove namespace header for getFeature if ( typeNames != null ) if ( typeNames . length ( ) > TDSNAMESPACE . length ( ) ) { actualFTName = typeNames . substring ( TDSNAMESPACE . length ( ) + 1 , typeNames . length ( ) ) ; } } } WFSExceptionWriter paramError = checkParametersForError ( request , version , service , typeNames ) ; WFSExceptionWriter requestProcessingError = null ; // If parameter checks all pass launch the request if ( paramError == null ) { WFSRequestType reqToProc = WFSRequestType . getWFSRequestType ( request ) ; switch ( reqToProc ) { case GetCapabilities : getCapabilities ( wr , hsreq , cs ) ; break ; case DescribeFeatureType : describeFeatureType ( wr , hsreq , actualFTName ) ; break ; case GetFeature : requestProcessingError = getFeature ( wr , hsreq , cs , actualFTName , typeNames ) ; break ; } } // Parameter checks did not all pass, print the error and return else { paramError . write ( hsres ) ; return ; } /* Specifically writes out exceptions that were incurred * while processing requests. */ if ( requestProcessingError != null ) { requestProcessingError . write ( hsres ) ; return ; } } catch ( IOException io ) { throw new RuntimeException ( "The writer may not have been able to been have retrieved" + " or the requested dataset was not found" , io ) ; } }
A handler for WFS based HTTP requests that sends to other request handlers to handle the request .