Package java.net

Examples of java.net.URL.openConnection()


    return null;
  }

  private InputStream openStreamForLocalUrl(final String localUrl) throws MalformedURLException, IOException {
    URL url = new URL("http://" + mConfig.getDreamboxAddress() + localUrl);
    URLConnection connection = url.openConnection();

    // set user and password
    String userpassword = mConfig.getUserName() + ":" + mConfig.getPassword();
    String encoded = new String(Base64.encodeBase64(userpassword.getBytes()));
    connection.setRequestProperty("Authorization", "Basic " + encoded);
View Full Code Here


     */
    public TreeMap<String, String> getServiceDataBonquets(String service) {
        try {
            URL url = new URL("http://" + mProperties.getProperty("ip","") + "/web/getservices?bRef=" + service);

            URLConnection connection = url.openConnection();

            String userpassword = mProperties.getProperty("username", "") + ":" + IOUtilities.xorEncode(mProperties.getProperty("password", ""), DreamboxSettingsPanel.PASSWORDSEED);
            String encoded = new String(Base64.encodeBase64(userpassword.getBytes()));
            connection.setRequestProperty("Authorization", "Basic " + encoded);

View Full Code Here

     * @return Data of specific service
     */
    public TreeMap<String, String> getServiceData(String service) {
        try {
            URL url = new URL("http://" + mProperties.getProperty("ip", "") + "/web/getservices?sRef=" + service);
            URLConnection connection = url.openConnection();

            String userpassword = mProperties.getProperty("username", "") + ":" + IOUtilities.xorEncode(mProperties.getProperty("password", ""), DreamboxSettingsPanel.PASSWORDSEED);
            String encoded = new String(Base64.encodeBase64(userpassword.getBytes()));
            connection.setRequestProperty("Authorization", "Basic " + encoded);

View Full Code Here

    private void getEPGData(TvDataUpdateManager updateManager, Channel ch) {
        try {
            URL url = new URL("http://" + mProperties.getProperty("ip", "") + "/web/epgservice?sRef=" + StringUtils.replace(StringUtils.replace(ch.getId().substring(5), "_", ":"), " ", "%20"));

            URLConnection connection = url.openConnection();

            String userpassword = mProperties.getProperty("username", "") + ":" + IOUtilities.xorEncode(mProperties.getProperty("password", ""), DreamboxSettingsPanel.PASSWORDSEED);
            String encoded = new String(Base64.encodeBase64(userpassword.getBytes()));
            connection.setRequestProperty("Authorization", "Basic " + encoded);
View Full Code Here

   *           If the device could not be contacted
   */
  private StringBuffer readDeviceData(String page) throws TopfieldConnectionException {
    try {
      URL deviceURL = configuration.getDeviceURL(page);
      URLConnection connection = deviceURL.openConnection();
      connection.setConnectTimeout(configuration.getConnectionTimeout());
      InputStream contentStream = (InputStream) connection.getContent();
      BufferedReader in = new BufferedReader(new InputStreamReader(contentStream));
      StringBuffer content = new StringBuffer();
      String line;
View Full Code Here

              .get(Calendar.MONTH) + 1, recordStart.get(Calendar.YEAR), recordStart.get(Calendar.HOUR_OF_DAY),
              recordStart.get(Calendar.MINUTE), recordTime.getLength() / 60, recordTime.getLength() % 60);
        }

        URL deviceURL = configuration.getDeviceURL(INSERT_TIMER_PAGE);
        URLConnection connection = deviceURL.openConnection();
        connection.setConnectTimeout(configuration.getConnectionTimeout());
        connection.setDoOutput(true);
        OutputStreamWriter connectionWriter = new OutputStreamWriter(connection.getOutputStream());
        connectionWriter.write(request);
        connectionWriter.close();
View Full Code Here

   */
  public boolean deleteRecording(Window parent, TopfieldTimerEntry entry) throws TopfieldConnectionException {
    String request = String.format(DELETE_FORMAT, entry.getEntryNumber());
    try {
      URL deviceURL = configuration.getDeviceURL(DELETE_TIMER_PAGE);
      URLConnection connection = deviceURL.openConnection();
      connection.setConnectTimeout(configuration.getConnectionTimeout());
      connection.setDoOutput(true);
      OutputStreamWriter connectionWriter = new OutputStreamWriter(connection.getOutputStream());
      connectionWriter.write(request);
      connectionWriter.close();
View Full Code Here

                .append("&channel=")
                .append(channel.getId());
        System.out.println(buf);
        URL url = new URL(buf.toString());

        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        InputStream in = con.getInputStream();

        BufferedReader reader = new BufferedReader(new InputStreamReader(in));

        Matcher matcher;
View Full Code Here

protected void writeReportFile(String fileName) {
    URLConnection conn = null;

    try {
  URL url = new URL(fileName);
  conn = url.openConnection();
  conn.setDoOutput(true);

  sendData(conn);
  // I don't know why, but we have to read the response from the
  // server, even if it's empty.
View Full Code Here

    model.read(new File("testdata/danbri-20060920123618661.rdf").toURL()
        .toString());
    URL serverURL = new URL("http://"
        + serverBinding.getInetAddress().getHostName() + ":"
        + serverBinding.getPort() + "/danbri");
    HttpURLConnection connection = (HttpURLConnection) serverURL
        .openConnection();
    connection.setDoOutput(true);
    connection.setRequestMethod("PUT");
    OutputStream out = connection.getOutputStream();
    model.write(out);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.