Search in sources :

Example 6 with FailedErrorPageDTO

use of org.osgi.service.http.runtime.dto.FailedErrorPageDTO in project felix by apache.

the class ErrorPageRegistry method getRuntimeInfo.

/**
 * Get DTOs for error pages.
 * @param dto The servlet context DTO
 * @param failedErrorPageDTOs The failed error page DTOs
 */
public void getRuntimeInfo(final ServletContextDTO dto, final Collection<FailedErrorPageDTO> failedErrorPageDTOs) {
    final List<ErrorPageDTO> errorPageDTOs = new ArrayList<ErrorPageDTO>();
    final List<ErrorRegistrationStatus> statusList = this.status;
    for (final ErrorRegistrationStatus status : statusList) {
        for (final Map.Entry<Integer, ErrorRegistration> entry : status.reasonMapping.entrySet()) {
            final ErrorPageDTO state = ErrorPageDTOBuilder.build(status.getHandler(), entry.getKey());
            state.errorCodes = Arrays.copyOf(entry.getValue().errorCodes, entry.getValue().errorCodes.length);
            state.exceptions = Arrays.copyOf(entry.getValue().exceptions, entry.getValue().exceptions.length);
            if (entry.getKey() == -1) {
                errorPageDTOs.add(state);
            } else {
                failedErrorPageDTOs.add((FailedErrorPageDTO) state);
            }
        }
    }
    if (!errorPageDTOs.isEmpty()) {
        dto.errorPageDTOs = errorPageDTOs.toArray(new ErrorPageDTO[errorPageDTOs.size()]);
    }
}
Also used : ArrayList(java.util.ArrayList) ErrorPageDTO(org.osgi.service.http.runtime.dto.ErrorPageDTO) FailedErrorPageDTO(org.osgi.service.http.runtime.dto.FailedErrorPageDTO) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Map(java.util.Map)

Example 7 with FailedErrorPageDTO

use of org.osgi.service.http.runtime.dto.FailedErrorPageDTO in project felix by apache.

the class ErrorPageDTOBuilder method build.

/**
 * Build a servlet DTO from a servlet handler
 * @param handler The servlet handler
 * @param reason If reason is -1, a servlet DTO is created, otherwise a failed servlet DTO is returned
 * @return A servlet DTO
 */
public static ErrorPageDTO build(final ServletHandler handler, final int reason) {
    final ErrorPageDTO dto = build(handler.getServletInfo(), reason != -1);
    BaseServletDTOBuilder.fill(dto, handler);
    if (reason != -1) {
        ((FailedErrorPageDTO) dto).failureReason = reason;
    }
    return dto;
}
Also used : ErrorPageDTO(org.osgi.service.http.runtime.dto.ErrorPageDTO) FailedErrorPageDTO(org.osgi.service.http.runtime.dto.FailedErrorPageDTO)

Example 8 with FailedErrorPageDTO

use of org.osgi.service.http.runtime.dto.FailedErrorPageDTO in project felix by apache.

the class ErrorPageDTOBuilder method build.

/**
 * 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;
}
Also used : FailedErrorPageDTO(org.osgi.service.http.runtime.dto.FailedErrorPageDTO) ErrorPageDTO(org.osgi.service.http.runtime.dto.ErrorPageDTO) FailedErrorPageDTO(org.osgi.service.http.runtime.dto.FailedErrorPageDTO)

Aggregations

FailedErrorPageDTO (org.osgi.service.http.runtime.dto.FailedErrorPageDTO)8 ErrorPageDTO (org.osgi.service.http.runtime.dto.ErrorPageDTO)4 FailedFilterDTO (org.osgi.service.http.runtime.dto.FailedFilterDTO)3 FailedListenerDTO (org.osgi.service.http.runtime.dto.FailedListenerDTO)3 FailedResourceDTO (org.osgi.service.http.runtime.dto.FailedResourceDTO)3 FailedServletContextDTO (org.osgi.service.http.runtime.dto.FailedServletContextDTO)3 FailedServletDTO (org.osgi.service.http.runtime.dto.FailedServletDTO)3 RuntimeDTO (org.osgi.service.http.runtime.dto.RuntimeDTO)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 FailedPreprocessorDTO (org.osgi.service.http.runtime.dto.FailedPreprocessorDTO)2 ServletContextDTO (org.osgi.service.http.runtime.dto.ServletContextDTO)2 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Servlet (javax.servlet.Servlet)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