我已经知道图像的位置了,但为了简单起见,我想用JSoup本身下载图像.(这是为了简化获取cookie,推荐人等)
这是我到目前为止:
//Open a URL Stream
Response resultImageResponse = Jsoup.connect(imageLocation).cookies(cookies).ignoreContentType(true).execute();
// output here
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(new java.io.File(outputFolder + name));
//BufferedWriter out = new BufferedWriter(new FileWriter(outputFolder + name));
out.write(resultImageResponse.body()); // resultImageResponse.body() is where the image's contents are.
out.close();
Run Code Online (Sandbox Code Playgroud) 我在数据库中有字节数组.
如何从java中的字节数组中提取文件扩展名(mime/type)?
如何在特定的Liferay页面上找到添加的portlet?
例如:
我有三个页面:欢迎,维基和搜索.
现在所有这些页面都添加了portlet,其中一些是可实例化的portlet(如web-content display和iframe portlets).
现在我想在请求参数等形式的信息传递给iframe-portlet
上Search page
从Welcome page
.
我需要上传图片:
<form method="post" action="hi.iq/register.jsp" enctype="multipart/form-data">
Name: <input type="text" name="name" value="J.Doe">
file: <input type="file" name="file-upload">
<input type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
在我的servlet中,我给了
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String name = request.getParameter("name");
System.out.println("user_id========= "+name);
Run Code Online (Sandbox Code Playgroud)
但是值的值name
返回为NULL
.
请帮助
我的问题:
我成功获取了我的实体的单个记录,但是当我触发搜索查询或尝试获取多个实体时,我得到:
com.liferay.portal.kernel.bean.BeanLocatorException:尚未为servlet上下文设置BeanLocator MyCustom-portlet
我已经按照以下一些链接来设置Junit与Liferay:
我的环境
Liferay 6.0.5 EE与Tomcat捆绑在一起
带有Liferay IDE 1.4的Eclipse Helios使用Junit4
我在eclipse中使用"ant"命令运行我的测试,但不是通过输入Alt+ Shift+ X, T.
这将是非常有益的,如果我能得到一些想法,如何去使用的交易使用JUnit(或至少一些想法,它是如何工作的Liferay),以及如何解决BeanLocatorException
(或者至少是为什么会被抛出)
任何帮助将不胜感激.
我正在使用Liferay 6进行门户开发.在Liferay下创建用户期间,我还需要添加一些额外的字段吗?如果这是可能的,请告诉我?
请看这里附的屏幕截图,也请告诉我哪个表格会存放在数据库中?
前历史:我data exception: string data, right truncation
在更新实体时遇到JDBCExceptionReporter 异常.
我发现这意味着,数据对于指定来说太大了varchar
.
在service.xml
列中指定如下:
<column name="message" type="String"/>
Run Code Online (Sandbox Code Playgroud)
我在Liferay的源代码中找到了ServiceBuilder
这个片段:
else if (colType.equals("String")) {
Map<String, String> hints = ModelHintsUtil.getHints(
_packagePath + ".model." + entity.getName(), colName);
int maxLength = 75;
if (hints != null) {
maxLength = GetterUtil.getInteger(
hints.get("max-length"), maxLength);
}
if (col.isLocalized()) {
maxLength = 4000;
}
if (maxLength < 4000) {
sb.append("VARCHAR(" + maxLength + ")");
}
else if (maxLength == 4000) {
sb.append("STRING");
}
else if (maxLength …
Run Code Online (Sandbox Code Playgroud) 我有这样的HTML代码:
<div class="a">html value 1</div>
<div class="a">html value 2</div>
Run Code Online (Sandbox Code Playgroud)
如何访问html value 1
和html value 2
使用jquery?
在我的portlet中执行添加/更新操作时,如何禁用此默认消息:"我的请求已成功处理"我的插件portlet?
此外,我想为我的自定义配置页面(configuration.jsp
)禁用此功能,这是当我们点击每个portlet右上角出现的扳手图标时显示的配置页面.
是否有我可以设置的配置选项或我可以编写的一些代码来禁用它?
或者是否可以从我的自定义portlet更改消息ConfigurationActionImpl
?