Skip to content

Commit

Permalink
Remove server classes from common library
Browse files Browse the repository at this point in the history
Status codes were retrieved from tomcat servlet.jar package but since
the common package should be used in the server as well as the client
this dependency has been removed and the codes are retrieved from
httpcore package.
  • Loading branch information
fmarco76 committed Aug 21, 2024
1 parent f92a844 commit 5c644ce
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion base/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ javac(pki-common-classes
src/main/java/*.java
CLASSPATH
${SLF4J_API_JAR}
${LDAPJDK_JAR} ${SERVLET_JAR}
${LDAPJDK_JAR}
${JSS_JAR}
${COMMONS_CODEC_JAR} ${COMMONS_IO_JAR}
${COMMONS_LANG3_JAR} ${COMMONS_CLI_JAR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.base;
import javax.servlet.http.HttpServletResponse;

import org.apache.http.HttpStatus;

public class BadRequestException extends PKIException {

private static final long serialVersionUID = -4784839378360933483L;

public BadRequestException(String message) {
super(HttpServletResponse.SC_BAD_REQUEST, message);
super(HttpStatus.SC_BAD_REQUEST, message);
}

public BadRequestException(String message, Throwable cause) {
super(HttpServletResponse.SC_BAD_REQUEST, message, cause);
super(HttpStatus.SC_BAD_REQUEST, message, cause);
}

public BadRequestException(Data data) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.netscape.certsrv.base;

import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;

public class ConflictingOperationException extends PKIException {

private static final long serialVersionUID = -5780172673428115193L;

public ConflictingOperationException(String message) {
super(HttpServletResponse.SC_CONFLICT, message);
super(HttpStatus.SC_CONFLICT, message);
}

public ConflictingOperationException(String message, Throwable cause) {
super(HttpServletResponse.SC_CONFLICT, message, cause);
super(HttpStatus.SC_CONFLICT, message, cause);
}

public ConflictingOperationException(Data data) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.netscape.certsrv.base;

import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;

public class ForbiddenException extends PKIException {
private static final long serialVersionUID = 3199015969025638546L;

public ForbiddenException(String message) {
super(HttpServletResponse.SC_FORBIDDEN, message);
super(HttpStatus.SC_FORBIDDEN, message);
}

public ForbiddenException(String message, Throwable cause) {
super(HttpServletResponse.SC_FORBIDDEN, message, cause);
super(HttpStatus.SC_FORBIDDEN, message, cause);
}

public ForbiddenException(Data data) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.netscape.certsrv.base;

import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;

public class HTTPGoneException extends PKIException {

private static final long serialVersionUID = 1256191208802745690L;

public HTTPGoneException(String message) {
super(HttpServletResponse.SC_GONE, message);
super(HttpStatus.SC_GONE, message);
}

public HTTPGoneException(String message, Throwable cause) {
super(HttpServletResponse.SC_GONE, message, cause);
super(HttpStatus.SC_GONE, message, cause);
}

public HTTPGoneException(Data data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.StringReader;
import java.io.StringWriter;

import javax.servlet.http.HttpServletResponse;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
Expand All @@ -30,6 +29,7 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.apache.http.HttpStatus;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
Expand All @@ -45,27 +45,27 @@ public class PKIException extends RuntimeException {

private static final long serialVersionUID = 6000910362260369923L;

public int code;
private int code;

public PKIException(int code, String message, Throwable cause) {
super(message, cause);
this.code = code;
}

public PKIException(String message) {
this(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message, null);
this(HttpStatus.SC_INTERNAL_SERVER_ERROR, message, null);
}

public PKIException(int code, String message) {
this(code, message, null);
}

public PKIException(Throwable cause) {
this(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, cause.getMessage(), cause);
this(HttpStatus.SC_INTERNAL_SERVER_ERROR, cause.getMessage(), cause);
}

public PKIException(String message, Throwable cause) {
this(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message, cause);
this(HttpStatus.SC_INTERNAL_SERVER_ERROR, message, cause);
}

public PKIException(Data data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
package com.netscape.certsrv.base;

import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;

/**
* @author Marco Fargetta {@literal <[email protected]>}
Expand All @@ -15,11 +15,11 @@ public class RequestNotAcceptable extends PKIException {
private static final long serialVersionUID = 1L;

public RequestNotAcceptable(String message) {
super(HttpServletResponse.SC_NOT_ACCEPTABLE, message);
super(HttpStatus.SC_NOT_ACCEPTABLE, message);
}

public RequestNotAcceptable(String message, Throwable cause) {
super(HttpServletResponse.SC_NOT_ACCEPTABLE, message, cause);
super(HttpStatus.SC_NOT_ACCEPTABLE, message, cause);
}

public RequestNotAcceptable(Data data) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.netscape.certsrv.base;

import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;

public class ResourceNotFoundException extends PKIException {

private static final long serialVersionUID = 2283994502912462263L;

public ResourceNotFoundException(String message) {
super(HttpServletResponse.SC_NOT_FOUND, message);
super(HttpStatus.SC_NOT_FOUND, message);
}

public ResourceNotFoundException(String message, Throwable cause) {
super(HttpServletResponse.SC_NOT_FOUND, message, cause);
super(HttpStatus.SC_NOT_FOUND, message, cause);
}

public ResourceNotFoundException(Data data) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.netscape.certsrv.base;

import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;

public class ServiceUnavailableException extends PKIException {

private static final long serialVersionUID = -9160776882517621347L;

public ServiceUnavailableException(String message) {
super(HttpServletResponse.SC_SERVICE_UNAVAILABLE, message);
super(HttpStatus.SC_SERVICE_UNAVAILABLE, message);
}

public ServiceUnavailableException(String message, Throwable cause) {
super(HttpServletResponse.SC_SERVICE_UNAVAILABLE, message, cause);
super(HttpStatus.SC_SERVICE_UNAVAILABLE, message, cause);
}

public ServiceUnavailableException(Data data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

package com.netscape.certsrv.base;

import javax.servlet.http.HttpServletResponse;

import org.apache.http.HttpStatus;

/**
* @author Endi S. Dewata
Expand All @@ -29,11 +28,11 @@ public class UnauthorizedException extends PKIException {
private static final long serialVersionUID = -2025082875126996556L;

public UnauthorizedException(String message) {
super(HttpServletResponse.SC_UNAUTHORIZED, message);
super(HttpStatus.SC_UNAUTHORIZED, message);
}

public UnauthorizedException(String message, Throwable cause) {
super(HttpServletResponse.SC_UNAUTHORIZED, message, cause);
super(HttpStatus.SC_UNAUTHORIZED, message, cause);
}

public UnauthorizedException(Data data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
package com.netscape.certsrv.base;

import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;

/**
* @author Marco Fargetta {@literal <[email protected]>}
Expand All @@ -15,11 +15,11 @@ public class UnsupportedMediaType extends PKIException {
private static final long serialVersionUID = 1L;

public UnsupportedMediaType(String message) {
super(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message);
super(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE, message);
}

public UnsupportedMediaType(String message, Throwable cause) {
super(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message, cause);
super(HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE, message, cause);
}

public UnsupportedMediaType(Data data) {
Expand Down

0 comments on commit 5c644ce

Please sign in to comment.