@Override public OWS build() { return new CSWController( metadata, workspace, config ); }
private void sendServiceException( OWSException ex, HttpResponseBuffer response ) throws ServletException { sendException( null, getExceptionSerializer( parseVersion( "1.2.0" ) ), ex, response ); }
try { String rootElement = KVPUtils.getRequired( normalizedKVPParams, "REQUEST" ); CSWRequestType requestType = getRequestType( rootElement ); if ( requestType == null ) throw new OWSException( rootElement + " is not a known request type by this CSW", INVALID_PARAMETER_VALUE ); Version requestVersion = getVersion( normalizedKVPParams.get( "ACCEPTVERSIONS" ) ); checkVersion( requestVersion ); case GetCapabilities: GetCapabilities getCapabilities = GetCapabilities202KVPAdapter.parse( normalizedKVPParams ); doGetCapabilities( getCapabilities, response, false ); break; case DescribeRecord: break; case Transaction: checkTransactionsEnabled( rootElement ); Transaction trans = TransactionKVPAdapter.parse( normalizedKVPParams ); transactionHandler.doTransaction( trans, response, store ); sendServiceException( e, response ); } catch ( InvalidParameterValueException e ) { LOG.debug( e.getMessage(), e ); sendServiceException( new OWSException( e ), response ); } catch ( MissingParameterException e ) { LOG.debug( e.getMessage(), e );
xmlWriter.writeStartElement( soapEnvNS, "Body" ); } else { beginSOAPResponse( response ); doXML( soapDoc.getBody().getFirstElement(), response ); } catch ( XMLStreamException e ) { LOG.debug( e.getMessage(), e ); sendSoapException( soapDoc, factory, response, new OWSException( e.getMessage(), e, NO_APPLICABLE_CODE ), request, version ); } catch ( OWSException e ) { LOG.debug( e.getMessage(), e ); sendSoapException( soapDoc, factory, response, e, request, version ); } catch ( IOException e ) { LOG.debug( e.getMessage(), e ); sendSoapException( soapDoc, factory, response, new OWSException( e.getMessage(), e, NO_APPLICABLE_CODE ), request, version ); } catch ( MissingParameterException e ) { LOG.debug( e.getMessage(), e ); sendSoapException( soapDoc, factory, response, new OWSException( e.getMessage(), e, MISSING_PARAMETER_VALUE ), request, version ); } catch ( InvalidParameterValueException e ) { LOG.debug( e.getMessage(), e ); sendSoapException( soapDoc, factory, response, new OWSException( e.getMessage(), e, INVALID_PARAMETER_VALUE ), request, version ); } catch ( FailedAuthentication e ) { LOG.debug( e.getMessage(), e ); sendSoapException( soapDoc, factory, response, new OWSException( e.getMessage(), e, NO_APPLICABLE_CODE ), request, version ); } catch ( Throwable t ) {
private void sendSoapException( SOAPEnvelope soapDoc, SOAPFactory factory, HttpResponseBuffer response, OWSException e, ServletRequest request, SOAPVersion version ) throws OMException, ServletException { XMLExceptionSerializer serializer = getExceptionSerializer( parseVersion( "1.2.0" ) ); sendSOAPException( soapDoc.getHeader(), factory, response, e, serializer, null, null, request.getServerName(), request.getCharacterEncoding() ); }
@Override public void doXML( XMLStreamReader xmlStream, HttpServletRequest request, HttpResponseBuffer response, List<FileItem> multiParts ) throws ServletException, IOException, SecurityException { response.setContentType( "text/xml" ); try { XMLAdapter requestDoc = new XMLAdapter( xmlStream ); OMElement rootElement = requestDoc.getRootElement(); doXML( rootElement, response ); } catch ( OWSException e ) { LOG.debug( e.getMessage(), e ); sendServiceException( e, response ); } catch ( InvalidParameterValueException e ) { LOG.debug( e.getMessage(), e ); sendServiceException( new OWSException( e ), response ); } catch ( MissingParameterException e ) { LOG.debug( e.getMessage(), e ); sendServiceException( new OWSException( e ), response ); } catch ( Throwable t ) { String msg = "An unexpected error occured: " + t.getMessage(); LOG.error( msg, t ); sendServiceException( new OWSException( msg, t, NO_APPLICABLE_CODE ), response ); } }
validateAndSetOfferedVersions( profile.getSupportedVersions() ); LOG.info( "No SupportedVersion element provided. The version is set to default 2.0.2" ); } else { validateAndSetOfferedVersions( jaxbConfig.getSupportedVersions().getVersion() ); getRecordsHandler = new GetRecordsHandler( maxMatches, SCHEMA_LOCATION, store, elNames ); transactionHandler = new TransactionHandler(); getRecordByIdHandler = getGetRecordByIdHandler();
/** * Method for mapping the request operation to the implemented operations located in {@link CSWConstants} * * @param requestName * @return CSWRequestType * @throws OWSException */ private CSWRequestType getRequestType( String requestName ) throws OWSException { CSWRequestType requestType = null; try { requestType = (CSWRequestType) ( (ImplementationMetadata) ( (OWSProvider) getMetadata().getProvider() ).getImplementationMetadata() ).getRequestTypeByName( requestName ); } catch ( IllegalArgumentException e ) { throw new OWSException( e.getMessage(), OWSException.OPERATION_NOT_SUPPORTED ); } return requestType; }
private void doXML( OMElement requestElement, HttpResponseBuffer response ) throws OWSException, XMLStreamException, IOException { String rootElement = requestElement.getLocalName(); CSWRequestType requestType = getRequestType( rootElement ); if ( requestType == null ) throw new IllegalArgumentException( rootElement + " is not a known request type by this CSW" ); Version requestVersion = getVersion( requestElement.getAttributeValue( new QName( "version" ) ) ); if ( requestType != CSWRequestType.GetCapabilities ) { checkVersion( requestVersion ); getCapabilitiesAdapter.setRootElement( requestElement ); GetCapabilities cswRequest = getCapabilitiesAdapter.parse(); doGetCapabilities( cswRequest, response, true ); break; case DescribeRecord: break; case Transaction: checkTransactionsEnabled( rootElement ); TransactionXMLAdapter transAdapter = new TransactionXMLAdapter(); transAdapter.setRootElement( requestElement );