可能重复:
用于Java的PDF生成库
我正在为当地会计公司制定发票计划.使用Java创建PDF文件的好方法是什么?好的图书馆?我完全不熟悉PDF导出(在任何语言中).
我想创建一个"架构图"来解释我们的软件(库,Eclipse RCP,模块,功能等).
stackoverflow上有很多关于如何使用Gson反序列化json数组的信息.
但是我如何使用XStreamjettison 做同样的事情呢?
这是json:
{"entity":[{"id":"1", "name":"aaa"}, {"id":"2", "name":"bbb"}]}
Run Code Online (Sandbox Code Playgroud)
以下是XStream我尝试解析它的代码:
XStream xstream = new XStream(new JettisonMappedXmlDriver());
xstream.alias("entity", Entity[].class);
return (Entity[])xstream.fromXML(jsonString);
Run Code Online (Sandbox Code Playgroud)
我有以下例外:
com.thoughtworks.xstream.converters.ConversionException: id : id
Run Code Online (Sandbox Code Playgroud) 我可以使用jdbc:postgresql://host:port/databasejdbc驱动程序连接到postgresql服务器中的数据库.
但我想连接到postgresql服务器并在那里找到数据库列表.当我使用时jdbc:postgresql://localhost:5432,我得到一个叫做的例外
java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432
Run Code Online (Sandbox Code Playgroud)
是否有任何其他驱动程序或任何方法来获取服务器的连接,而不知道服务器中的数据库名称并在那里查询数据库列表?
我正在使用SoapUI 5.1.3版本.我发送以下请求到我们的服务.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:upl="http://upload.application.carbon.wso2.org" xmlns:xsd="http://upload.application.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<upl:uploadApp>
<!--Zero or more repetitions:-->
<upl:fileItems>
<!--Optional:-->
<xsd:dataHandler>UEsDBBLjAuMC52MjAxMTA1MjcxNTIxMDAvYXJ0aWZhY3QueG1sUEsFBgAAAAAJAAkAMAMAAC4IAAAAAA==</xsd:dataHandler>
<!--Optional:-->
<xsd:fileName>ESBproject1-1.0.0.car</xsd:fileName>
<!--Optional:-->
<xsd:fileType>jar</xsd:fileType>
</upl:fileItems>
</upl:uploadApp>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
在Web服务端,当我检查dataHandler值时,它似乎在字符串的末尾被截断.我使用Insert file as Base64上下文菜单选项插入文件.我将Enable MTOM属性更改为true.错过发送到Web服务的部分数据可能是什么原因?
UPDATE
我编写了一个HTTP服务器来捕获soap请求,而不是通过将SoapUI中的url更改为Web服务http://localhost:5000/.下面是我写的服务器
public static void main(String[] args) throws Exception {
ServerSocket server = new ServerSocket(5000);
Socket conn = server.accept();
StringBuilder sb = new StringBuilder();
//getBytes() method returns a byte array for InputStream
ByteArrayInputStream reader = new ByteArrayInputStream(getBytes(conn.getInputStream()));
int ch;
while ( (ch = reader.read()) != …Run Code Online (Sandbox Code Playgroud) 我是Java的新手,所以我不知道在我要使用Sigar类的项目中有谁下载zip文件(hyperic-sigar-1.6.4.zip).
我已经尝试导入Sigar.Jar文件,但问题是sigar中每个类的源都是未知的.
所以我使用Eclipse Indigo进行编程,可能有人可以帮助我:)
非常感谢你的问候
马库斯
我正在尝试使用以下代码获取Google搜索结果:
Document doc = con.connect("http://www.google.com/search?q=lakshman").timeout(5000).get();
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个例外:
org.jsoup.HttpStatusException: HTTP error fetching URL. Status=403,URL=http://www.google.com/search?q=lakshman
Run Code Online (Sandbox Code Playgroud)
403错误意味着服务器禁止访问,但我可以在Web浏览器中加载此URL.为什么Jsoup会收到403错误?
我想从Android活动调用一个javascript函数,但它似乎不起作用.我使用了android webview函数webview.loadUrl("javascript:function()"); 这是我的android代码:
package com.example.web;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;
public class MainActivity extends Activity {
WebView webview;
int i=30;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webview = (WebView)findViewById(R.id.webView1);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("file:///android_asset/index.html");
webview.loadUrl("javascript:change(i)");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的HTML代码:
<html>
<body>
<div id="texta">text</div>
<script>
function change(num){
document.getElementById("texta").innerHTML=num;
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在JAVA的最后一年项目工作
1)将图像隐藏在图像中
2)图像中的图像
3)音频文件中的文本(WAVE)
我已成功完成1)和2)并附加了源代码,如果有人需要它.我在第3个中遇到麻烦,即将数据隐藏在音频文件中.我从波形文件创建一个audioinputstream并将其数据读入一个字节数组但很多东西都不清楚,而读取我猜测前44个字节是头字节?(因为文件是WAVE格式)或者标题根本不会被复制.问题是......在再次解码时我必须从字节数组中读取新创建的音频文件中的数据.而且我无法找到隐藏数据的字节.
任何人都可以告诉我当我们从audioinputstream读取数据到字节数组时到底发生了什么,我的意思是实际读入字节数组的是什么?
File fileIn = new File("C:\\Users\\Rahul\\Desktop\\pro\\Don't Stay.wav");
AudioInputStream audioInputStream =
AudioSystem.getAudioInputStream(fileIn);
int avail= audioInputStream.available();
System.out.println("bytes available " +avail);
System.out.println(audioInputStream.markSupported());
int bytesPerFrame =
audioInputStream.getFormat().getFrameSize();
// Set an arbitrary buffer size of 1024 frames.
int numBytes = 1024 * bytesPerFrame;
byte[] audioBytes = new byte[numBytes];
audioInputStream.read(audioBytes);
byte btext[]=Stego_text("good morning!");
byte bcoded[]=steg.encoding(audioBytes,btext,0);
byte[] stg= a.decode_text(audioBytes);
String obtain= new String(stg);
System.out.println(">>>"+ obtain); //the hidden message gets successfully displayed here
try {
//
AudioSystem.write(audioInputStream, Type.WAVE, new File("C:\\Users\\Rahul\\Desktop\\pro\\Don't Stay_restored.wav"));
} catch …Run Code Online (Sandbox Code Playgroud) 我们使用 vertx oauth2 组件来使用 oauth2 授权代码授予来实现 cognito 登录。我们可以使用现有的 API 来实现该场景。但 vertx 期望其 oauth2 配置中的令牌内省路径。否则,无法询问 Cognito 向资源服务器提供的令牌是否正确。无论如何,我们在 cognito 文档上找不到任何关于令牌内省上下文路径是什么的信息。
OAuth2ClientOptions oAuth2ClientOptions = new OAuth2ClientOptions()
.setClientID("***************************")
.setIntrospectionPath("") //what should goes here
.setClientSecret("********************")
.setSite("*****************")
.setTokenPath("/oauth2/token")
.setAuthorizationPath("/oauth2/authorize")
.setFlow(OAuth2FlowType.AUTH_CODE)
Run Code Online (Sandbox Code Playgroud) java ×6
android ×1
connection ×1
diagram ×1
eclipse ×1
export ×1
html ×1
javascript ×1
json ×1
jsoup ×1
mtom ×1
oauth-2.0 ×1
pdf ×1
postgresql ×1
sigar ×1
soapui ×1
sql ×1
vert.x ×1
web-services ×1
xstream ×1