Example usage for javax.servlet.http HttpServletRequest getAuthType

List of usage examples for javax.servlet.http HttpServletRequest getAuthType

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getAuthType.

Prototype

public String getAuthType();

Source Link

Document

Returns the name of the authentication scheme used to protect the servlet.

Usage

From source file:it.eng.spago.dispatching.httpchannel.AdapterHTTP.java

/**
 * Sets the http request data.//from   w ww  .j  ava2s  .  c  o  m
 * 
 * @param request the request
 * @param requestContainer the request container
 */
private void setHttpRequestData(HttpServletRequest request, RequestContainer requestContainer) {
    requestContainer.setAttribute(HTTP_REQUEST_AUTH_TYPE, request.getAuthType());
    requestContainer.setAttribute(HTTP_REQUEST_CHARACTER_ENCODING, request.getCharacterEncoding());
    requestContainer.setAttribute(HTTP_REQUEST_CONTENT_LENGTH, String.valueOf(request.getContentLength()));
    requestContainer.setAttribute(HTTP_REQUEST_CONTENT_TYPE, request.getContentType());
    requestContainer.setAttribute(HTTP_REQUEST_CONTEXT_PATH, request.getContextPath());
    requestContainer.setAttribute(HTTP_REQUEST_METHOD, request.getMethod());
    requestContainer.setAttribute(HTTP_REQUEST_PATH_INFO, request.getPathInfo());
    requestContainer.setAttribute(HTTP_REQUEST_PATH_TRANSLATED, request.getPathTranslated());
    requestContainer.setAttribute(HTTP_REQUEST_PROTOCOL, request.getProtocol());
    requestContainer.setAttribute(HTTP_REQUEST_QUERY_STRING, request.getQueryString());
    requestContainer.setAttribute(HTTP_REQUEST_REMOTE_ADDR, request.getRemoteAddr());
    requestContainer.setAttribute(HTTP_REQUEST_REMOTE_HOST, request.getRemoteHost());
    requestContainer.setAttribute(HTTP_REQUEST_REMOTE_USER, request.getRemoteUser());
    requestContainer.setAttribute(HTTP_REQUEST_REQUESTED_SESSION_ID, request.getRequestedSessionId());
    requestContainer.setAttribute(HTTP_REQUEST_REQUEST_URI, request.getRequestURI());
    requestContainer.setAttribute(HTTP_REQUEST_SCHEME, request.getScheme());
    requestContainer.setAttribute(HTTP_REQUEST_SERVER_NAME, request.getServerName());
    requestContainer.setAttribute(HTTP_REQUEST_SERVER_PORT, String.valueOf(request.getServerPort()));
    requestContainer.setAttribute(HTTP_REQUEST_SERVLET_PATH, request.getServletPath());
    if (request.getUserPrincipal() != null)
        requestContainer.setAttribute(HTTP_REQUEST_USER_PRINCIPAL, request.getUserPrincipal());
    requestContainer.setAttribute(HTTP_REQUEST_REQUESTED_SESSION_ID_FROM_COOKIE,
            String.valueOf(request.isRequestedSessionIdFromCookie()));
    requestContainer.setAttribute(HTTP_REQUEST_REQUESTED_SESSION_ID_FROM_URL,
            String.valueOf(request.isRequestedSessionIdFromURL()));
    requestContainer.setAttribute(HTTP_REQUEST_REQUESTED_SESSION_ID_VALID,
            String.valueOf(request.isRequestedSessionIdValid()));
    requestContainer.setAttribute(HTTP_REQUEST_SECURE, String.valueOf(request.isSecure()));
    Enumeration headerNames = request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
        String headerName = (String) headerNames.nextElement();
        String headerValue = request.getHeader(headerName);
        requestContainer.setAttribute(headerName, headerValue);
    } // while (headerNames.hasMoreElements())
    requestContainer.setAttribute(HTTP_SESSION_ID, request.getSession().getId());
    requestContainer.setAttribute(Constants.HTTP_IS_XML_REQUEST, "FALSE");
}

From source file:org.apache.sling.httpauth.impl.AuthorizationHeaderAuthenticationHandler.java

/**
 * Sends back the form to log into the system.
 * /*from w w  w . j a  v  a  2  s .  c  om*/
 * @param request The request object
 * @param response The response object to which to send the request
 * @return <code>true</code> is always returned by this handler
 * @throws IOException if an error occurrs sending back the form.
 */
public boolean requestAuthentication(HttpServletRequest request, HttpServletResponse response)
        throws IOException {

    // if the response is already committed, we have a problem !!
    if (!response.isCommitted()) {

        // reset the response
        response.reset();
        response.setStatus(HttpServletResponse.SC_OK);

        String form = getLoginForm();

        if (form != null) {

            form = replaceVariables(form, "@@contextPath@@", request.getContextPath(), "/");
            form = replaceVariables(form, "@@authType@@", request.getAuthType(), "");
            form = replaceVariables(form, "@@user@@", request.getRemoteUser(), "");

            response.setContentType("text/html");
            response.setCharacterEncoding("UTF-8");
            response.getWriter().print(form);

        } else {

            // have no form, so just send 401/UNATHORIZED for simple login
            sendUnauthorized(response);

        }

    } else {

        log.error("requestAuthentication: Response is committed, cannot request authentication");

    }

    return true;
}

From source file:org.archive.wayback.core.WaybackRequest.java

/**
 * extract REFERER, remote IP and authorization information from the
 * HttpServletRequest/*from  w  w  w.j  ava  2  s  .  com*/
 * 
 * @param httpRequest
 */
private void extractHttpRequestInfo(HttpServletRequest httpRequest) {
    // attempt to get the HTTP referer if present..
    put(WaybackConstants.REQUEST_REFERER_URL, emptyIfNull(httpRequest.getHeader("REFERER")));
    put(WaybackConstants.REQUEST_REMOTE_ADDRESS, emptyIfNull(httpRequest.getRemoteAddr()));
    put(WaybackConstants.REQUEST_WAYBACK_HOSTNAME, emptyIfNull(httpRequest.getLocalName()));
    put(WaybackConstants.REQUEST_WAYBACK_PORT, String.valueOf(httpRequest.getLocalPort()));
    put(WaybackConstants.REQUEST_WAYBACK_CONTEXT, emptyIfNull(httpRequest.getContextPath()));
    put(WaybackConstants.REQUEST_AUTH_TYPE, emptyIfNull(httpRequest.getAuthType()));
    put(WaybackConstants.REQUEST_REMOTE_USER, emptyIfNull(httpRequest.getRemoteUser()));
    put(WaybackConstants.REQUEST_LOCALE_LANG, getUserLocale(httpRequest));

    Cookie[] cookies = httpRequest.getCookies();
    if (cookies != null) {
        for (Cookie cookie : cookies) {
            put(cookie.getName(), cookie.getValue());
        }
    }
}

From source file:org.sakaiproject.portal.util.ErrorReporter.java

@SuppressWarnings("rawtypes")
private String requestDisplay(HttpServletRequest request) {
    ResourceBundle rb = rbDefault;
    StringBuilder sb = new StringBuilder();
    try {/*from ww  w  . j  a  v a2s  . c om*/
        sb.append(rb.getString("bugreport.request")).append("\n");
        sb.append(rb.getString("bugreport.request.authtype")).append(request.getAuthType()).append("\n");
        sb.append(rb.getString("bugreport.request.charencoding")).append(request.getCharacterEncoding())
                .append("\n");
        sb.append(rb.getString("bugreport.request.contentlength")).append(request.getContentLength())
                .append("\n");
        sb.append(rb.getString("bugreport.request.contenttype")).append(request.getContentType()).append("\n");
        sb.append(rb.getString("bugreport.request.contextpath")).append(request.getContextPath()).append("\n");
        sb.append(rb.getString("bugreport.request.localaddr")).append(request.getLocalAddr()).append("\n");
        sb.append(rb.getString("bugreport.request.localname")).append(request.getLocalName()).append("\n");
        sb.append(rb.getString("bugreport.request.localport")).append(request.getLocalPort()).append("\n");
        sb.append(rb.getString("bugreport.request.method")).append(request.getMethod()).append("\n");
        sb.append(rb.getString("bugreport.request.pathinfo")).append(request.getPathInfo()).append("\n");
        sb.append(rb.getString("bugreport.request.protocol")).append(request.getProtocol()).append("\n");
        sb.append(rb.getString("bugreport.request.querystring")).append(request.getQueryString()).append("\n");
        sb.append(rb.getString("bugreport.request.remoteaddr")).append(request.getRemoteAddr()).append("\n");
        sb.append(rb.getString("bugreport.request.remotehost")).append(request.getRemoteHost()).append("\n");
        sb.append(rb.getString("bugreport.request.remoteport")).append(request.getRemotePort()).append("\n");
        sb.append(rb.getString("bugreport.request.requesturl")).append(request.getRequestURL()).append("\n");
        sb.append(rb.getString("bugreport.request.scheme")).append(request.getScheme()).append("\n");
        sb.append(rb.getString("bugreport.request.servername")).append(request.getServerName()).append("\n");
        sb.append(rb.getString("bugreport.request.headers")).append("\n");
        for (Enumeration e = request.getHeaderNames(); e.hasMoreElements();) {
            String headerName = (String) e.nextElement();
            boolean censor = (censoredHeaders.get(headerName) != null);
            for (Enumeration he = request.getHeaders(headerName); he.hasMoreElements();) {
                String headerValue = (String) he.nextElement();
                sb.append(rb.getString("bugreport.request.header")).append(headerName).append(":")
                        .append(censor ? "---censored---" : headerValue).append("\n");
            }
        }
        sb.append(rb.getString("bugreport.request.parameters")).append("\n");
        for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {

            String parameterName = (String) e.nextElement();
            boolean censor = (censoredParameters.get(parameterName) != null);
            String[] paramvalues = request.getParameterValues(parameterName);
            for (int i = 0; i < paramvalues.length; i++) {
                sb.append(rb.getString("bugreport.request.parameter")).append(parameterName).append(":")
                        .append(i).append(":").append(censor ? "----censored----" : paramvalues[i])
                        .append("\n");
            }
        }
        sb.append(rb.getString("bugreport.request.attributes")).append("\n");
        for (Enumeration e = request.getAttributeNames(); e.hasMoreElements();) {
            String attributeName = (String) e.nextElement();
            Object attribute = request.getAttribute(attributeName);
            boolean censor = (censoredAttributes.get(attributeName) != null);
            sb.append(rb.getString("bugreport.request.attribute")).append(attributeName).append(":")
                    .append(censor ? "----censored----" : attribute).append("\n");
        }
        HttpSession session = request.getSession(false);
        if (session != null) {
            DateFormat serverLocaleDateFormat = DateFormat.getDateInstance(DateFormat.FULL,
                    Locale.getDefault());
            sb.append(rb.getString("bugreport.session")).append("\n");
            sb.append(rb.getString("bugreport.session.creation")).append(session.getCreationTime())
                    .append("\n");
            sb.append(rb.getString("bugreport.session.lastaccess")).append(session.getLastAccessedTime())
                    .append("\n");
            sb.append(rb.getString("bugreport.session.creationdatetime"))
                    .append(serverLocaleDateFormat.format(session.getCreationTime())).append("\n");
            sb.append(rb.getString("bugreport.session.lastaccessdatetime"))
                    .append(serverLocaleDateFormat.format(session.getLastAccessedTime())).append("\n");
            sb.append(rb.getString("bugreport.session.maxinactive")).append(session.getMaxInactiveInterval())
                    .append("\n");
            sb.append(rb.getString("bugreport.session.attributes")).append("\n");
            for (Enumeration e = session.getAttributeNames(); e.hasMoreElements();) {
                String attributeName = (String) e.nextElement();
                Object attribute = session.getAttribute(attributeName);
                boolean censor = (censoredAttributes.get(attributeName) != null);
                sb.append(rb.getString("bugreport.session.attribute")).append(attributeName).append(":")
                        .append(censor ? "----censored----" : attribute).append("\n");
            }

        }
    } catch (Exception ex) {
        M_log.error("Failed to generate request display", ex);
        sb.append("Error " + ex.getMessage());
    }

    return sb.toString();
}

From source file:com.egt.core.util.Utils.java

public void trace(String objeto, String metodo, String contexto) {
    System.out.println(objeto + "." + metodo + "(" + contexto + ")");
    FacesContext facesContext = FacesContext.getCurrentInstance();
    System.out.println(objeto + "." + metodo + "(" + facesContext + ")");
    if (facesContext == null) {
        return;//from w  w w .j  a  v  a 2s. co m
    }
    traceContext();
    HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
    System.out.println("request ..................... " + request);
    System.out.println("request.getAuthType ......... " + request.getAuthType());
    System.out.println("request.getUserPrincipal .... " + request.getUserPrincipal());
    Principal principal = facesContext.getExternalContext().getUserPrincipal();
    System.out.println("principal ................... " + principal);
    if (principal != null) {
        System.out.println("principal.getName ........... " + principal.getName());
        System.out.println("isSuperUsuario .............. " + request.isUserInRole("SuperUsuario"));
        System.out.println("isUsuarioEstandar ........... " + request.isUserInRole("UsuarioEstandar"));
        System.out.println("isUsuarioBasico.. ........... " + request.isUserInRole("UsuarioBasico"));
    }
    HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
    HttpSession session = request.getSession(false);
    System.out.println("session ..................... " + facesContext.getExternalContext().getSession(false));
    System.out.println("session.getId ............... " + session.getId());
    String key;
    Object object;
    Set sessionKeys = facesContext.getExternalContext().getSessionMap().keySet();
    if (sessionKeys.isEmpty()) {
    } else {
        Iterator iterator = sessionKeys.iterator();
        while (iterator.hasNext()) {
            object = iterator.next();
            if (object instanceof String) {
                key = (String) object;
                object = facesContext.getExternalContext().getSessionMap().get(key);
                if (object != null) {
                    System.out.println(key + " = (" + object.getClass().getName() + ") " + object);
                }
            }
        }
    }
    System.out.println("request.getContextPath ...... " + request.getContextPath());
    System.out.println("request.getServletPath ...... " + request.getServletPath());
    System.out.println("request.getPathInfo ......... " + request.getPathInfo());
    System.out.println("request.getRequestURI ....... " + request.getRequestURI());
    System.out.println("request.getContextPathURL ... " + request.getRequestURL().toString());
    String clave;
    System.out.println("*** parametros ***");
    Iterator iterator = request.getParameterMap().keySet().iterator();
    while (iterator.hasNext()) {
        clave = (String) iterator.next();
        System.out.println(clave + " = " + request.getParameter(clave));
    }
    String cookieName;
    System.out.println("**** cookies  ****");
    Cookie cookies[] = request.getCookies();
    if (cookies != null) {
        for (int i = 0; i < cookies.length; i++) {
            cookieName = cookies[i].getName();
            System.out.println(cookieName + " = " + cookies[i].getValue());
        }
    }
}

From source file:org.jolokia.http.AgentServlet.java

private void updateAgentDetailsIfNeeded(HttpServletRequest pReq) {
    // Lookup the Agent URL if needed
    AgentDetails details = backendManager.getAgentDetails();
    if (details.isInitRequired()) {
        synchronized (details) {
            if (details.isInitRequired()) {
                if (details.isUrlMissing()) {
                    String url = getBaseUrl(NetworkUtil.sanitizeLocalUrl(pReq.getRequestURL().toString()),
                            extractServletPath(pReq));
                    details.setUrl(url);
                }/* w  w w.j  av  a  2  s .  co m*/
                if (details.isSecuredMissing()) {
                    details.setSecured(pReq.getAuthType() != null);
                }
                details.seal();
            }
        }
    }
}

From source file:org.wso2.carbon.identity.application.authenticator.iwa.IWAAuthenticator.java

@Override
protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response,
        AuthenticationContext context) throws AuthenticationFailedException {
    //Get the authenticated user principle
    Principal principal = request.getUserPrincipal();
    if (principal == null) {
        HttpSession session = request.getSession(false);
        if (session != null) {
            principal = (Principal) session.getAttribute(IWAServelet.PRINCIPAL_SESSION_KEY);
        }/*from w w w  .jav  a  2 s . c  o  m*/
    }

    if (principal == null || principal.getName() == null) {
        if (log.isDebugEnabled()) {
            log.debug("Authenticated principal is null. Therefore authentication is failed.");
        }
        throw new AuthenticationFailedException("Authentication Failed");
    }

    String username = principal.getName();
    username = username.substring(username.indexOf("\\") + 1);

    if (log.isDebugEnabled()) {
        log.debug(
                "Authenticate request received : AuthType - " + request.getAuthType() + ", User - " + username);
    }
    boolean isAuthenticated;
    UserStoreManager userStoreManager;
    // Check the authentication
    try {
        userStoreManager = (UserStoreManager) CarbonContext.getThreadLocalCarbonContext().getUserRealm()
                .getUserStoreManager();
        isAuthenticated = userStoreManager.isExistingUser(MultitenantUtils.getTenantAwareUsername(username));
    } catch (org.wso2.carbon.user.api.UserStoreException e) {
        throw new AuthenticationFailedException("IWAAuthenticator failed while trying to find user existence",
                e);
    }

    if (!isAuthenticated) {
        if (log.isDebugEnabled()) {
            log.debug("user authentication failed, user:" + username + " is not in the user store");
        }
        throw new AuthenticationFailedException("Authentication Failed");
    }
    username = FrameworkUtils.prependUserStoreDomainToName(username);
    context.setSubject(AuthenticatedUser.createLocalAuthenticatedUserFromSubjectIdentifier(username));
}

From source file:org.wso2.carbon.identity.application.authenticator.iwa.ntlm.IWAAuthenticator.java

@Override
protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response,
        AuthenticationContext context) throws AuthenticationFailedException {
    //Get the authenticated user principle
    Principal principal = request.getUserPrincipal();
    if (principal == null) {
        HttpSession session = request.getSession(false);
        if (session != null) {
            principal = (Principal) session.getAttribute(IWAServlet.PRINCIPAL_SESSION_KEY);
            invalidateSession(request);/*w w w  . jav  a2s. co  m*/
        }
    }

    if (principal == null || principal.getName() == null) {
        if (log.isDebugEnabled()) {
            log.debug("Authenticated principal is null. Therefore authentication is failed.");
        }
        throw new AuthenticationFailedException("Authentication Failed");
    }

    String username = principal.getName();
    username = username.substring(username.indexOf("\\") + 1);

    if (log.isDebugEnabled()) {
        log.debug(
                "Authenticate request received : AuthType - " + request.getAuthType() + ", User - " + username);
    }
    boolean isAuthenticated;
    UserStoreManager userStoreManager;
    // Check the authentication
    try {
        userStoreManager = (UserStoreManager) CarbonContext.getThreadLocalCarbonContext().getUserRealm()
                .getUserStoreManager();
        isAuthenticated = userStoreManager.isExistingUser(MultitenantUtils.getTenantAwareUsername(username));
    } catch (org.wso2.carbon.user.api.UserStoreException e) {
        throw new AuthenticationFailedException("IWAAuthenticator failed while trying to find user existence",
                e);
    }

    if (!isAuthenticated) {
        if (log.isDebugEnabled()) {
            log.debug("user authentication failed, user:" + username + " is not in the user store");
        }
        throw new AuthenticationFailedException("Authentication Failed");
    }
    username = FrameworkUtils.prependUserStoreDomainToName(username);
    context.setSubject(AuthenticatedUser.createLocalAuthenticatedUserFromSubjectIdentifier(username));
}

From source file:org.atomserver.AtomServer.java

private void log500Error(Throwable e, Abdera abdera, RequestContext request) {
    if (errlog != null) {
        Log http500log = errlog.getLog();
        if (http500log.isInfoEnabled()) {
            try {
                http500log.info(/*from   w w  w  .ja v  a2  s  .c  o m*/
                        "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
                http500log.info("==> 500 ERROR occurred for {" + request.getUri() + "} Type:: "
                        + e.getClass().getName() + " Reason:: " + e.getMessage());
                http500log.error("500 Error:: ", e);
                http500log.info("METHOD:: " + request.getMethod());
                if (request.getPrincipal() != null) {
                    http500log.info("PRINCIPAL:: " + request.getPrincipal().getName());
                }
                http500log.info("HEADERS:: ");
                String[] headerNames = request.getHeaderNames();
                if (headerNames != null) {
                    for (int ii = 0; ii < headerNames.length; ii++) {
                        http500log
                                .info("Header(" + headerNames[ii] + ")= " + request.getHeader(headerNames[ii]));
                    }
                }
                http500log.info("PARAMETERS:: ");
                String[] paramNames = request.getParameterNames();
                if (paramNames != null) {
                    for (int ii = 0; ii < paramNames.length; ii++) {
                        http500log.info(
                                "Parameter(" + paramNames[ii] + ")= " + request.getParameter(paramNames[ii]));
                    }
                }
                if (request instanceof HttpServletRequestContext) {
                    HttpServletRequestContext httpRequest = (HttpServletRequestContext) request;
                    javax.servlet.http.HttpServletRequest servletRequest = httpRequest.getRequest();
                    if (servletRequest != null) {
                        http500log.info("QUERY STRING::" + servletRequest.getQueryString());
                        http500log.info("AUTH TYPE:: " + servletRequest.getAuthType());
                        http500log.info("REMOTE USER:: " + servletRequest.getRemoteUser());
                        http500log.info("REMOTE ADDR:: " + servletRequest.getRemoteAddr());
                        http500log.info("REMOTE HOST:: " + servletRequest.getRemoteHost());
                    }
                }
                http500log.info("BODY:: ");
                if (request.getDocument() != null) {
                    java.io.StringWriter stringWriter = new java.io.StringWriter();
                    request.getDocument().writeTo(abdera.getWriterFactory().getWriter("PrettyXML"),
                            stringWriter);

                    //http500log.info( "\n" + stringWriter.toString() );
                    String requestString = stringWriter.toString();
                    if (requestString != null && requestString.length() > MAX_REQ_BODY_DUMP) {
                        requestString = requestString.substring(0, (MAX_REQ_BODY_DUMP - 1));
                    }

                    http500log.info("\n" + requestString);
                }
            } catch (Exception ee) {
            }
        }
    }
}

From source file:se.tillvaxtverket.ttsigvalws.ttwebservice.TTSigValServlet.java

/**
 * Processes requests for both HTTP//from w ww  .  java 2 s.c  o  m
 * <code>GET</code> and
 * <code>POST</code> methods.
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    String action = request.getParameter("action");
    Locale respLocale = Locale.getDefault();
    baseModel.refreshTrustStore();
    boolean isMultipart = ServletFileUpload.isMultipartContent(request);
    if (isMultipart) {
        processFileUpload(request, response);
        return;
    }

    if (action == null) {
        response.setStatus(HttpServletResponse.SC_NO_CONTENT);
        response.getWriter().write("");
        return;
    }

    if (action.equals("logout")) {
        response.setContentType("text/html;charset=UTF-8");
        String authType = (request.getAuthType() == null) ? "" : request.getAuthType();
        response.getWriter().write("<logout>" + authType.toLowerCase() + "</logout>");
    }

    if (action.equals("authdata")) {
        response.setContentType("text/xml;charset=UTF-8");
        response.setHeader("Cache-Control", "no-cache");
        StringBuilder b = new StringBuilder();
        String authType = request.getAuthType();
        String remoteUser = utf8(request.getRemoteUser());
        if (authType != null && remoteUser != null) {
            b.append("<remoteUser type=\"").append(authType).append("\">");
            b.append(remoteUser).append("</remoteUser>");
            b.append("<authContext>");
            b.append(getAuthContext(request));
            b.append("</authContext>");
            b.append("<userAttributes>");
            b.append(getAuthAttributes(request));
            b.append("</userAttributes>");
        }
        String authResponse = "<authData>" + b.toString() + "</authData>";
        response.getWriter().write(authResponse);
    }

    if (action.equals("policylist")) {
        boolean contentAdded = true;
        if (contentAdded) {
            response.setContentType("text/xml;charset=UTF-8");
            response.setHeader("Cache-Control", "no-cache");
            response.getWriter().write("<policies>" + getPolicyData() + "</policies>");
        } else {
            response.setStatus(HttpServletResponse.SC_NO_CONTENT);
        }
        return;
    }

    if (action.equals("serverdoclist")) {
        boolean contentAdded = true;
        if (contentAdded) {
            response.setContentType("text/xml;charset=UTF-8");
            response.setHeader("Cache-Control", "no-cache");
            response.getWriter().write("<sigFiles>" + getServerdocs() + "</sigFiles>");
        } else {
            response.setStatus(HttpServletResponse.SC_NO_CONTENT);
        }
        return;
    }

    if (action.equals("verify")) {
        String verifyResult = verifyServerDocSignature(request);
        if (verifyResult != null) {
            response.setContentType("text/xml;charset=UTF-8");
            response.setHeader("Cache-Control", "no-cache");
            response.getWriter().write(verifyResult);
        } else {
            response.setStatus(HttpServletResponse.SC_NO_CONTENT);
        }
        return;
    }
    if (action.equals("postverify")) {
        processValidationPost(request, response);
        return;
    }
}