Package org.waveprotocol.wave.model.waveref

Examples of org.waveprotocol.wave.model.waveref.WaveRef


    }

    // If it's a wave link, use # for local navigation
    if (uri.startsWith(WaveRefConstants.WAVE_URI_PREFIX)) {
      try {
        WaveRef ref = GwtWaverefEncoder.decodeWaveRefFromPath(
            uri.substring(WaveRefConstants.WAVE_URI_PREFIX.length()));

        return "#" + GwtWaverefEncoder.encodeToUriPathSegment(ref);

      } catch (InvalidWaveRefException e) {
View Full Code Here


    // Try to interpret a wave URI or naked waveid/waveref
    try {
      // NOTE(danilatos): Pasting in the raw serialized form of a wave ref is
      // not supported here. In practice this doesn't really matter.
      WaveRef ref;
      if (WaveRefConstants.WAVE_SCHEME.equals(scheme)) {
        ref = GwtWaverefEncoder.decodeWaveRefFromPath(parts[1]);
      } else if (scheme == null) {
        ref = inferWaveRef(rawLinkValue);
      } else if (WaveRefConstants.WAVE_SCHEME_OLD.equals(scheme)) {
View Full Code Here

  public void testDisallowedUserReturnsForbidden() throws Exception {
    waveletProvider.setAllowsAccess(false);

    WaveletData wavelet = waveletProvider.getHostedWavelet();
    WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId());
    verifyServletReturnsForbiddenForWaveref(waveref);
  }
View Full Code Here

  public void testGetMissingDataReturnsForbidden() throws Exception {
    WaveletData wavelet = waveletProvider.getHostedWavelet();
    WaveId waveId = wavelet.getWaveId();
    WaveletId waveletId = wavelet.getWaveletId();

    WaveRef unknownWave = WaveRef.of(WaveId.of(waveId.getDomain(), waveId.getId() + "junk"));
    verifyServletReturnsForbiddenForWaveref(unknownWave);
    WaveRef unknownWavelet = WaveRef.of(waveId, WaveletId.of(waveletId.getDomain(), waveletId.getId() + "junk"));
    verifyServletReturnsForbiddenForWaveref(unknownWavelet);
    WaveRef unknownDocument = WaveRef.of(waveId, waveletId, "madeupdocid");
    verifyServletReturnsForbiddenForWaveref(unknownDocument);
  }
View Full Code Here

   * @throws Exception
   */
  public void testGetWavelet() throws Exception {
    WaveletData wavelet = waveletProvider.getHostedWavelet();

    WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId());
    WaveletSnapshot snapshot = fetchWaverRefAndParse(waveref, WaveletSnapshot.class);
    WaveletData roundtripped = SnapshotSerializer.deserializeWavelet(snapshot, waveref.getWaveId());

    // We have just round-tripped wavelet through the servlet. wavelet and
    // roundtripped should be identical in all the fields that get serialized.
    TestDataUtil.checkSerializedWavelet(wavelet, roundtripped);

View Full Code Here

      StringWriter writer = new StringWriter();
      BlipData expectedDoc = wavelet.getDocument(docId);
      writer.append("" + protoSerializer.toJson(SnapshotSerializer.serializeDocument(expectedDoc)));
      String expectedResult = writer.toString();

      WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId(), docId);
      String actualResult = fetchWaveRef(waveref);

      assertEquals(expectedResult, actualResult);
    }
  }
View Full Code Here

      public void onValueChange(ValueChangeEvent<String> event) {
        String encodedToken = event.getValue();
        if (encodedToken == null || encodedToken.length() == 0) {
          return;
        }
        WaveRef waveRef;
        try {
          waveRef = GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken);
        } catch (InvalidWaveRefException e) {
          LOG.info("History token contains invalid path: " + encodedToken);
          return;
        }
        LOG.info("Changing selected wave based on history event to " + waveRef.toString());
        ClientEvents.get().fireEvent(new WaveSelectionEvent(waveRef));
      }
    });
  }
View Full Code Here

        Timing.stop(timer);
      }
    });
    String encodedToken = History.getToken();
    if (encodedToken != null && !encodedToken.isEmpty()) {
      WaveRef fromWaveRef;
      try {
        fromWaveRef = GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken);
      } catch (InvalidWaveRefException e) {
        LOG.info("History token contains invalid path: " + encodedToken);
        return;
      }
      if (fromWaveRef.getWaveId().equals(waveRef.getWaveId())) {
        // History change was caused by clicking on a link, it's already
        // updated by browser.
        return;
      }
    }
View Full Code Here

    // This path will look like "/example.com/w+abc123/foo.com/conv+root
    // Strip off the leading '/'.
    String urlPath = req.getPathInfo().substring(1);

    // Extract the name of the wavelet from the URL
    WaveRef waveref;
    try {
      waveref = JavaWaverefEncoder.decodeWaveRefFromPath(urlPath);
    } catch (InvalidWaveRefException e) {
      // The URL contains an invalid waveref. There's no document at this path.
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
View Full Code Here

    ImageIO.write(thumbnail, THUMBNAIL_FORMAT_NAME, out);
    store.storeThumbnail(attachemntId, new ByteArrayInputStream(out.toByteArray()));
  }

  private static String waveletName2WaveRef(WaveletName waveletName) {
    WaveRef waveRef = WaveRef.of(waveletName.waveId, waveletName.waveletId);
    return JavaWaverefEncoder.encodeToUriPathSegment(waveRef);
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.waveref.WaveRef

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.