List of usage examples for java.net URISyntaxException printStackTrace
public void printStackTrace()
From source file:org.megam.deccanplato.provider.box.handler.FileImpl.java
/** * @return/* ww w. j a v a2s . c o m*/ */ private Map<String, String> download() { System.out.println("File Download"); Map<String, String> outMap = new HashMap<>(); final String BOX_DOWNLOAD = "/files/" + args.get(FILE_ID) + "." + args.get(FILE_TYPE) + "/content"; Map<String, String> headerMap = new HashMap<String, String>(); headerMap.put("Authorization", "BoxAuth api_key=" + args.get(API_KEY) + "&auth_token=" + args.get(TOKEN)); TransportTools tools = new TransportTools(BOX_URI + BOX_DOWNLOAD, null, headerMap); String responseBody = null; TransportResponse response = null; try { response = TransportMachinery.get(tools); responseBody = response.entityToString(); System.out.println("OUTPUT:" + responseBody); } catch (ClientProtocolException ce) { ce.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } outMap.put(OUTPUT, responseBody); return outMap; }
From source file:org.ehealth_connector.demo.iti.pix.DemoMPIClient.java
private void init() { try {/* w w w . ja v a2s . c o m*/ dest.setPixQueryUri(new URI("http://" + ipAddress + ":9090")); dest.setPixSourceUri(new URI("http://" + ipAddress + ":9090")); } catch (URISyntaxException e) { e.printStackTrace(); } dest.setSenderApplicationOid(senderApplicationOid); dest.setReceiverApplicationOid(applicationName); dest.setReceiverFacilityOid(facilityName); }
From source file:de.hero.vertretungsplan.CheckForAppUpdate.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { boolean setTimer = intent.getBooleanExtra("setTimer", false); boolean checkNow = intent.getBooleanExtra("checkNow", false); Intent i = new Intent(this, de.hero.vertretungsplan.CheckForAppUpdate.class); i.putExtra("checkNow", true); PendingIntent pi = PendingIntent.getService(this, 0, i, 0); AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); am.cancel(pi);// w w w . j a v a 2s .c o m Log.d("CheckForAppUpdate", "Alarm canceled"); if (setTimer) { long lngInterval = AlarmManager.INTERVAL_DAY * 7; Log.d("CheckForAppUpdate", "Alarm set"); am.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + AlarmManager.INTERVAL_DAY * 6, lngInterval, pi); //For debugging: after 10 seconds //am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 25000 , AlarmManager.INTERVAL_HOUR , pi); } if (checkNow) { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected()) { try { new HtmlWorkAppUpdate(this).execute(new URI(getString(R.string.htmlAdresseAktuelleVersion))); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return START_NOT_STICKY; }
From source file:org.opendatakit.aggregate.servlet.OpenIdLoginPageServlet.java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { CallingContext cc = ContextFactory.getCallingContext(this, req); // Check to make sure we are using the canonical server name. // If not, redirect to that name. This ensures that authentication // cookies will have the proper realm(s) established for them. String newUrl = cc.getServerURL() + BasicConsts.FORWARDSLASH + ADDR; String query = req.getQueryString(); if (query != null && query.length() != 0) { newUrl += "?" + query; }//from w w w . j av a2s . co m URL url = new URL(newUrl); if (!url.getHost().equalsIgnoreCase(req.getServerName())) { logger.info("Incoming servername: " + req.getServerName() + " expected: " + url.getHost() + " -- redirecting."); // try to get original destination URL from Spring... String redirectUrl = getRedirectUrl(req, ADDR); try { URI uriChangeable = new URI(redirectUrl); URI newUri = new URI(url.getProtocol(), null, url.getHost(), url.getPort(), uriChangeable.getPath(), uriChangeable.getQuery(), uriChangeable.getFragment()); newUrl = newUri.toString(); } catch (URISyntaxException e) { e.printStackTrace(); } // go to the proper page (we'll most likely be redirected back to here for authentication) resp.sendRedirect(newUrl); return; } // OK. We are using the canonical server name. String redirectParamString = getRedirectUrl(req, AggregateHtmlServlet.ADDR); // we need to appropriately cleanse this string for the OpenID login // strip off the server pathname portion if (redirectParamString.startsWith(cc.getSecureServerURL())) { redirectParamString = redirectParamString.substring(cc.getSecureServerURL().length()); } else if (redirectParamString.startsWith(cc.getServerURL())) { redirectParamString = redirectParamString.substring(cc.getServerURL().length()); } while (redirectParamString.startsWith("/")) { redirectParamString = redirectParamString.substring(1); } // check for XSS attacks. The redirect string is emitted within single and double // quotes. It is a URL with :, /, ? and # characters. But it should not contain // quotes, parentheses or semicolons. String cleanString = redirectParamString.replaceAll(BAD_PARAMETER_CHARACTERS, ""); if (!cleanString.equals(redirectParamString)) { logger.warn("XSS cleanup -- redirectParamString has forbidden characters: " + redirectParamString); redirectParamString = cleanString; } logger.info("Invalidating login session " + req.getSession().getId()); // Invalidate session. HttpSession s = req.getSession(); if (s != null) { s.invalidate(); } // Display page. resp.setContentType(HtmlConsts.RESP_TYPE_HTML); resp.setCharacterEncoding(HtmlConsts.UTF8_ENCODE); resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); resp.setHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); resp.setHeader("Pragma", "no-cache"); resp.addHeader(HtmlConsts.X_FRAME_OPTIONS, HtmlConsts.X_FRAME_SAMEORIGIN); PrintWriter out = resp.getWriter(); out.print( "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" + "<html>" + "<head>" + "<meta http-equiv=\"cache-control\" content=\"no-store, no-cache, must-revalidate\"/>" + "<meta http-equiv=\"expires\" content=\"Mon, 26 Jul 1997 05:00:00 GMT\"/>" + "<meta http-equiv=\"pragma\" content=\"no-cache\"/>" + "<link rel=\"icon\" href=\"favicon.ico\"/>" + "<title>Log onto Aggregate</title>" + "<link type=\"text/css\" rel=\"stylesheet\" href=\"AggregateUI.css\">" + "<link type=\"text/css\" rel=\"stylesheet\" href=\"stylesheets/button.css\">" + "<link type=\"text/css\" rel=\"stylesheet\" href=\"stylesheets/table.css\">" + "<link type=\"text/css\" rel=\"stylesheet\" href=\"stylesheets/navigation.css\">" + "<script type=\"text/javascript\">" + "window.onbeforeunload=function() {\n" + "var e=document.getElementById(\"stale\");\n" + "e.value=\"yes\";\n" + "}\n" + "window.onload=function(){\n" + "var e=document.getElementById(\"stale\");\n" + "if(e.value==\"yes\") {window.location.reload(true);}\n" + "}\n" + "</script>" + "</head>" + "<body>" + "<input type=\"hidden\" id=\"stale\" value=\"no\">" + "<table width=\"100%\" cellspacing=\"30\"><tr>" + "<td align=\"LEFT\" width=\"10%\"><img src=\"odk_color.png\" id=\"odk_aggregate_logo\" /></td>" + "<td align=\"LEFT\" width=\"90%\"><font size=\"7\">Log onto Aggregate</font></td></tr></table>" + "<table cellspacing=\"20\">" + "<tr><td valign=\"top\">" + "<form action=\"local_login.html\" method=\"get\">" + "<script type=\"text/javascript\">" + "<!--\n" + "document.write('<input name=\"redirect\" type=\"hidden\" value=\"" + redirectParamString + "' + window.location.hash + '\"/>');" + "\n-->" + "</script>" + "<input class=\"gwt-Button\" type=\"submit\" value=\"Sign in with Aggregate password\"/>" + "</form></td>" + "<td valign=\"top\">Click this button to log onto Aggregate using the username " + "and password that have been assigned to you by the Aggregate site administrator.</td></tr>" + "<tr><td valign=\"top\">" + "<form action=\"j_spring_openid_security_check\" method=\"post\">" + "<script type=\"text/javascript\">" + "<!--\n" + "var pathSlash=(window.location.pathname.lastIndexOf('/') > 1) ? '/' : '';\n" + "document.write('<input name=\"spring-security-redirect\" type=\"hidden\" value=\"' + " + "encodeURIComponent(pathSlash + '" + redirectParamString + "' + window.location.hash) + '\"/>');" + "\n-->" + "</script>" + "<input name=\"openid_identifier\" size=\"50\" maxlength=\"100\" " + "type=\"hidden\" value=\"https://www.google.com/accounts/o8/id\"/>" + "<input class=\"gwt-Button\" type=\"submit\" value=\"Sign in with Google\"/>" + "</form></td>" + "<td valign=\"top\">Click this button to log onto Aggregate using your Google account (via OpenID).<p>" + "<font color=\"blue\">NOTE:</font> you must allow this site to obtain your e-mail address. " + "Your e-mail address will only be used for establishing website access permissions.</p></td></tr>" + "<tr><td valign=\"top\">" + "<script type=\"text/javascript\">" + "<!--\n" + "document.write('<form action=\"" + redirectParamString + "' + window.location.hash + '\" method=\"get\">');" + "document.write('<input class=\"gwt-Button\" type=\"submit\" value=\"Anonymous Access\"/></form>');" + "\n-->" + "</script>" + "</td>" + "<td valign=\"top\">Click this button to access Aggregate without logging in.</td></tr>" + "</table>" + "</body>" + "</html>"); }
From source file:com.brightcove.com.uploader.verifier.UploadData.java
public JsonNode getJsonForDelivery(BasicNameValuePair delivery) { List<NameValuePair> parameters = new ArrayList<NameValuePair>(); if (mTitleID != null) { parameters.add(new BasicNameValuePair("command", "find_video_by_id")); parameters.add(new BasicNameValuePair("video_id", mTitleID.toString())); } else {/* w w w . ja v a 2 s.c om*/ parameters.add(new BasicNameValuePair("command", "find_video_by_reference_id")); parameters.add(new BasicNameValuePair("reference_id", mIngestFile.getRefId())); } parameters.add(new BasicNameValuePair("token", mAccount.getDefaultReadToken())); parameters.add(delivery); parameters.add(new BasicNameValuePair("fields", "thumbnailURL,videoStillURL," + "shortDescription,tags,customFields,id,length," + "creationDate,publishedDate,startDate,endDate,linkURL,referenceId," + "linkText,videoFullLength,longDescription,accountId," + "itemState,lastModifiedDate,economics,adKeys,geoRestricted," + "geoFilteredCountries,geoFilterExclude,cuePoints,playsTotal," + "playsTrailingWeek,FLVURL,renditions,iosrenditions,name")); JsonNode result = null; try { result = (new MediaAPIHelper()).executeRead(mEnvironment, parameters); } catch (URISyntaxException uriSyntaxException) { uriSyntaxException.printStackTrace(); } catch (MediaAPIError e) { e.printStackTrace(); } return result; }
From source file:org.apache.cxf.sts.claims.LdapClaimsHandler.java
public List<URI> getSupportedClaimTypes() { List<URI> uriList = new ArrayList<URI>(); for (String uri : getClaimsLdapAttributeMapping().keySet()) { try {//from w w w . ja va2 s .co m uriList.add(new URI(uri)); } catch (URISyntaxException e) { e.printStackTrace(); } } return uriList; }
From source file:op.system.DlgLogin.java
private void btnAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAboutActionPerformed if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); try {// w w w . j a va 2 s. c om desktop.browse(new URI("http://www.offene-pflege.de")); } catch (IOException ioe) { ioe.printStackTrace(); } catch (URISyntaxException use) { use.printStackTrace(); } } }
From source file:com.amossys.hooker.reporting.NetworkEventSenderThread.java
public boolean send(InterceptEvent event) { try {/*ww w .jav a 2s . c o m*/ this.targetURI = new URI("http://" + host + ":" + port + "/" + this.esIndex.toLowerCase() + "/" + this.esDoctype.toLowerCase() + "?parent=" + event.getIDXP() + "&op_type=create"); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } SubstrateMain.log("Sending Event to " + this.targetURI); boolean result = false; StringEntity se; try { se = new StringEntity(event.toJson()); HttpPost httpPost = new HttpPost(this.targetURI); httpPost.setEntity(se); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); // Executes POST request to the given URL HttpResponse httpResponse = this.httpClient.execute(httpPost); // Receives response as inputStream InputStream inputStream = httpResponse.getEntity().getContent(); // Converts inputStream to string // TODO: we should parse the elasticsearch result result = inputStream != null; SubstrateMain.log("Event succesfully sent !"); if (inputStream != null) { inputStream.close(); } } catch (UnsupportedEncodingException e) { SubstrateMain.log( "Impossible to send data to remote database due to encoding issues (" + e.getMessage() + ")", e); } catch (IOException e) { SubstrateMain.log( "Impossible to connect to the remote database, check the connectivity (" + e.getMessage() + ")", e); } return result; }
From source file:fr.eurecom.nerd.core.proxy.ExtractivClient.java
private List<TEntity> parse(String text, String serviceKey, OntologyType otype) { List<TEntity> result = new LinkedList<TEntity>(); URI endpoint;//from ww w.j a v a2 s. c o m try { endpoint = new URI(EXTRACTIV_SERVER_LOCATION); HttpMethodBase extractivRequest = getExtractivProcessString(endpoint, text, serviceKey); InputStream extractivResults = fetchHttpRequest(extractivRequest); Readable jsonReadable = new InputStreamReader(extractivResults); ExtractivJSONParser jsonParser = new ExtractivJSONParser(jsonReadable); Map<String, Integer> map = new HashMap<String, Integer>(); for (Document document : jsonParser) for (com.extractiv.Entity item : document.getEntities()) { String label = item.asString(); String type = item.getType(); String nerdType = OntoFactory.mapper.getNerdType(otype, label, SOURCE, type).toString(); String uri = (item.getLinks().size() > 0) ? item.getLinks().get(0) : "null"; // Integer startChar = item.getOffset(); // Integer endChar = startChar + item.getCharLength(); // TEntity extraction = new TEntity(label, type, uri, nerdType, // startChar, endChar, confidence, SOURCE); // result.add(extraction); //logic to compute the startchar and endchar of the entity within the text Integer startchar = null, endchar = null; if (map.containsKey(label)) { int value = map.get(label); map.remove(label); map.put(label, new Integer(value + 1)); } else map.put(label, new Integer(1)); try { Pattern p = Pattern.compile("\\b" + label + "\\b"); Matcher m = p.matcher(text); for (int j = 0; j < map.get(label) && m.find(); j++) { startchar = m.start(0); endchar = m.end(0); if (containsAtIndex(result, startchar, endchar)) j--; } Double confidence = 0.5; if (startchar != null && endchar != null) { TEntity extraction = new TEntity(label, type, uri, nerdType.toString(), startchar, endchar, confidence, SOURCE); result.add(extraction); } } catch (PatternSyntaxException eregex) { eregex.printStackTrace(); } } } catch (URISyntaxException e) { e.printStackTrace(); } catch (BadInputException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } return result; }
From source file:gov.nih.nci.cacis.transformer.AbstractTransformerSystemTest.java
/** * Gets a valid Message. Default implementation reads a valid SOAPMessage that has been serialized to a file. * /*from w ww. ja va 2s. c o m*/ * @see getValidSOAPMessageFilename * @return string representation of a valid message */ protected String getValidMessage() { final URL url = getClass().getClassLoader().getResource(getValidSOAPMessageFilename()); File msgFile = null; try { msgFile = new File(url.toURI()); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } String validMessage = null; try { validMessage = FileUtils.readFileToString(msgFile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return validMessage; }