summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/cms/servlet/base
diff options
context:
space:
mode:
Diffstat (limited to 'base/common/src/com/netscape/cms/servlet/base')
-rw-r--r--base/common/src/com/netscape/cms/servlet/base/BadRequestException.java2
-rw-r--r--base/common/src/com/netscape/cms/servlet/base/CMSResourceService.java4
-rw-r--r--base/common/src/com/netscape/cms/servlet/base/CMSServlet.java5
-rw-r--r--base/common/src/com/netscape/cms/servlet/base/UnauthorizedException.java43
4 files changed, 51 insertions, 3 deletions
diff --git a/base/common/src/com/netscape/cms/servlet/base/BadRequestException.java b/base/common/src/com/netscape/cms/servlet/base/BadRequestException.java
index f33baa487..b5c5e0b12 100644
--- a/base/common/src/com/netscape/cms/servlet/base/BadRequestException.java
+++ b/base/common/src/com/netscape/cms/servlet/base/BadRequestException.java
@@ -23,7 +23,7 @@ public class BadRequestException extends CMSException {
private static final long serialVersionUID = -4784839378360933483L;
public BadRequestException(String message) {
- super(Response.Status.BAD_REQUEST,message);
+ super(Response.Status.BAD_REQUEST, message);
}
public BadRequestException(String message, Throwable cause) {
diff --git a/base/common/src/com/netscape/cms/servlet/base/CMSResourceService.java b/base/common/src/com/netscape/cms/servlet/base/CMSResourceService.java
index d6b4a9e42..48daeca6e 100644
--- a/base/common/src/com/netscape/cms/servlet/base/CMSResourceService.java
+++ b/base/common/src/com/netscape/cms/servlet/base/CMSResourceService.java
@@ -94,7 +94,7 @@ public class CMSResourceService {
throws CertificateEncodingException {
CertificateData data = new CertificateData();
String b64 = HEADER + CMS.BtoA(cert.getEncoded()) + TRAILER;
- data.setB64(b64);
+ data.setEncoded(b64);
return data;
}
@@ -120,7 +120,7 @@ public class CMSResourceService {
null,
source,
level,
- getClass().getSimpleName()+": " + message);
+ getClass().getSimpleName() + ": " + message);
}
public void audit(String message, String scope, String type, String id, Map<String, String> params, String status) {
diff --git a/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java b/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java
index f035285e2..2273abc21 100644
--- a/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java
+++ b/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java
@@ -208,6 +208,8 @@ public abstract class CMSServlet extends HttpServlet {
// members.
+ protected ServletConfig servletConfig;
+
protected boolean mRenderResult = true;
protected String mFinalErrorMsg = FINAL_ERROR_MSG;
protected Hashtable<Integer, CMSLoadTemplate> mTemplates = new Hashtable<Integer, CMSLoadTemplate>();
@@ -271,6 +273,9 @@ public abstract class CMSServlet extends HttpServlet {
public void init(ServletConfig sc) throws ServletException {
super.init(sc);
+
+ this.servletConfig = sc;
+
mAuthz = (IAuthzSubsystem) CMS.getSubsystem(CMS.SUBSYSTEM_AUTHZ);
mId = sc.getInitParameter(PROP_ID);
diff --git a/base/common/src/com/netscape/cms/servlet/base/UnauthorizedException.java b/base/common/src/com/netscape/cms/servlet/base/UnauthorizedException.java
new file mode 100644
index 000000000..7dfa3d6d4
--- /dev/null
+++ b/base/common/src/com/netscape/cms/servlet/base/UnauthorizedException.java
@@ -0,0 +1,43 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2012 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+
+package com.netscape.cms.servlet.base;
+
+import javax.ws.rs.core.Response;
+
+/**
+ * @author Endi S. Dewata
+ */
+public class UnauthorizedException extends CMSException {
+
+ private static final long serialVersionUID = -2025082875126996556L;
+
+ public UnauthorizedException(String message) {
+ super(Response.Status.UNAUTHORIZED, message);
+ }
+
+ public UnauthorizedException(String message, Throwable cause) {
+ super(Response.Status.UNAUTHORIZED, message, cause);
+ }
+
+ public UnauthorizedException(Data data) {
+ super(data);
+ }
+
+}
+