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.apache.shindig.social.sample.spi.JsonDbOpensocialService.java

/** {@inheritDoc} */
public Future<Void> modifyMessageCollection(UserId userId, MessageCollection msgCollection, 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

/**
 * LOCK Method./*from www . jav  a  2s. c  om*/
 */
protected void doLock(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}

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

/** {@inheritDoc} */
public Future<Void> deleteMessageCollection(UserId userId, String msgCollId, 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

/**
 * UNLOCK Method.//from  ww  w  .jav a 2 s. co  m
 */
protected void doUnlock(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}

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

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}

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

/**
 * COPY Method./*from www. j  a  va2  s  . c  o m*/
 */
protected void doCopy(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}

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

/**
 * MOVE Method./*w  ww  . j  av a  2 s  .  c o  m*/
 */
protected void doMove(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}

From source file:org.jitsi.videobridge.rest.HandlerImpl.java

/**
 * {@inheritDoc}/* ww w . ja  v  a  2s .  c  o  m*/
 */
@Override
protected void handleJSON(String target, Request baseRequest, HttpServletRequest request,
        HttpServletResponse response) throws IOException, ServletException {
    super.handleJSON(target, baseRequest, request, response);

    if (baseRequest.isHandled())
        return; // The super implementation has handled the request.

    // The target starts with "/colibri/".
    if (target.startsWith(COLIBRI_TARGET)) {
        target = target.substring(COLIBRI_TARGET.length());

        // FIXME In order to not invoke beginResponse() and endResponse() in
        // each and every one of the methods to which handleColibriJSON()
        // delegates/forwards, we will invoke them here. However, we do not
        // know whether handleColibriJSON() will actually handle the
        // request. As a workaround we will mark the response with a status
        // code that we know handleColibriJSON() does not utilize (at the
        // time of this writing) and we will later recognize whether
        // handleColibriJSON() has handled the request by checking whether
        // the response is still marked with the unused status code.
        int oldResponseStatus = response.getStatus();

        response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);

        // All responses to requests for resources under the base /colibri/
        // are in JSON format.
        beginResponse(target, baseRequest, request, response);
        handleColibriJSON(target, baseRequest, request, response);

        int newResponseStatus = response.getStatus();

        if (newResponseStatus == HttpServletResponse.SC_NOT_IMPLEMENTED) {
            // Restore the status code which was in place before we replaced
            // it with our workaround.
            response.setStatus(oldResponseStatus);
        } else {
            // It looks like handleColibriJSON() indeed handled the request.
            endResponse(target, baseRequest, request, response);
        }
    } else {
        // Initially, we had VERSION_TARGET equal to /version. But such an
        // HTTP resource could be rewritten by Meet. In order to decrease
        // the risk of rewriting, we moved the VERSION_TARGET to
        // /about/version. For the sake of compatiblity though, we are
        // preserving /version.
        String versionTarget = "/version";

        if (versionTarget.equals(target)) {
            target = target.substring(versionTarget.length());

            handleVersionJSON(target, baseRequest, request, response);
        }
    }
}

From source file:com.concursive.connect.web.webdav.servlets.WebdavServlet.java

/**
 * PROPPATCH Method.//  w  w w  .j ava  2 s. c  om
 *
 * @param req  Description of the Parameter
 * @param resp Description of the Parameter
 * @throws javax.servlet.ServletException Description of the Exception
 * @throws java.io.IOException            Description of the Exception
 */
protected void doProppatch(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

    if (readOnly) {
        resp.sendError(WebdavStatus.SC_FORBIDDEN);
        return;
    }

    if (isLocked(req)) {
        resp.sendError(WebdavStatus.SC_LOCKED);
        return;
    }

    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);

}

From source file:com.jpeterson.littles3.StorageEngine.java

/**
 * Delete/*from   w w  w  . ja va 2 s  .  c  om*/
 * 
 * @param req
 *            the HttpServletRequest object that contains the request the
 *            client made of the servlet
 * @param resp
 *            the HttpServletResponse object that contains the response the
 *            servlet returns to the client
 * @param IOException
 *            if an input or output error occurs while the servlet is
 *            handling the DELETE request
 * @param ServletException
 *            if the request for the DELETE cannot be handled
 */
public void methodDelete(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    S3ObjectRequest or;

    try {
        or = S3ObjectRequest.create(req, resolvedHost(),
                (Authenticator) getWebApplicationContext().getBean(BEAN_AUTHENTICATOR));
    } catch (InvalidAccessKeyIdException e) {
        e.printStackTrace();
        resp.sendError(HttpServletResponse.SC_FORBIDDEN, "InvalidAccessKeyId");
        return;
    } catch (InvalidSecurityException e) {
        e.printStackTrace();
        resp.sendError(HttpServletResponse.SC_FORBIDDEN, "InvalidSecurity");
        return;
    } catch (RequestTimeTooSkewedException e) {
        e.printStackTrace();
        resp.sendError(HttpServletResponse.SC_FORBIDDEN, "RequestTimeTooSkewed");
        return;
    } catch (SignatureDoesNotMatchException e) {
        e.printStackTrace();
        resp.sendError(HttpServletResponse.SC_FORBIDDEN, "SignatureDoesNotMatch");
        return;
    } catch (AuthenticatorException e) {
        e.printStackTrace();
        resp.sendError(HttpServletResponse.SC_FORBIDDEN, "InvalidSecurity");
        return;
    }
    logger.debug("S3ObjectRequest: " + or);

    CanonicalUser requestor = or.getRequestor();

    if (or.getKey() != null) {
        Bucket bucket;
        S3Object s3Object;
        StorageService storageService;

        storageService = (StorageService) getWebApplicationContext().getBean(BEAN_STORAGE_SERVICE);

        // make sure requester can "WRITE" to the bucket
        try {
            bucket = storageService.loadBucket(or.getBucket());
            bucket.canWrite(requestor);
        } catch (AccessControlException e) {
            resp.sendError(HttpServletResponse.SC_FORBIDDEN, "AccessDenied");
            return;
        } catch (DataAccessException e) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "NoSuchBucket");
            return;
        }

        try {
            s3Object = storageService.load(bucket.getName(), or.getKey());
        } catch (DataRetrievalFailureException e) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "NoSuchKey");
            return;
        }
        storageService.remove(s3Object);

        resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
        return;
    } else if (or.getBucket() != null) {
        StorageService storageService;
        Bucket bucket;

        // validate bucket
        String bucketName = or.getBucket();

        storageService = (StorageService) getWebApplicationContext().getBean(BEAN_STORAGE_SERVICE);

        try {
            bucket = storageService.loadBucket(bucketName);
        } catch (DataAccessException e) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "NoSuchBucket");
            return;
        }

        if (!requestor.equals(bucket.getAcp().getOwner())) {
            resp.sendError(HttpServletResponse.SC_FORBIDDEN, "AccessDenied");
            return;
        }

        try {
            storageService.deleteBucket(bucket);
        } catch (BucketNotEmptyException e) {
            resp.sendError(HttpServletResponse.SC_CONFLICT, "BucketNotEmpty");
            return;
        }

        resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
        return;
    }

    resp.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
}