Exemplo n.º 1
0
  public void execute(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    if (wac == null) {
      wac = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
      if (wac == null) {
        response.sendError(
            HttpServletResponse.SC_SERVICE_UNAVAILABLE, "Cannot get WebApplicationContext");
        return;
      }
    }
    log.debug("========================Page Start==========");
    request.setAttribute(Tool.NATIVE_URL, Tool.NATIVE_URL);

    String targetURL = persistState(request);

    String action = request.getParameter("action");
    if (!StringUtils.isEmpty(targetURL)
        && !StringUtils.equals(action, "search")
        && !StringUtils.equals(action, "full_search")) {
      response.sendRedirect(targetURL);
      return;
    }

    // Must be done on every request
    prePopulateRealm(request);

    addWikiStylesheet(request);

    request.setAttribute("footerScript", footerScript);
    if (headerScriptSource != null && headerScriptSource.length() > 0) {
      request.setAttribute("headerScriptSource", headerScriptSource);
    }

    RequestHelper helper = (RequestHelper) wac.getBean(RequestHelper.class.getName());

    HttpCommand command = helper.getCommandForRequest(request);

    // fix for IE6's poor cache capabilities
    String userAgent = request.getHeader("User-Agent");
    if (userAgent != null && userAgent.indexOf("MSIE 6") >= 0) {
      response.addHeader("Expires", "0");
      response.addHeader("Pragma", "cache");
      response.addHeader("Cache-Control", "private");
    }

    command.execute(dispatcher, request, response);

    request.removeAttribute(Tool.NATIVE_URL);
    log.debug("=====================Page End=============");
  }
Exemplo n.º 2
0
  public AlbumSearchContainer getAlbums(String artist) throws Exception {
    final String encodedArtist = RequestHelper.escapeUrlString(artist);
    // make albums request for this artist
    // http://192.168.254.128:3689/databases/36/groups?session-id=1034286700&meta=dmap.itemname,dmap.itemid,dmap.persistentid,daap.songartist&type=music&group-type=albums&sort=artist&include-sort-headers=1

    return RequestHelper.requestParsed(
        String.format(
            "%s/databases/%d/groups?session-id=%s&meta=dmap.itemname,dmap.itemid,dmap.persistentid,daap.songartist&type=music&group-type=albums&sort=artist&include-sort-headers=1&query='daap.songartist:%s'",
            session.getRequestBase(),
            session.getDatabase().getItemId(),
            session.getSessionId(),
            encodedArtist),
        false);
  }
Exemplo n.º 3
0
  public ItemsContainer getAllTracks(String artist) throws Exception {
    final String encodedArtist = RequestHelper.escapeUrlString(artist);

    // make tracks list request
    // http://192.168.254.128:3689/databases/36/containers/113/items?session-id=1301749047&meta=dmap.itemname,dmap.itemid,daap.songartist,daap.songalbum,daap.songalbum,daap.songtime,daap.songtracknumber&type=music&sort=album&query='daap.songalbumid:11624070975347817354'
    return RequestHelper.requestParsed(
        String.format(
            "%s/databases/%d/containers/%d/items?session-id=%s&meta=dmap.itemname,dmap.itemid,daap.songartist,daap.songalbum,daap.songalbum,daap.songtime,daap.songuserrating,daap.songtracknumber&type=music&sort=album&query='daap.songartist:%s'",
            session.getRequestBase(),
            session.getDatabase().getItemId(),
            session.getDatabase().getMasterContainer().getItemId(),
            session.getSessionId(),
            encodedArtist),
        false);
  }
Exemplo n.º 4
0
 public ArtistSearchContainer getArtists() throws Exception {
   return RequestHelper.requestParsed(
       String.format(
           "%s/databases/%d/groups?meta=dmap.itemname,dmap.itemid,dmap.persistentid,daap.songartist,daap.groupalbumcount,daap.songartistid&type=music&group-type=artists&sort=album&include-sort-headers=1&query=('daap.songartist!:'+('com.apple.itunes.extended-media-kind:1','com.apple.itunes.extended-media-kind:32'))&session-id=%s",
           session.getRequestBase(), session.getDatabase().getItemId(), session.getSessionId()),
       false);
 }
Exemplo n.º 5
0
  @Override
  public void generate(
      final Ds3ApiSpec spec,
      final FileUtils fileUtils,
      final Path destDir,
      final Ds3DocSpec docSpec)
      throws IOException {
    this.fileUtils = fileUtils;

    try {
      final ImmutableList<Request> allRequests = getAllRequests(spec, docSpec);
      final ImmutableList<Enum> allEnums = getAllEnums(spec);
      final ImmutableSet<String> enumNames = EnumHelper.getEnumNamesSet(allEnums);

      final ImmutableSet<String> arrayMemberTypes = getArrayMemberTypes(spec, enumNames);

      final ImmutableSet<String> embeddedTypes = getEmbeddedTypes(spec, enumNames);
      final ImmutableSet<String> responseTypes = RequestHelper.getResponseTypes(allRequests);
      final ImmutableSet<String> paginatedTypes = getPaginatedTypes(spec);

      final ImmutableList<Struct> allStructs =
          getAllStructs(
              spec, enumNames, responseTypes, embeddedTypes, arrayMemberTypes, paginatedTypes);

      generateHeader(allEnums, allStructs, allRequests);
      generateSource(allEnums, allStructs, allRequests);
      generateStaticFiles();
    } catch (final ParseException e) {
      LOG.error("Caught exception: ", e);
    }
  }
Exemplo n.º 6
0
 @GET
 @Produces("application/json")
 @Path(value = "startDownloads")
 public String startDownloads(@QueryParam("pkgList") String pkgList) {
   if (RequestHelper.isInternalLink(getContext())) {
     if (pkgList != null) {
       String[] pkgs = pkgList.split("/");
       PackageManager pm = Framework.getLocalService(PackageManager.class);
       try {
         log.info("Starting download for packages " + Arrays.toString(pkgs));
         pm.download(Arrays.asList(pkgs));
       } catch (ConnectServerError e) {
         log.error(e, e);
       }
       // here we generate a fake progress report so that if some
       // download are very fast, they will still be visible on the
       // client side
       StringBuffer sb = new StringBuffer();
       sb.append("[");
       for (int i = 0; i < pkgs.length; i++) {
         if (i > 0) {
           sb.append(",");
         }
         sb.append("{ \"pkgid\" : ");
         sb.append("\"" + pkgs[i] + "\",");
         sb.append(" \"progress\" : 0}");
       }
       sb.append("]");
       return sb.toString();
     }
   }
   return "[]";
 }
Exemplo n.º 7
0
  /**
   * Sets (activates or deactivates) the speakers as defined in the given list.
   *
   * @param speakers all speakers to read the active flag from
   */
  public void setSpeakers(List<Speaker> speakers) {

    try {
      Log.d(TAG, "setSpeakers() requesting...");

      String idsString = "";
      boolean first = true;
      // The list of speakers to activate is a comma-separated string with
      // the hex versions of the speakers' IDs
      for (Speaker speaker : speakers) {
        if (speaker.isActive()) {
          if (!first) {
            idsString += ",";
          } else {
            first = false;
          }
          idsString += speaker.getIdAsHex();
        }
      }

      String url =
          String.format(
              "%s/ctrl-int/1/setspeakers?speaker-id=%s&session-id=%s",
              session.getRequestBase(), idsString, session.sessionId);

      RequestHelper.request(url, false);

    } catch (Exception e) {
      Log.e(TAG, "Could not set speakers: ", e);
    }
  }
Exemplo n.º 8
0
            public void run() {
              while (true) {
                try {
                  // sleep a few seconds to make sure we dont kill stuff
                  Thread.sleep(1000);
                  if (destroyThread.get()) break;

                  // try fetching next revision update using socket keepalive
                  // approach
                  // using the next revision-number will make itunes keepalive
                  // until something happens
                  // http://192.168.254.128:3689/ctrl-int/1/playstatusupdate?revision-number=1&session-id=1034286700
                  parseUpdate(
                      RequestHelper.requestParsed(
                          String.format(
                              "%s/ctrl-int/1/playstatusupdate?revision-number=%d&session-id=%s",
                              session.getRequestBase(), revision, session.sessionId),
                          true));
                } catch (Exception e) {
                  Log.d(
                      TAG,
                      String.format(
                          "Exception in keepalive thread, so killing try# %d", failures.get()),
                      e);
                  if (failures.incrementAndGet() > MAX_FAILURES) destroy();
                }
              }
              Log.w(TAG, "Status KeepAlive Thread Killed!");
            }
Exemplo n.º 9
0
 /**
  * Helper to control a speakers's absolute volume. This uses the URL parameters <code>
  * setproperty?dmcp.volume=%d&include-speaker-id=%s</code> which results in iTunes controlling the
  * master volume and the selected speaker synchronously.
  *
  * @param speakerId ID of the speaker to control
  * @param absoluteVolume the volume to set absolutely
  * @throws Exception
  */
 private void setAbsoluteVolume(long speakerId, int absoluteVolume) throws Exception {
   String url;
   url =
       String.format(
           "%s/ctrl-int/1/setproperty?dmcp.volume=%d&include-speaker-id=%s" + "&session-id=%s",
           session.getRequestBase(), absoluteVolume, speakerId, session.sessionId);
   RequestHelper.request(url, false);
 }
Exemplo n.º 10
0
 /**
  * Helper to control a speaker's relative volume. This relative volume is a value between 0 and
  * 100 describing the relative volume of a speaker in comparison to the master volume. For this
  * the URL parameters <code>%s/ctrl-int/1/setproperty?speaker-id=%s&dmcp.volume=%d</code> are
  * used.
  *
  * @param speakerId ID of the speaker to control
  * @param relativeVolume the relative volume to set
  * @throws Exception
  */
 private void setRelativeVolume(long speakerId, int relativeVolume) throws Exception {
   String url;
   url =
       String.format(
           "%s/ctrl-int/1/setproperty?speaker-id=%s&dmcp.volume=%d" + "&session-id=%s",
           session.getRequestBase(), speakerId, relativeVolume, session.sessionId);
   RequestHelper.request(url, false);
 }
Exemplo n.º 11
0
 /**
  * Performs a search of the DACP Server sending it search criteria and an index of how many items
  * to find.
  *
  * <p>
  *
  * @param listener the TagListener to capture records coming in for the UI
  * @param search the search criteria
  * @param start items to start with for paging (usually 0)
  * @param items the total items to return in this search
  * @return the count of records returned or -1 if nothing found
  * @throws Exception
  */
 public ItemsContainer readSearch(String search, long start, long items) throws Exception {
   final String encodedSearch = RequestHelper.escapeUrlString(search);
   // return
   // RequestHelper.requestParsed(String.format("%s/databases/%d/containers/%d/items?session-id=%s&meta=dmap.itemname,dmap.itemid,dmap.persistentid,daap.songartist,daap.songalbum,daap.songtime,daap.songuserrating,daap.songtracknumber&type=music&sort=name&include-sort-headers=1&query=(('com.apple.itunes.mediakind:1','com.apple.itunes.mediakind:4','com.apple.itunes.mediakind:8')+('dmap.itemname:*%s*','daap.songartist:*%s*','daap.songalbum:*%s*'))&index=%d-%d", session.getRequestBase(), session.getDatabase().getItemId(), session.getDatabase().getMasterContainer().getItemId(), session.getSessionId(), encodedSearch, encodedSearch, encodedSearch, start, items), false);
   return RequestHelper.requestParsed(
       String.format(
           "%s/databases/%d/containers/%d/items?session-id=%s&meta=all&type=music&sort=name&include-sort-headers=1&query=(('com.apple.itunes.mediakind:1','com.apple.itunes.mediakind:4','com.apple.itunes.mediakind:8')+('dmap.itemname:*%s*','daap.songartist:*%s*','daap.songalbum:*%s*'))&index=%d-%d",
           session.getRequestBase(),
           session.getDatabase().getItemId(),
           session.getDatabase().getMasterContainer().getItemId(),
           session.getSessionId(),
           encodedSearch,
           encodedSearch,
           encodedSearch,
           start,
           items),
       false);
 }
Exemplo n.º 12
0
 public AlbumSearchContainer getAllAlbums() throws Exception {
   // make partial album list request
   // http://192.168.254.128:3689/databases/36/groups?session-id=1034286700&meta=dmap.itemname,dmap.itemid,dmap.persistentid,daap.songartist&type=music&group-type=albums&sort=artist&include-sort-headers=1&index=0-50
   return RequestHelper.requestParsed(
       String.format(
           "%s/databases/%d/groups?session-id=%s&meta=dmap.itemname,dmap.itemid,dmap.persistentid,daap.songartist&type=music&group-type=albums&sort=album&include-sort-headers=1",
           session.getRequestBase(), session.getDatabase().getItemId(), session.getSessionId()),
       false);
 }
Exemplo n.º 13
0
 public DatabaseBrowse getAllArtists() throws Exception {
   // request ALL artists for performance
   // /databases/%d/browse/artists?session-id=%s&include-sort-headers=1&index=%d-%d
   return RequestHelper.requestParsed(
       String.format(
           "%s/databases/%d/browse/artists?session-id=%s&include-sort-headers=1",
           session.getRequestBase(), session.getDatabase().getItemId(), session.getSessionId()),
       false,
       true);
 }
Exemplo n.º 14
0
 public ItemsContainer getUnknownQuery() throws Exception {
   return RequestHelper.requestParsed(
       String.format(
           "%s/databases/%d/containers/%s/items?meta=dmap.itemname,dmap.itemid,daap.songartist,daap.songalbumartist,daap.songalbum,com.apple.itunes.cloud-id,dmap.containeritemid,com.apple.itunes.has-video,com.apple.itunes.itms-songid,com.apple.itunes.extended-media-kind,dmap.downloadstatus,daap.songdisabled&type=music&sort=name&include-sort-headers=1&query=('com.apple.itunes.extended-media-kind:1','com.apple.itunes.extended-media-kind:32')&session-id=%s",
           session.getRequestBase(),
           session.getDatabase().getItemId(),
           session.getDatabase().getMasterContainer().getItemId(),
           session.getSessionId()),
       false);
 }
Exemplo n.º 15
0
 public ItemsContainer getPlaylistSongs(String playlistid) throws Exception {
   // http://192.168.254.128:3689/databases/36/containers/1234/items?session-id=2025037772&meta=dmap.itemname,dmap.itemid,daap.songartist,daap.songalbum,dmap.containeritemid,com.apple.tunes.has-video
   return RequestHelper.requestParsed(
       String.format(
           "%s/databases/%d/containers/%s/items?session-id=%s&meta=dmap.itemname,dmap.itemid,daap.songartst,daap.songalbum,daap.songtime,dmap.containeritemid,com.apple.tunes.has-video",
           session.getRequestBase(),
           session.getDatabase().getItemId(),
           playlistid,
           session.getSessionId()),
       false);
 }
Exemplo n.º 16
0
 public CCodeGenerator() throws TemplateModelException {
   config.setDefaultEncoding("UTF-8");
   config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
   config.setClassForTemplateLoading(CCodeGenerator.class, "/templates");
   config.setSharedVariable("cTypeHelper", C_TypeHelper.getInstance());
   config.setSharedVariable("enumHelper", EnumHelper.getInstance());
   config.setSharedVariable("requestHelper", RequestHelper.getInstance());
   config.setSharedVariable("helper", Helper.getInstance());
   config.setSharedVariable("structHelper", StructHelper.getInstance());
   config.setSharedVariable("structMemberHelper", StructMemberHelper.getInstance());
   config.setSharedVariable("parameterHelper", ParameterHelper.getInstance());
 }
Exemplo n.º 17
0
  /**
   * Reads the list of available speakers
   *
   * @return list of available speakers
   */
  public List<Speaker> getSpeakers(final List<Speaker> speakers) {
    try {
      Log.d(TAG, "getSpeakers() requesting...");

      String temp =
          String.format(
              "%s/ctrl-int/1/getspeakers?session-id=%s",
              session.getRequestBase(), session.sessionId);

      byte[] raw = RequestHelper.request(temp, false);

      Response response = ResponseParser.performParse(raw);

      Response casp = response.getNested("casp");
      if (casp != null) {
        speakers.clear();
      }

      List<Response> mdclArray = casp.findArray("mdcl");

      // Master volume is required to compute the speakers' absolute volume
      long masterVolume = getVolume();

      for (Response mdcl : mdclArray) {
        Speaker speaker = new Speaker();
        speaker.setName(mdcl.getString("minm"));
        long id = mdcl.getNumberLong("msma");
        speaker.setId(id);
        Log.d(TAG, "Speaker = " + speaker.getName());
        int relativeVolume = (int) mdcl.getNumberLong("cmvo");
        boolean isActive = mdcl.containsKey("caia");
        speaker.setActive(isActive);
        // mastervolume/100 * relativeVolume/100 * 100
        int absoluteVolume = isActive ? (int) masterVolume * relativeVolume / 100 : 0;
        speaker.setAbsoluteVolume(absoluteVolume);
        speakers.add(speaker);
      }

    } catch (Exception e) {
      Log.e(TAG, "Could not get speakers: ", e);
      speakers.clear();
      Speaker speaker = new Speaker();
      speaker.setName("Computer");
      speaker.setId(1);
      speaker.setActive(true);
      speaker.setAbsoluteVolume(50);
      speakers.add(speaker);
    }

    return speakers;
  }
Exemplo n.º 18
0
 public SongUserRating getTrackRating(long trackId) throws Exception {
   // MonkeyTunes style would be with PlaylistSongs instead of DatabaseSongs
   final DatabaseItems databaseSongs =
       RequestHelper.requestParsed(
           String.format(
               "%s/databases/%d/items?session-id=%s&meta=daap.songuserrating&type=music&query='dmap.itemid:%d'",
               session.getRequestBase(),
               session.getDatabase().getItemId(),
               session.getSessionId(),
               trackId));
   final ListingItem listingItem =
       databaseSongs.getListing().getSingleListingItemContainingClass(SongUserRating.class);
   return listingItem.getSpecificChunk(SongUserRating.class);
 }
Exemplo n.º 19
0
 public byte[] getAlbumArtworkAsRemote(long itemId, int imageWidth, int imageHeight, String hsgid)
     throws Exception {
   return RequestHelper.requestBitmap(
       String.format(
           "%s/databases/%d/groups/%d/extra_data/artwork?session-id=%s&mw="
               + imageWidth
               + "&mh="
               + imageHeight
               + "&group-type=albums",
           session.getRequestBase(),
           session.getDatabase().getItemId(),
           itemId,
           session.getSessionId()));
 }
Exemplo n.º 20
0
  public DatabaseItems getTestCode(String stuff) throws Exception {
    //		return
    // RequestHelper.requestParsed(String.format("%s/databases/%d/containers/%d/items?session-id=%s&meta=dmap.itemname,dmap.itemid,daap.songextradata,com.apple.itunes.artworkchecksum,daap.songartworkcount,com.apple.itunes.mediakind,daap.songartist,com.apple.itunes.jukebox-vote,com.apple.itunes.jukebox-client-vote,com.apple.itunes.jukebox-score,com.apple.itunes.jukebox-current,com.apple.itunes.extended-media-kind,com.apple.itunes.adam-ids-array&type=music&sort=name&include-sort-headers=1&query=('"+stuff+")", session.getRequestBase(), session.getDatabase().getItemId(), session.getDatabase().getMasterContainer().getItemId(), session.getSessionId()), false);
    // return
    // RequestHelper.requestParsed(String.format("%s/databases/%d/containers/%d/items?session-id=%s&meta=all&query=('"+stuff+")", session.getRequestBase(), session.getDatabase().getItemId(), session.getDatabase().getMasterContainer().getItemId(), session.getSessionId()), false);
    // return
    // RequestHelper.requestParsed(String.format("%s/databases/%d/containers/%d/items?session-id=%s&meta=all", session.getRequestBase(), session.getDatabase().getItemId(), session.getDatabase().getMasterContainer().getItemId(), session.getSessionId()), false);

    // return
    // RequestHelper.requestParsed(String.format("%s/databases/%d/containers/%d/items?session-id=%s&meta=all&type=music&sort=album&query='daap.songartist:%s'", session.getRequestBase(), session.getDatabase().getItemId(), session.getDatabase().getMasterContainer().getItemId(), session.getSessionId(), stuff), false);
    return RequestHelper.requestParsed(
        String.format(
            "http://localhost:3689/databases/%d/items?session-id=%s&delta=0&type=music&meta=dmap.itemid,dmap.itemname,dmap.itemkind,dmap.persistentid,daap.songalbum,daap.songgrouping,daap.songartist,daap.songalbumartist,daap.songbitrate,daap.songbeatsperminute,daap.songcomment,daap.songcodectype,daap.songcodecsubtype,daap.songcompilation,daap.songcomposer,daap.songdateadded,daap.songdatemodified,daap.songdisccount,daap.songdiscnumber,daap.songdisabled,daap.songeqpreset,daap.songformat,daap.songgenre,daap.songdescription,daap.songrelativevolume,daap.songsamplerate,daap.songsize,daap.songstarttime,daap.songstoptime,daap.songtime,daap.songtrackcount,daap.songtracknumber,daap.songuserrating,daap.songyear,daap.songdatakind,daap.songdataurl,daap.songcontentrating,com.apple.itunes.norm-volume,com.apple.itunes.itms-songid,com.apple.itunes.itms-artistid,com.apple.itunes.itms-playlistid,com.apple.itunes.itms-composerid,com.apple.itunes.itms-genreid,com.apple.itunes.itms-storefrontid,com.apple.itunes.has-videodaap.songcategory,daap.songextradata,daap.songcontentdescription,daap.songlongcontentdescription,daap.songkeywords,com.apple.itunes.is-podcast,com.apple.itunes.mediakind,com.apple.itunes.extended-media-kind,com.apple.itunes.series-name,com.apple.itunes.network-name,com.apple.itunes.episode-num-str,com.apple.itunes.episode-sort,com.apple.itunes.season-num,daap.songgapless,com.apple.itunes.gapless-enc-del,com.apple.itunes.gapless-heur,com.apple.itunes.gapless-enc-dr,com.apple.itunes.gapless-dur,com.apple.itunes.gapless-resy,com.apple.itunes.content-rating",
            session.getDatabase().getItemId(), session.getSessionId()));
  }
Exemplo n.º 21
0
 public long getVolume() {
   try {
     // http://192.168.254.128:3689/ctrl-int/1/getproperty?properties=dmcp.volume&session-id=130883770
     Response resp =
         RequestHelper.requestParsed(
             String.format(
                 "%s/ctrl-int/1/getproperty?properties=dmcp.volume&session-id=%s",
                 session.getRequestBase(), session.sessionId),
             false);
     return resp.getNested("cmgt").getNumberLong("cmvo");
   } catch (Exception e) {
     Log.e(TAG, "Fetch Volume Exception:" + e.getMessage());
   }
   return -1;
 }
Exemplo n.º 22
0
 public ItemsContainer getRadioPlaylist(String playlistid) throws Exception {
   // GET /databases/24691/containers/24699/items?
   // meta=dmap.itemname,dmap.itemid,daap.songartist,daap.songalbum,
   // dmap.containeritemid,com.apple.itunes.has-video,daap.songdisabled,
   // com.apple.itunes.mediakind,daap.songdescription
   // &type=music&session-id=345827905
   return RequestHelper.requestParsed(
       String.format(
           "%s/databases/%d/containers/%s/items?"
               + "meta=dmap.itemname,dmap.itemid,daap.songartist,daap.songalbum,"
               + "dmap.containeritemid,com.apple.itunes.has-video,daap.songdisabled,"
               + "com.apple.itunes.mediakind,daap.songdescription"
               + "&type=music&session-id=%s",
           session.getRequestBase(),
           session.getRadioDatabase().getItemId(),
           playlistid,
           session.getSessionId()),
       false);
 }
Exemplo n.º 23
0
 @GET
 @Produces("text/html")
 @Path(value = "start/{pkgId}")
 public Object startDownload(
     @PathParam("pkgId") String pkgId,
     @QueryParam("source") String source,
     @QueryParam("install") Boolean install,
     @QueryParam("depCheck") Boolean depCheck,
     @QueryParam("type") String pkgType,
     @QueryParam("onlyRemote") Boolean onlyRemote,
     @QueryParam("filterOnPlatform") Boolean filterOnPlatform) {
   PackageManager pm = Framework.getLocalService(PackageManager.class);
   // flag to start install after download
   if (install == null) {
     install = false;
   }
   if (depCheck == null) {
     depCheck = true;
   }
   if (!RequestHelper.isInternalLink(getContext())) {
     DownloadablePackage pkg = pm.getPackage(pkgId);
     return getView("confirmDownload").arg("pkg", pkg).arg("source", source);
   }
   try {
     pm.download(pkgId);
   } catch (ConnectServerError e) {
     return getView("downloadError").arg("e", e);
   }
   return getView("downloadStarted")
       .arg("pkg", getDownloadingPackage(pkgId))
       .arg("source", source)
       .arg("over", false)
       .arg("install", install)
       .arg("depCheck", depCheck)
       .arg("filterOnPlatform", filterOnPlatform.toString())
       .arg("type", pkgType.toString())
       .arg("onlyRemote", onlyRemote.toString());
 }