Search in sources :

Example 1 with FailedPreprocessorDTO

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);
    }
}
Also used : FailedFilterDTO(org.osgi.service.http.runtime.dto.FailedFilterDTO) ResourceInfo(org.apache.felix.http.base.internal.runtime.ResourceInfo) FailedErrorPageDTO(org.osgi.service.http.runtime.dto.FailedErrorPageDTO) FailedServletDTO(org.osgi.service.http.runtime.dto.FailedServletDTO) FailedResourceDTO(org.osgi.service.http.runtime.dto.FailedResourceDTO) PreprocessorInfo(org.apache.felix.http.base.internal.runtime.PreprocessorInfo) ServletInfo(org.apache.felix.http.base.internal.runtime.ServletInfo) ListenerInfo(org.apache.felix.http.base.internal.runtime.ListenerInfo) ServletContextHelperInfo(org.apache.felix.http.base.internal.runtime.ServletContextHelperInfo) FailedListenerDTO(org.osgi.service.http.runtime.dto.FailedListenerDTO) FailedPreprocessorDTO(org.osgi.service.http.runtime.dto.FailedPreprocessorDTO) FailedServletContextDTO(org.osgi.service.http.runtime.dto.FailedServletContextDTO) FilterInfo(org.apache.felix.http.base.internal.runtime.FilterInfo)

Example 2 with FailedPreprocessorDTO

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;
}
Also used : FailedFilterDTO(org.osgi.service.http.runtime.dto.FailedFilterDTO) FailedErrorPageDTO(org.osgi.service.http.runtime.dto.FailedErrorPageDTO) FailedServletDTO(org.osgi.service.http.runtime.dto.FailedServletDTO) FailedListenerDTO(org.osgi.service.http.runtime.dto.FailedListenerDTO) FailedResourceDTO(org.osgi.service.http.runtime.dto.FailedResourceDTO) FailedPreprocessorDTO(org.osgi.service.http.runtime.dto.FailedPreprocessorDTO) RuntimeDTO(org.osgi.service.http.runtime.dto.RuntimeDTO) FailedServletContextDTO(org.osgi.service.http.runtime.dto.FailedServletContextDTO)

Example 3 with FailedPreprocessorDTO

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;
}
Also used : PreprocessorDTO(org.osgi.service.http.runtime.dto.PreprocessorDTO) FailedPreprocessorDTO(org.osgi.service.http.runtime.dto.FailedPreprocessorDTO) FailedPreprocessorDTO(org.osgi.service.http.runtime.dto.FailedPreprocessorDTO) Nonnull(javax.annotation.Nonnull)

Aggregations

FailedPreprocessorDTO (org.osgi.service.http.runtime.dto.FailedPreprocessorDTO)3 FailedErrorPageDTO (org.osgi.service.http.runtime.dto.FailedErrorPageDTO)2 FailedFilterDTO (org.osgi.service.http.runtime.dto.FailedFilterDTO)2 FailedListenerDTO (org.osgi.service.http.runtime.dto.FailedListenerDTO)2 FailedResourceDTO (org.osgi.service.http.runtime.dto.FailedResourceDTO)2 FailedServletContextDTO (org.osgi.service.http.runtime.dto.FailedServletContextDTO)2 FailedServletDTO (org.osgi.service.http.runtime.dto.FailedServletDTO)2 Nonnull (javax.annotation.Nonnull)1 FilterInfo (org.apache.felix.http.base.internal.runtime.FilterInfo)1 ListenerInfo (org.apache.felix.http.base.internal.runtime.ListenerInfo)1 PreprocessorInfo (org.apache.felix.http.base.internal.runtime.PreprocessorInfo)1 ResourceInfo (org.apache.felix.http.base.internal.runtime.ResourceInfo)1 ServletContextHelperInfo (org.apache.felix.http.base.internal.runtime.ServletContextHelperInfo)1 ServletInfo (org.apache.felix.http.base.internal.runtime.ServletInfo)1 PreprocessorDTO (org.osgi.service.http.runtime.dto.PreprocessorDTO)1 RuntimeDTO (org.osgi.service.http.runtime.dto.RuntimeDTO)1