我正在使用PostgreSQL开发一个Node.js应用程序并在Heroku上托管.我的问题是我收到了如下身份验证错误:
14:32:05 web.1 | { [error: no pg_hba.conf entry for host "193.40.244.196", user "username", database "database_name", SSL off]
14:32:05 web.1 | length: 168,
14:32:05 web.1 | name: 'error',
14:32:05 web.1 | severity: 'FATAL',
14:32:05 web.1 | code: '28000',
14:32:05 web.1 | detail: undefined,
14:32:05 web.1 | hint: undefined,
14:32:05 web.1 | position: undefined,
14:32:05 web.1 | internalPosition: undefined,
14:32:05 web.1 | internalQuery: undefined,
14:32:05 web.1 | where: undefined,
14:32:05 web.1 | file: 'auth.c',
14:32:05 web.1 | line: '483',
14:32:05 web.1 …Run Code Online (Sandbox Code Playgroud) 我需要在Spring Security conf中禁用缓存控制头.
根据文档,一个简单的http.headers.disable()应该这样做,但我仍然看到了
Cache-Control:no-cache, no-store, max-age=0, must-revalidate
Expires:0
Pragma:no-cache
Run Code Online (Sandbox Code Playgroud)
回复中的标题.
我目前的安全配置是:
http.antMatcher("/myPath/**") // "myPath" is of course not the real path
.headers().disable()
.authorizeRequests()
// ... abbreviated
.anyRequest().authenticated();
Run Code Online (Sandbox Code Playgroud)
到目前为止我尝试过的事情:
application.properties
我添加了这security.headers.cache=false条线,但没有区别.
使用过滤器
我尝试了以下过滤器:
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
chain.doFilter(request, new HttpServletResponseWrapper((HttpServletResponse) response) {
@Override
public void setHeader(String name, String value) {
if (name.equalsIgnoreCase("Cache-Control")) {
value = "";
} else if (name.equalsIgnoreCase("Expires")) {
value = "";
} else if …Run Code Online (Sandbox Code Playgroud) 我有一个对话框,里面有一个列表(TextView里面有一堆s LinearLayout)ScrollView.布局如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/delete_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<ScrollView
android:id="@+id/filename_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/filename_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<View
android:id="@+id/horisontal_separator"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:id="@+id/button_container"
android:layout_width="match_parent"
android:layout_height="48dp" >
<Button
android:id="@+id/load_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/button_load"
android:gravity="center"
android:layout_weight="1" />
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="@android:color/darker_gray" />
<Button
android:id="@+id/delete_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/button_delete"
android:gravity="center"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
它看起来像只有列表中的几个项目:

但是当屏幕上有更多东西可以放入时(实际需要滚动),我的按钮会被推到屏幕下方.当一直滚动到底部时,它看起来像这样:

我需要LinearLayout包含按钮作为页脚,它不应该滚动到任何地方,显然不会消失.我试图摆弄布局高度和重量,但无济于事.
我有一个显示评论的活动.注释本身有一个布局,所以我不能只使用ListView.
我用循环添加注释,程序遍历整个循环(通过LogCat检查),但只将第一个View(注释)添加到linearlayout.
我的代码(实际上fillComments参数将不是String []):
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.comment_layout);
String[] comments = {"kommentaar 1", "kommentaar 2", "kommentaar 3"};
mTitle = (TextView) findViewById(R.id.comments_title);
mTextArea = (EditText) findViewById(R.id.comment_editor);
mAddButton = (Button) findViewById(R.id.add_comment);
mCommentArea = (LinearLayout) findViewById(R.id.comments_area);
mTitle.setText(getIntent().getStringExtra("name"));
fillComments(comments);
}
private void fillComments(String[] comments) {
View comment;
TextView commentator;
TextView commentDate;
TextView commentText;
LayoutInflater inflater = getLayoutInflater();
for (String s : comments) {
Log.d("Comment adder", "Adding comment " + s);
comment = inflater.inflate(R.layout.comment_row_layout, null);
commentator = (TextView) comment.findViewById(R.id.commentator);
commentDate = …Run Code Online (Sandbox Code Playgroud) 我正在使用node.js 的node-postgres模块,我在插入数据时遇到问题.
功能:
function addItems(listId, listItems, handle) {
if (!listItems) {
handle(listId);
return;
}
var client = dbConnector.getClient(),
important,
dateArray,
dateString,
i,
prepStatement;
client.connect();
for (i in listItems) {
console.log(listItems[i]);
dateArray = listItems[i].itemdate.split('-');
dateString = dateArray[1] + '-' + dateArray[0] + '-' + dateArray[2];
if (listItems[i].important) {
important = 'true';
} else {
important = 'false';
}
prepStatement = {
name: 'insert task',
text: 'INSERT INTO listitem (todolist_id, name, deadline, description, important, done, created) VALUES ($1, $2, $3, …Run Code Online (Sandbox Code Playgroud) android ×2
node.js ×2
caching ×1
java ×1
postgresql ×1
scrollview ×1
security ×1
spring-boot ×1