use of org.osgi.service.http.runtime.dto.FailedPreprocessorDTO in project felix by apache.
the class FailedDTOHolder method add.
public void add(final AbstractInfo<?> info, final long contextId, final int failureCode) {
if (info instanceof ServletContextHelperInfo) {
final FailedServletContextDTO dto = (FailedServletContextDTO) ServletContextDTOBuilder.build((ServletContextHelperInfo) info, null, failureCode);
this.failedServletContextDTOs.add(dto);
} else if (info instanceof ServletInfo) {
boolean isError = false;
if (((ServletInfo) info).getErrorPage() != null) {
isError = true;
final FailedErrorPageDTO dto = (FailedErrorPageDTO) ErrorPageDTOBuilder.build((ServletInfo) info, true);
dto.failureReason = failureCode;
final ErrorPageRegistry.ErrorRegistration reg = ErrorPageRegistry.getErrorRegistration((ServletInfo) info);
dto.errorCodes = reg.errorCodes;
dto.exceptions = reg.exceptions;
dto.servletContextId = contextId;
this.failedErrorPageDTOs.add(dto);
}
if (((ServletInfo) info).getPatterns() != null || ((ServletInfo) info).getName() != null || !isError) {
final FailedServletDTO dto = (FailedServletDTO) ServletDTOBuilder.build((ServletInfo) info, failureCode);
if (((ServletInfo) info).getPatterns() != null) {
dto.patterns = ((ServletInfo) info).getPatterns();
} else {
dto.patterns = BuilderConstants.EMPTY_STRING_ARRAY;
}
dto.name = ((ServletInfo) info).getName();
dto.servletContextId = contextId;
this.failedServletDTOs.add(dto);
}
} else if (info instanceof FilterInfo) {
final FailedFilterDTO dto = (FailedFilterDTO) FilterDTOBuilder.build((FilterInfo) info, failureCode);
dto.failureReason = failureCode;
dto.servletContextId = contextId;
this.failedFilterDTOs.add(dto);
} else if (info instanceof ResourceInfo) {
final FailedResourceDTO dto = (FailedResourceDTO) ResourceDTOBuilder.build((ResourceInfo) info, true);
dto.failureReason = failureCode;
dto.servletContextId = contextId;
this.failedResourceDTOs.add(dto);
} else if (info instanceof ListenerInfo) {
final FailedListenerDTO dto = (FailedListenerDTO) ListenerDTOBuilder.build((ListenerInfo) info, failureCode);
dto.servletContextId = contextId;
this.failedListenerDTOs.add(dto);
} else if (info instanceof PreprocessorInfo) {
final FailedPreprocessorDTO dto = (FailedPreprocessorDTO) PreprocessorDTOBuilder.build((PreprocessorInfo) info, failureCode);
this.failedPreprocessorDTOs.add(dto);
} else {
SystemLogger.error("Unsupported info type: " + info.getClass(), null);
}
}
use of org.osgi.service.http.runtime.dto.FailedPreprocessorDTO in project felix by apache.
the class RuntimeDTOBuilder method build.
public RuntimeDTO build() {
final RuntimeDTO runtimeDTO = new RuntimeDTO();
runtimeDTO.serviceDTO = createServiceDTO();
runtimeDTO.servletContextDTOs = createContextDTOs();
runtimeDTO.preprocessorDTOs = createPreprocessorDTOs();
runtimeDTO.failedErrorPageDTOs = registry.getFailedDTOHolder().failedErrorPageDTOs.toArray(new FailedErrorPageDTO[registry.getFailedDTOHolder().failedErrorPageDTOs.size()]);
runtimeDTO.failedFilterDTOs = registry.getFailedDTOHolder().failedFilterDTOs.toArray(new FailedFilterDTO[registry.getFailedDTOHolder().failedFilterDTOs.size()]);
runtimeDTO.failedListenerDTOs = registry.getFailedDTOHolder().failedListenerDTOs.toArray(new FailedListenerDTO[registry.getFailedDTOHolder().failedListenerDTOs.size()]);
runtimeDTO.failedResourceDTOs = registry.getFailedDTOHolder().failedResourceDTOs.toArray(new FailedResourceDTO[registry.getFailedDTOHolder().failedResourceDTOs.size()]);
runtimeDTO.failedServletContextDTOs = registry.getFailedDTOHolder().failedServletContextDTOs.toArray(new FailedServletContextDTO[registry.getFailedDTOHolder().failedServletContextDTOs.size()]);
runtimeDTO.failedServletDTOs = registry.getFailedDTOHolder().failedServletDTOs.toArray(new FailedServletDTO[registry.getFailedDTOHolder().failedServletDTOs.size()]);
runtimeDTO.failedPreprocessorDTOs = registry.getFailedDTOHolder().failedPreprocessorDTOs.toArray(new FailedPreprocessorDTO[registry.getFailedDTOHolder().failedPreprocessorDTOs.size()]);
return runtimeDTO;
}
use of org.osgi.service.http.runtime.dto.FailedPreprocessorDTO in project felix by apache.
the class PreprocessorDTOBuilder method build.
/**
* Build a preprocessor DTO from a filter info
* @param info The preprocessor info
* @return A preprocessor DTO
*/
@Nonnull
public static PreprocessorDTO build(@Nonnull final PreprocessorInfo info, final int reason) {
final PreprocessorDTO dto = (reason != -1 ? new FailedPreprocessorDTO() : new PreprocessorDTO());
dto.initParams = info.getInitParameters();
dto.serviceId = info.getServiceId();
if (reason != -1) {
((FailedPreprocessorDTO) dto).failureReason = reason;
}
return dto;
}
Aggregations