Search in sources :

Example 11 with CacheControl

use of javax.ws.rs.core.CacheControl in project jersey by jersey.

the class CacheControlOn404Resource method get404.

@GET
public Response get404() {
    CacheControl cc = new CacheControl();
    cc.setMaxAge(10);
    return Response.status(Response.Status.NOT_FOUND).cacheControl(cc).type("text/plain").entity("404 Not Found").build();
}
Also used : CacheControl(javax.ws.rs.core.CacheControl) GET(javax.ws.rs.GET)

Example 12 with CacheControl

use of javax.ws.rs.core.CacheControl in project stanbol by apache.

the class UserResource method storeRole.

private Response storeRole(GraphNode roleNode, UriInfo uriInfo, String roleName, String comment, List<String> permissions) {
    BlankNodeOrIRI roleResource = (BlankNodeOrIRI) roleNode.getNode();
    if (permissions != null) {
        clearPermissions(roleResource);
        Lock writeLock = systemGraph.getLock().writeLock();
        writeLock.lock();
        try {
            for (int i = 0; i < permissions.size(); i++) {
                permissions.set(i, permissions.get(i).trim());
                if (!permissions.get(i).equals("")) {
                    addPermission(roleNode, permissions.get(i));
                }
            }
        } finally {
            writeLock.unlock();
        }
    }
    //refresh the policy so it will recheck the permissions
    Policy.getPolicy().refresh();
    // showSystem();
    URI pageUri = uriInfo.getBaseUriBuilder().path("system/console/usermanagement").build();
    // header Cache-control: no-cache, just in case intermediaries are
    // holding onto old stuff
    CacheControl cc = new CacheControl();
    cc.setNoCache(true);
    // the jax-rs things available
    return Response.seeOther(pageUri).cacheControl(cc).build();
}
Also used : BlankNodeOrIRI(org.apache.clerezza.commons.rdf.BlankNodeOrIRI) CacheControl(javax.ws.rs.core.CacheControl) URI(java.net.URI) Lock(java.util.concurrent.locks.Lock)

Aggregations

CacheControl (javax.ws.rs.core.CacheControl)12 Response (javax.ws.rs.core.Response)4 URI (java.net.URI)3 Lock (java.util.concurrent.locks.Lock)2 BlankNodeOrIRI (org.apache.clerezza.commons.rdf.BlankNodeOrIRI)2 CacheControlProvider (org.glassfish.jersey.message.internal.CacheControlProvider)2 OAuth2AuditLog (org.xdi.oxauth.model.audit.OAuth2AuditLog)2 StringEncrypter (org.xdi.util.security.StringEncrypter)2 HashCode (com.google.common.hash.HashCode)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 FileSystem (java.nio.file.FileSystem)1 FileTime (java.nio.file.attribute.FileTime)1 SignatureException (java.security.SignatureException)1 ParseException (java.text.ParseException)1 Date (java.util.Date)1 GET (javax.ws.rs.GET)1 EntityTag (javax.ws.rs.core.EntityTag)1