List of usage examples for java.net HttpURLConnection HTTP_INTERNAL_ERROR
int HTTP_INTERNAL_ERROR
To view the source code for java.net HttpURLConnection HTTP_INTERNAL_ERROR.
Click Source Link
From source file:rapture.repo.VersionedRepo.java
@Override public List<DocumentWithMeta> getVersionMeta(String key, List<Integer> versions) { throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR, Messages.getString("BaseSimpleRepo.notsupp")); //$NON-NLS-1$ }
From source file:rapture.repo.VersionedRepo.java
@Override public List<Boolean> removeVersionMeta(String key, List<Integer> versions) { throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR, Messages.getString("BaseSimpleRepo.notsupp")); //$NON-NLS-1$ }
From source file:rapture.repo.VersionedRepo.java
@Override public void setDocAttribute(RaptureURI uri, DocumentAttribute attribute) { throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR, Messages.getString("BaseSimpleRepo.notsupp")); //$NON-NLS-1$ }
From source file:rapture.repo.VersionedRepo.java
@Override public DocumentAttribute getDocAttribute(RaptureURI uri) { throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR, Messages.getString("BaseSimpleRepo.notsupp")); //$NON-NLS-1$ }
From source file:rapture.repo.VersionedRepo.java
@Override public List<DocumentAttribute> getDocAttributes(RaptureURI uri) { throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR, Messages.getString("BaseSimpleRepo.notsupp")); //$NON-NLS-1$ }
From source file:rapture.repo.VersionedRepo.java
@Override public Boolean deleteDocAttribute(RaptureURI uri) { throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR, Messages.getString("BaseSimpleRepo.notsupp")); //$NON-NLS-1$ }
From source file:eionet.web.action.VocabularyFolderActionBean.java
/** * Action, that returns RDF output of the vocabulary. * * @return resolution/* w w w .j av a2s.co m*/ */ public Resolution rdf() { try { vocabularyFolder = vocabularyService.getVocabularyFolder(vocabularyFolder.getFolderName(), vocabularyFolder.getIdentifier(), false); if (vocabularyFolder.isDraftStatus()) { throw new RuntimeException("Vocabulary is not in released or public draft status."); } List<VocabularyFolder> vocabularyFolders = new ArrayList<VocabularyFolder>(); vocabularyFolders.add(vocabularyFolder); final List<RdfNamespace> nameSpaces = vocabularyService.getVocabularyNamespaces(vocabularyFolders); initFilter(); filter.setUsePaging(false); filter.setConceptStatus(StandardGenericStatus.VALID); final List<? extends VocabularyConcept> concepts; if (vocabularyFolder.isSiteCodeType()) { String countryCode = getContext().getRequestParameter("countryCode"); String identifier = getContext().getRequestParameter("identifier"); SiteCodeFilter siteCodeFilter = new SiteCodeFilter(); siteCodeFilter.setUsePaging(false); siteCodeFilter.setCountryCode(countryCode); siteCodeFilter.setIdentifier(identifier); concepts = siteCodeService.searchSiteCodes(siteCodeFilter).getList(); } else { concepts = vocabularyService.getValidConceptsWithAttributes(vocabularyFolder.getId()); } final String contextRoot = VocabularyFolder.getBaseUri(vocabularyFolder); final String folderContextRoot = Props.getRequiredProperty(PropsIF.DD_URL) + "/vocabulary/" + vocabularyFolder.getFolderName() + "/"; final String commonElemsUri = Props.getRequiredProperty(PropsIF.DD_URL) + "/property/"; StreamingResolution result = new StreamingResolution("application/rdf+xml") { @Override public void stream(HttpServletResponse response) throws Exception { VocabularyXmlWriter xmlWriter = new VocabularyXmlWriter(response.getOutputStream()); xmlWriter.writeRDFXml(commonElemsUri, folderContextRoot, contextRoot, vocabularyFolder, concepts, nameSpaces); } }; result.setFilename(vocabularyFolder.getIdentifier() + ".rdf"); return result; } catch (Exception e) { LOGGER.error("Failed to output vocabulary RDF data", e); ErrorResolution error = new ErrorResolution(HttpURLConnection.HTTP_INTERNAL_ERROR); error.setErrorMessage(e.getMessage()); return error; } }
From source file:eionet.web.action.VocabularyFolderActionBean.java
/** * Codelist output in INSPIRE format./* ww w .j a va 2 s . com*/ * * @return xml output */ public Resolution codelist() { try { vocabularyFolder = vocabularyService.getVocabularyWithConcepts(vocabularyFolder.getIdentifier(), vocabularyFolder.getFolderName()); final String folderContextRoot = Props.getRequiredProperty(PropsIF.DD_URL); StreamingResolution result = new StreamingResolution("application/xml") { @Override public void stream(HttpServletResponse response) throws Exception { InspireCodelistXmlWriter xmlWriter = new InspireCodelistXmlWriter(response.getOutputStream(), vocabularyFolder, folderContextRoot); xmlWriter.writeXml(); } }; result.setFilename(vocabularyFolder.getIdentifier() + ".xml"); return result; } catch (Exception e) { LOGGER.error("Failed to output vocabulary XML data in ISPIRE format", e); ErrorResolution error = new ErrorResolution(HttpURLConnection.HTTP_INTERNAL_ERROR); error.setErrorMessage(e.getMessage()); return error; } }
From source file:eionet.web.action.VocabularyFolderActionBean.java
/** * Returns vocabulary concepts CSV.//from w w w . jav a 2 s . c o m * * @return resolution */ public Resolution csv() { try { vocabularyFolder = vocabularyService.getVocabularyFolder(vocabularyFolder.getFolderName(), vocabularyFolder.getIdentifier(), vocabularyFolder.isWorkingCopy()); validateView(); if (vocabularyFolder.isDraftStatus()) { throw new RuntimeException("Vocabulary is not in released or public draft status."); } final String folderContextRoot = VocabularyFolder.getBaseUri(vocabularyFolder); final List<VocabularyConcept> concepts = vocabularyService .getValidConceptsWithAttributes(vocabularyFolder.getId()); final List<Triple<String, String, Integer>> fieldNamesWithLanguage = vocabularyService .getVocabularyBoundElementNamesByLanguage(vocabularyFolder); StreamingResolution result = new StreamingResolution("text/csv") { @Override public void stream(HttpServletResponse response) throws Exception { VocabularyCSVOutputHelper.writeCSV(response.getOutputStream(), getUriPrefix(), folderContextRoot, concepts, fieldNamesWithLanguage); } }; result.setFilename(vocabularyFolder.getIdentifier() + ".csv"); return result; } catch (Exception e) { LOGGER.error("Failed to output vocabulary CSV data", e); ErrorResolution error = new ErrorResolution(HttpURLConnection.HTTP_INTERNAL_ERROR); error.setErrorMessage(e.getMessage()); return error; } }
From source file:org.betaconceptframework.astroboa.resourceapi.resource.ContentObjectResource.java
private Response saveContentFromMultipartRelatedRequest(String contentObjectIdOrName, MultipartRelatedInput multipartRelatedInput, String httpMethod, boolean updateLastModificationTime) { try {//from w w w .ja va 2 s.c om //Obtain the part which contains the object's JSON/XML InputPart partWhichContainsObjectSource = getMessagePartWithObjectSource(multipartRelatedInput); //Check that mime type of the content is a valid one ResourceRepresentationType resourceRepresentationType = checkMediaTypeIsValid( partWhichContainsObjectSource); ContentObject contentObjectToBeSaved = retrieveObjectSourceFromMessageAndImportWithoutSave( multipartRelatedInput, partWhichContainsObjectSource); boolean entityIsNew = objectIsNew(contentObjectIdOrName, httpMethod, contentObjectToBeSaved); //Save content object try { contentObjectToBeSaved = astroboaClient.getContentService().save(contentObjectToBeSaved, false, updateLastModificationTime, null); return ContentApiUtils.createSuccessfulResponseForPUTOrPOST(contentObjectToBeSaved, httpMethod, resourceRepresentationType, entityIsNew); } catch (CmsUnauthorizedAccessException e) { throw new WebApplicationException(HttpURLConnection.HTTP_UNAUTHORIZED); } catch (Exception e) { logger.error("", e); throw new WebApplicationException(e, HttpURLConnection.HTTP_INTERNAL_ERROR); } } catch (WebApplicationException e) { throw e; } catch (Exception e) { throw new WebApplicationException( ContentApiUtils.createResponseForException(Status.INTERNAL_SERVER_ERROR, e, true, "A problem occured while saving form data for object with id or system name: " + contentObjectIdOrName)); } }