Package org.restlet.data

Examples of org.restlet.data.Tag


                  try {
                     Feed f = app.createFeed(requestPath,doc);
                     response.setStatus(Status.SUCCESS_CREATED);
                     Representation rep = storage.getFeed(f.getPath(),f.getUUID(),f.getEntries());
                     if (rep!=null) {
                        rep.setTag(new Tag(Long.toString(f.getEdited().getTime()),false));
                     }
                     response.setEntity(rep);
                  } catch (AppException ex) {
                     if (ex.getStatus().equals(Status.SERVER_ERROR_INTERNAL)) {
                        getLogger().log(Level.SEVERE,ex.getMessage(),ex);
View Full Code Here


            getResponse().getAttributes().put("org.restlet.http.headers",returnHeaders);
            Reference ref = new Reference(getRequest().getResourceRef().getParentRef()+"_/"+entry.getUUID().toString());
            getResponse().setLocationRef(ref);
            Representation rep = app.getEntryRepresentation(getRequest().getResourceRef().getParentRef().toString(),entry);
            rep.setCharacterSet(CharacterSet.UTF_8);
            rep.setTag(new Tag(Long.toString(entry.getEdited().getTime()),false));
            return rep;
         } else {
            getResponse().setStatus(status);
            return new StringRepresentation("Cannot update entry for media.");
         }
View Full Code Here

         getResponse().getAttributes().put("org.restlet.http.headers",headers);
         Reference ref = new Reference(getRequest().getResourceRef().getParentRef()+"_/"+entry.getUUID().toString());
         getResponse().setLocationRef(ref);
         Representation rep = app.getEntryRepresentation(getRequest().getResourceRef().getParentRef().toString(),entry);
         rep.setCharacterSet(CharacterSet.UTF_8);
         rep.setTag(new Tag(Long.toString(entry.getEdited().getTime()),false));
         return rep;
      } catch (AppException ex) {
         getResponse().setStatus(ex.getStatus());
         if (ex.getStatus().getCode()==Status.SERVER_ERROR_INTERNAL.getCode()) {
            getContext().getLogger().log(Level.SEVERE,ex.getMessage(),ex.getCause());
View Full Code Here

     *              <tt>null</tt>.
     */
    public AtomicoVariant(String mediaType, long modified, String eTag) {
        super(MediaType.valueOf(mediaType));
        _modified = modified;
        _etag = eTag == null ? null : new Tag(eTag, true);
    }
View Full Code Here

    }

    private Representation entityHeaders( Representation representation, EntityState entityState )
    {
        representation.setModificationDate( new Date( entityState.lastModified() ) );
        representation.setTag( new Tag( "" + entityState.version() ) );
        representation.setCharacterSet( CharacterSet.UTF_8 );
        representation.setLanguages( Collections.singletonList( Language.ENGLISH ) );

        return representation;
    }
View Full Code Here

                  paths.remove();
            }
         }
      } else if (response.getRequest().getMethod().equals( Method.PUT ) || response.getRequest().getMethod().equals( Method.POST ))
      {
         Tag tag = response.getEntity().getTag();
         if (tag != null)
         {
            Reference ref = response.getRequest().getResourceRef().clone();

            CacheInfo value = new CacheInfo( response.getEntity().getModificationDate(), tag, ref );
View Full Code Here

    {
        if( entity != null )
        {
            EntityState state = spi.entityStateOf( entity );
            Date lastModified = new Date( state.lastModified() );
            Tag tag = new Tag( state.identity().identity() + "/" + state.version() );
            response.getEntity().setModificationDate( lastModified );
            response.getEntity().setTag( tag );
        }
    }
View Full Code Here

      result.setIfModifiedSince(request.getConditions().getModifiedSince().getTime());
    }

    // honor if-none-match
    if (request.getConditions().getNoneMatch() != null && request.getConditions().getNoneMatch().size() > 0) {
      final Tag tag = request.getConditions().getNoneMatch().get(0);
      // NEXUS-5704: 500 Internal Server Error when "If-None-Match" in header
      // Restlet 1.1 is very strict about properly formatted ETags (must be quoted)
      // If unquoted, their presence is detected (IF above evals to true), but will
      // actually return null as parsing the tag
      if (tag != null && tag.getName() != null) {
        result.setIfNoneMatch(tag.getName());
      }
    }

    // stuff in the originating remote address
    result.getRequestContext().put(AccessManager.REQUEST_REMOTE_ADDRESS, getValidRemoteIPAddress(request));
View Full Code Here

      // Shield SHA1
      // {SHA1{xxxx}}
      final String tag =
          String.format("{SHA1{%s}}",
              file.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_SHA1_KEY));
      setTag(new Tag(tag, false));
    }

    if (file.getItemContext().containsKey(AbstractResourceStoreContentPlexusResource.OVERRIDE_FILENAME_KEY)) {
      String filename =
          file.getItemContext().get(AbstractResourceStoreContentPlexusResource.OVERRIDE_FILENAME_KEY).toString();
View Full Code Here

   * So we verify is it detected and added to created ResourceStoreRequest.
   */
  @Test
  public void testNexus5704IfNoneMatchNoNPEWithParsedETag() {
    final Conditions conditions = new Conditions();
    conditions.setNoneMatch(Collections.singletonList(new Tag("{SHA1{fake-sha1-string}}", false)));
    when(request.getConditions()).thenReturn(conditions);

    // we need more mock responses as getResourceStoreRequest tries to gather
    // as much info as it can (from client, reference, baseUrl etc
    when(request.getClientInfo()).thenReturn(new ClientInfo());
View Full Code Here

TOP

Related Classes of org.restlet.data.Tag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.