Example usage for javax.servlet.http HttpServletResponse SC_NOT_IMPLEMENTED

List of usage examples for javax.servlet.http HttpServletResponse SC_NOT_IMPLEMENTED

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponse SC_NOT_IMPLEMENTED.

Prototype

int SC_NOT_IMPLEMENTED

To view the source code for javax.servlet.http HttpServletResponse SC_NOT_IMPLEMENTED.

Click Source Link

Document

Status code (501) indicating the HTTP server does not support the functionality needed to fulfill the request.

Usage

From source file:org.dspace.app.dav.DAVBitstream.java

@Override
protected int deleteInternal() throws DAVStatusException, SQLException, AuthorizeException, IOException {
    throw new DAVStatusException(HttpServletResponse.SC_NOT_IMPLEMENTED,
            "DELETE method not implemented for BitStream.");
}

From source file:org.apache.sling.oakui.OakUIWebConsole.java

private void revertSegment(@Nonnull HttpServletRequest request, @Nonnull HttpServletResponse response,
        @Nonnull String index, @Nonnull String file) throws JSONException, IOException {
    // This needs a IndexWriter to be opened, with the commit in the IndexConfguration and then the index saved.
    // Since there can be only one index writer in the JVM and there is no access to the locks that control that
    // from this bundle, revertSegement cant be implemented here.
    response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}

From source file:org.apache.sling.oakui.OakUIWebConsole.java

private void damageSegment(@Nonnull HttpServletRequest request, @Nonnull HttpServletResponse response,
        @Nonnull String index, @Nonnull String file) throws JSONException, IOException {
    // This would be good for testing, just not certain how to implement it.
    response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}

From source file:org.apache.shindig.social.sample.spi.JsonDbOpensocialService.java

/** {@inheritDoc} */
public Future<Void> deleteMessages(UserId userId, String msgCollId, List<String> ids, SecurityToken token)
        throws ProtocolException {
    throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
            "this functionality is not yet available");
}

From source file:org.osaf.cosmo.mc.MorseCodeServlet.java

private boolean checkWritePreconditions(HttpServletRequest req, HttpServletResponse resp) {
    if (req.getContentLength() <= 0) {
        resp.setStatus(HttpServletResponse.SC_LENGTH_REQUIRED);
        return false;
    }/* w  w w  . j a va  2s .co  m*/

    if (req.getContentType() == null || !req.getContentType().startsWith(MEDIA_TYPE_EIMML)) {
        resp.setStatus(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
        return false;
    }

    if (req.getHeader("Content-Transfer-Encoding") != null || req.getHeader("Content-Encoding") != null
            || req.getHeader("Content-Base") != null || req.getHeader("Content-Location") != null
            || req.getHeader("Content-MD5") != null || req.getHeader("Content-Range") != null) {
        resp.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
        return false;
    }

    return true;
}

From source file:org.wyona.yanel.servlet.YanelServlet.java

/**
 * @see javax.servlet.http.HttpServlet#service(HttpServletRequest, HttpServletResponse)
 *//*from   www.jav a  2  s . c  om*/
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    // NOTE: Do not add code outside the try-catch block, because otherwise exceptions won't be logged
    try {
        Runtime rt = Runtime.getRuntime();
        long usedMBefore = getUsedMemory(rt);
        //log.debug("Memory usage before request processed: " + usedMBefore);

        ThreadContext.put("id", getFishTag(request));
        //String httpAcceptMediaTypes = request.getHeader("Accept");
        //String httpAcceptLanguage = request.getHeader("Accept-Language");

        if (isCASLogoutRequest(request)) {
            log.warn("DEBUG: CAS logout request received: " + request.getServletPath());
            if (doCASLogout(request, response)) {
                return;
            } else {
                log.error("Logout based on CAS request failed!");
            }
            return;
        }

        String yanelUsecase = request.getParameter(YANEL_USECASE);
        if (yanelUsecase != null && yanelUsecase.equals("logout")) {
            try {
                log.debug("Disable auto login..."); // TODO: The cookie is not always deleted!
                AutoLogin.disableAutoLogin(request, response, getRealm(request).getRepository());
            } catch (Exception e) {
                log.error("Exception while disabling auto login: " + e.getMessage(), e);
            }
            // INFO: Logout from Yanel
            if (doLogout(request, response)) {
                return;
            } else {
                log.error("Logout failed!");
            }
        } else if (yanelUsecase != null && yanelUsecase.equals("create")) { // TODO: Why does that not go through access control?
            // INFO: Create a new resource
            if (doCreate(request, response) != null)
                return;
        }

        // Check authorization and if authorization failed, then try to authenticate
        if (doAccessControl(request, response) != null) {
            // INFO: Either redirect (after successful authentication) or access denied (and response will contain the login screen)
            return;
        } else {
            if (log.isDebugEnabled())
                log.debug("Access granted: " + request.getServletPath());
        }

        // Check for requests re policies
        String policyRequestPara = request.getParameter(YANEL_ACCESS_POLICY_USECASE);
        if (policyRequestPara != null) {
            doAccessPolicyRequest(request, response, 1);
            return;
        } else if (yanelUsecase != null && yanelUsecase.equals("policy.read")) {
            doAccessPolicyRequest(request, response, 2);
            return;
        }

        // Check for requests for global data
        Resource resource = getResource(request, response);
        String path = resource.getPath();
        if (path.indexOf("/" + reservedPrefix + "/") == 0) {
            getGlobalData(request, response);
            return;
        }

        String value = request.getParameter(YANEL_RESOURCE_USECASE);
        // Delete node
        if (value != null && value.equals("delete")) {
            handleDeleteUsecase(request, response);
            return;
        }

        // INFO: Check if user agent is mobile device
        doMobile(request);

        // Delegate ...
        String method = request.getMethod();
        if (method.equals(METHOD_PROPFIND)) {
            doPropfind(request, response);
        } else if (method.equals(METHOD_GET)) {
            doGet(request, response);
        } else if (method.equals(METHOD_POST)) {
            doPost(request, response);
        } else if (method.equals(METHOD_PUT)) {
            doPut(request, response);
        } else if (method.equals(METHOD_DELETE)) {
            doDelete(request, response);
        } else if (method.equals(METHOD_OPTIONS)) {
            doOptions(request, response);
        } else {
            log.error("No such method implemented: " + method);
            response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
        }
        long usedMAfter = getUsedMemory(rt);
        //log.debug("Memory usage after request processed: " + usedMAfter);
        if ((usedMAfter - usedMBefore) > MEMORY_GROWTH_THRESHOLD) {
            log.warn("Memory usage increased by '" + MEMORY_GROWTH_THRESHOLD + "' while request '"
                    + getRequestURLQS(request, null, false) + "' was processed!");
        }
    } catch (ServletException e) {
        log.error(e, e);
        throw new ServletException(e.getMessage(), e);
    } catch (IOException e) {
        log.error(e, e);
        throw new IOException(e.getMessage());
    } finally {
        ThreadContext.clear();
    } // NOTE: This was our last chance to log an exception, hence do not add code outside the try-catch block
}

From source file:org.gss_project.gss.server.rest.Webdav.java

/**
 * PROPPATCH Method./* w w w  .  j  av  a2s.c o m*/
 *
 * @param req the HTTP request
 * @param resp the HTTP response
 * @throws IOException if an error occurs while sending the response
 */
private void doProppatch(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    if (isLocked(req)) {
        resp.sendError(WebdavStatus.SC_LOCKED);
        return;
    }
    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}

From source file:org.apache.shindig.social.sample.spi.JsonDbOpensocialService.java

/** {@inheritDoc} */
public Future<MessageCollection> createMessageCollection(UserId userId, MessageCollection msgCollection,
        SecurityToken token) throws ProtocolException {
    throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
            "this functionality is not yet available");
}

From source file:org.apache.shindig.social.sample.spi.JsonDbOpensocialService.java

/** {@inheritDoc} */
public Future<Void> modifyMessage(UserId userId, String msgCollId, String messageId, Message message,
        SecurityToken token) throws ProtocolException {
    throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED,
            "this functionality is not yet available");
}

From source file:com.orange.api.atmosdav.AtmosDavServlet.java

/**
 * PROPPATCH Method./*from  ww  w.j  av a  2s .c om*/
 */
protected void doProppatch(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}