本文整理汇总了Java中javax.ws.rs.ServerErrorException类的典型用法代码示例。如果您正苦于以下问题:Java ServerErrorException类的具体用法?Java ServerErrorException怎么用?Java ServerErrorException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerErrorException类属于javax.ws.rs包,在下文中一共展示了ServerErrorException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Application
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
public Application() {
@SuppressWarnings("resource")
AnnotationConfigApplicationContext ctx =
new AnnotationConfigApplicationContext();
ctx.register(FhirServiceConfig.class);
ctx.refresh();
classes.add(CORSFilter.class);
FhirService fhirService = ctx.getBean(FhirService.class);
try {
fhirService.initialize(ctx.getBean(FhirTerminologyProviderService.class));
} catch (BeansException | JAXBException e) {
throw new ServerErrorException(Response.Status.SERVICE_UNAVAILABLE, e);
}
singletons.add(fhirService);
}
示例2: _addUser
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
private User _addUser(
PersonCreatorForm personCreatorForm, Company company) {
try {
return _userLocalService.addUser(
UserConstants.USER_ID_DEFAULT, company.getCompanyId(), false,
personCreatorForm.getPassword1(),
personCreatorForm.getPassword2(),
personCreatorForm.hasAlternateName(),
personCreatorForm.getAlternateName(),
personCreatorForm.getEmail(), 0, StringPool.BLANK,
LocaleUtil.getDefault(), personCreatorForm.getGivenName(),
StringPool.BLANK, personCreatorForm.getFamilyName(), 0, 0,
personCreatorForm.isMale(),
personCreatorForm.getBirthdayMonth(),
personCreatorForm.getBirthdayDay(),
personCreatorForm.getBirthdayYear(),
personCreatorForm.getJobTitle(), null, null, null, null, false,
new ServiceContext());
}
catch (PortalException pe) {
throw new ServerErrorException(500, pe);
}
}
示例3: _getPageItems
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
private PageItems<DLFileEntry> _getPageItems(
Pagination pagination, Long dlFolderId) {
try {
DLFolder dlFolder = _dlFolderService.getFolder(dlFolderId);
List<DLFileEntry> dlFileEntries =
_dlFileEntryService.getFileEntries(
dlFolder.getGroupId(), dlFolder.getFolderId(),
pagination.getStartPosition(), pagination.getEndPosition(),
null);
int count = _dlFileEntryService.getFileEntriesCount(
dlFolder.getGroupId(), dlFolder.getFolderId());
return new PageItems<>(dlFileEntries, count);
}
catch (PortalException pe) {
throw new ServerErrorException(500, pe);
}
}
示例4: getMembers
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
/**
* Auto-complete method to search for members
*
* @param member
* A query string that will be matched against email and
* signature
* @param offset
* If paging is required, the offset into the result set
* @param limit
* If paging is required, the number of rows to return
* @return A list of members matching the query string
* @throws ServerErrorException
*/
public Response getMembers(String member, Integer offset, Integer limit) throws ServerErrorException {
try {
// Get the DAO implementation
MemberDAO memberDAO = DAOProvider.getDAO(MemberDAO.class);
// Perform the search
List<MemberDTO> memberDTOs = memberDAO.findByEmailOrSignature(member, offset, limit);
// Convert the result
List<Member> members = memberConverter.convertPublic(memberDTOs);
// Return the result
return Response.status(200).entity(members).build();
} catch (Exception e) {
Response response = ResponseUtils.serverError(e);
throw new ServerErrorException(response);
}
}
示例5: refreshLocks
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
void refreshLocks() {
try {
TrpCollection col = collectionsSelector.getSelectedCollection();
int colId = (col == null || isShowAllLocks()) ? -1 : col.getColId();
int docId = parseDocId();
logger.debug("listing locks from server, colId = "+colId+" docId = "+docId);
List<PageLock> locks = store.listPageLocks(colId, -1, -1);
// filter docId locally:
if (docId != -1) {
for (ListIterator<PageLock> it = locks.listIterator(); it.hasNext(); ) {
PageLock l = it.next();
if (l.getDocId() != docId)
it.remove();
logger.debug("logged in at " + l.getLoginTime());
}
}
logger.debug("got "+locks.size()+" locks!");
refreshList(locks);
} catch (SessionExpiredException | ServerErrorException | IllegalArgumentException | NoConnectionException e1) {
onError("Error loading page locks", e1);
}
}
示例6: okPressed
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
@Override
protected void okPressed()
{
if(titleField.getText().length() < 1){
//print some error message
MessageBox messageBox = new MessageBox(getShell(), SWT.ICON_ERROR);
messageBox.setMessage("Feature must have a title!");
int rc = messageBox.open();
return;
}
feat.setTitle(titleField.getText());
feat.setDescription(descField.getText());
try {
Storage.getInstance().storeEdFeature(feat, colCheckbox.getSelection());
} catch (SessionExpiredException | ServerErrorException | IllegalArgumentException
| NoConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
efd.updateFeatures();
efd.updateEditDecl();
super.okPressed();
}
示例7: getAvailFeatures
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
public List<EdFeature> getAvailFeatures() throws NoConnectionException, SessionExpiredException, ServerErrorException, IllegalArgumentException {
// checkConnection(true);
List<EdFeature> features;
if(isLoggedIn() && isRemoteDoc()){
features = conn.getEditDeclFeatures(getCurrentDocumentCollectionId());
} else {
try {
features = new TrpServerConn(TrpServerConn.PROD_SERVER_URI).getEditDeclFeatures(0);
} catch (LoginException e) {
//is only thrown if uriStr is null or empty
e.printStackTrace();
features = new ArrayList<>(0);
}
}
return features;
}
示例8: getTags
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
/**
* Retrieves tags.
* @param offset If paging is required, the offset into the result set
* @param limit If paging is required, the number of rows to return
* @return A list of tags
* @throws ServerErrorException If internal error occurs
*/
public Response getTags(Integer offset, Integer limit)
throws ServerErrorException
{
try {
// Get DAO implementation
TagDAO tagDAO = DAOProvider.getDAO(TagDAO.class);
// Get list of tags
List<TagDTO> tagsDTOs = tagDAO.findAll(offset, limit);
// Convert to beans
List<Tag> tags = converter.convert(tagsDTOs);
// Return result
return Response.status(200).entity(tags).build();
}
catch (Exception e) {
Response response = ResponseUtils.serverError(e);
throw new ServerErrorException(response);
}
}
示例9: getWebApplicationExceptionClass
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
public static Class<? extends WebApplicationException> getWebApplicationExceptionClass(Response response) {
int status = response.getStatus();
final Class<? extends WebApplicationException> exceptionType = EXCEPTIONS_MAP.get(status);
if (exceptionType == null) {
final int family = status / 100;
switch (family) {
case 3:
return RedirectionException.class;
case 4:
return ClientErrorException.class;
case 5:
return ServerErrorException.class;
default:
return WebApplicationException.class;
}
}
return exceptionType;
}
示例10: testCreateException
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
@Test
public void testCreateException() {
assertExceptionType(Response.Status.INTERNAL_SERVER_ERROR, InternalServerErrorException.class);
assertExceptionType(Response.Status.NOT_FOUND, NotFoundException.class);
assertExceptionType(Response.Status.FORBIDDEN, ForbiddenException.class);
assertExceptionType(Response.Status.BAD_REQUEST, BadRequestException.class);
assertExceptionType(Response.Status.METHOD_NOT_ALLOWED, NotAllowedException.class);
assertExceptionType(Response.Status.UNAUTHORIZED, NotAuthorizedException.class);
assertExceptionType(Response.Status.NOT_ACCEPTABLE, NotAcceptableException.class);
assertExceptionType(Response.Status.UNSUPPORTED_MEDIA_TYPE, NotSupportedException.class);
assertExceptionType(Response.Status.SERVICE_UNAVAILABLE, ServiceUnavailableException.class);
assertExceptionType(Response.Status.TEMPORARY_REDIRECT, RedirectionException.class);
assertExceptionType(Response.Status.LENGTH_REQUIRED, ClientErrorException.class);
assertExceptionType(Response.Status.BAD_GATEWAY, ServerErrorException.class);
assertExceptionType(Response.Status.NO_CONTENT, WebApplicationException.class);
}
示例11: getCountries
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
public List<String> getCountries(){
if(countries != null){
return countries;
}
URI uri = UriBuilder.fromUri(restServiceAddress + "/rest/v1/all").build();
Client client = ClientBuilder.newClient();
Response response = client.target(uri).request(MediaType.APPLICATION_JSON_TYPE).get();
try {
String json = response.readEntity(String.class);
countries = extractCountriesFromJSon(json);
countries.sort(String::compareTo);
} catch (JSONException e) {
throw new ServerErrorException(Response.Status.INTERNAL_SERVER_ERROR);
}
return countries;
}
示例12: changeVersionStatus
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
private void changeVersionStatus(String text){
Storage storage = Storage.getInstance();
String pages = getPagesString();
String[] pageList = pages.split(",");
if (!pages.equals("") && pageList.length >= 1){
for (String page : pageList){
int pageNr = Integer.valueOf(page);
int colId = storage.getCurrentDocumentCollectionId();
int docId = storage.getDocId();
int transcriptId = storage.getPage().getCurrentTranscript().getTsId();
try {
storage.getConnection().updatePageStatus(colId, docId, pageNr, transcriptId, EditStatus.fromString(text), "test");
} catch (SessionExpiredException | ServerErrorException | ClientErrorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
示例13: okPressed
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
@Override
protected void okPressed()
{
if(titleField.getText().length() < 1){
//print some error message
MessageBox messageBox = new MessageBox(getShell(), SWT.ICON_ERROR);
messageBox.setMessage("Feature must have a title!");
int rc = messageBox.open();
return;
}
feat.setTitle(titleField.getText());
feat.setDescription(descField.getText());
try {
Storage.getInstance().storeEdFeature(feat, colCheckbox.getSelection());
} catch (SessionExpiredException | ServerErrorException | IllegalArgumentException
| NoConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
efd.updateFeatures();
super.okPressed();
}
示例14: saveTranscriptsMap
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
/**
* Saves all transcripts in transcriptsMap.
* @param transcriptsMap A map of the transcripts to save. The map's key is the page-id, its value is a pair of the collection-id and the
* corresponding TrpPageType object to save as newest version.
* @param monitor A progress monitor that can also be null is no GUI status update is needed.
*/
public void saveTranscriptsMap(Map<Integer, Pair<Integer, TrpPageType>> transcriptsMap, IProgressMonitor monitor)
throws SessionExpiredException, ServerErrorException, IllegalArgumentException, Exception {
if (monitor != null)
monitor.beginTask("Saving affected transcripts", transcriptsMap.size());
int c = 0;
for (Pair<Integer, TrpPageType> ptPair : transcriptsMap.values()) {
if (monitor != null && monitor.isCanceled())
return;
saveTranscript(ptPair.getLeft(), ptPair.getRight(), null, ptPair.getRight().getMd().getTsId(), "Tagged from text");
if (monitor != null)
monitor.worked(c++);
++c;
}
}
示例15: analyzeLayoutOnLatestTranscriptOfPages
import javax.ws.rs.ServerErrorException; //导入依赖的package包/类
/**
* Wrapper method which takes a pages range string of the currently loaded document
*/
public List<String> analyzeLayoutOnLatestTranscriptOfPages(String pageStr, boolean doBlockSeg, boolean doLineSeg, boolean doWordSeg, boolean doPolygonToBaseline, boolean doBaselineToPolygon, String jobImpl, String pars) throws SessionExpiredException, ServerErrorException, ClientErrorException, IllegalArgumentException, NoConnectionException, IOException {
checkConnection(true);
if (!isRemoteDoc()) {
throw new IOException("No remote doc loaded!");
}
int colId = getCurrentDocumentCollectionId();
DocumentSelectionDescriptor dd = getDoc().getDocSelectionDescriptorForPagesString(pageStr);
List<DocumentSelectionDescriptor> dsds = new ArrayList<>();
dsds.add(dd);
List<String> jobids = new ArrayList<>();
List<TrpJobStatus> jobs = conn.analyzeLayout(colId, dsds, doBlockSeg, doLineSeg, doWordSeg, doPolygonToBaseline, doBaselineToPolygon, jobImpl, pars);
for (TrpJobStatus j : jobs) {
jobids.add(j.getJobId());
}
return jobids;
}