/** * Build a servlet DTO from a servlet info * @param info The servlet info * @return A servlet DTO */ public static ErrorPageDTO build(final ServletInfo info, final boolean failed) { final ErrorPageDTO dto = (failed ? new FailedErrorPageDTO() : new ErrorPageDTO()); BaseServletDTOBuilder.fill(dto, info); dto.errorCodes = BuilderConstants.EMPTY_LONG_ARRAY; dto.exceptions = BuilderConstants.EMPTY_STRING_ARRAY; return dto; } }
/** * Build a servlet DTO from a servlet info * @param info The servlet info * @return A servlet DTO */ public static ErrorPageDTO build(final ServletInfo info, final boolean failed) { final ErrorPageDTO dto = (failed ? new FailedErrorPageDTO() : new ErrorPageDTO()); BaseServletDTOBuilder.fill(dto, info); dto.errorCodes = BuilderConstants.EMPTY_LONG_ARRAY; dto.exceptions = BuilderConstants.EMPTY_STRING_ARRAY; return dto; } }
private void mapErrorPage(WhiteboardServlet whiteboardErrorPage, List<ErrorPageDTO> errorPageDTOs, List<FailedErrorPageDTO> failedErrorPageDTOs) { ErrorPageDTO dto = new ErrorPageDTO();
private ErrorPageDTO mapServlet(WhiteboardErrorPage whiteboardErrorPage) { ErrorPageDTO dto = new ErrorPageDTO(); try { long code = Long.parseLong(whiteboardErrorPage.getErrorPageMapping().getError()); dto.errorCodes = new long[] {code}; } catch (NumberFormatException nfe) { // OK, not a number must be a class then dto.exceptions = new String[] {whiteboardErrorPage.getErrorPageMapping().getError()}; } dto.serviceId = whiteboardErrorPage.getServiceID(); // whiteboardErrorPage.getErrorPageMapping().getLocation(); //FIXME: the errorpage location is never used by the errorpage dto ... // what really bothers me, the errorpagedto is based on top of a servlet dto, // but error pages aren't servlets !!! Optional<Map.Entry<ServiceReference<ServletContext>, ServletContext>> matchingServletContextEntry = findMatchingServletContext( whiteboardErrorPage.getErrorPageMapping().getHttpContextId()); if (matchingServletContextEntry.isPresent()) { dto.servletContextId = (long) matchingServletContextEntry.get().getKey().getProperty(Constants.SERVICE_ID); } else { // FIXME something wrong...what to do } return dto; }
errorPageDTO = new ErrorPageDTO();
public static ErrorPageDTO clone(ErrorPageDTO original) { ErrorPageDTO clone = new ErrorPageDTO(); clone.asyncSupported = copy(original.asyncSupported); clone.errorCodes = copy(original.errorCodes); clone.exceptions = copy(original.exceptions); clone.initParams = copyStringMap(original.initParams); clone.name = copy(original.name); clone.serviceId = copy(original.serviceId); clone.servletContextId = copy(original.servletContextId); clone.servletInfo = copy(original.servletInfo); return clone; }